6ede33ccdb
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Has been cancelled
Build and Push Docker Images / finalize_release (push) Has been cancelled
Obsidian Plugin Lint / lint (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / compute_version (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / verify_digests (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Has been cancelled
54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
"""Smoke test: scripted harness drives create_agent end-to-end and produces a tool-call-then-final-text trace."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
from langchain.agents import create_agent
|
|
|
|
from tests.integration.harness import (
|
|
ScriptedTurn,
|
|
StubToolSpec,
|
|
build_scripted_harness,
|
|
)
|
|
|
|
pytestmark = pytest.mark.integration
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_scripted_harness_drives_basic_agent() -> None:
|
|
harness = build_scripted_harness(
|
|
turns=[
|
|
ScriptedTurn(
|
|
tool_calls=[
|
|
{"name": "echo", "args": {"x": 1}, "id": "call_1"},
|
|
]
|
|
),
|
|
ScriptedTurn(text="done"),
|
|
],
|
|
tools=[
|
|
StubToolSpec(
|
|
name="echo",
|
|
description="Echo args back.",
|
|
handler=lambda **kwargs: {"echoed": kwargs},
|
|
),
|
|
],
|
|
)
|
|
|
|
agent = create_agent(
|
|
harness.model,
|
|
system_prompt="You are a test agent.",
|
|
tools=harness.tools,
|
|
)
|
|
|
|
result = await agent.ainvoke({"messages": [("user", "do the thing")]})
|
|
messages = result["messages"]
|
|
final_ai = next(
|
|
(m for m in reversed(messages) if m.__class__.__name__ == "AIMessage"),
|
|
None,
|
|
)
|
|
assert final_ai is not None
|
|
assert final_ai.content == "done"
|
|
tool_messages = [m for m in messages if m.__class__.__name__ == "ToolMessage"]
|
|
assert len(tool_messages) == 1
|
|
assert "echoed" in str(tool_messages[0].content)
|