Status: done
Implemented by subagent and locally verified.
Commands:
uv run pytest
uv run python -c "from agent_lab.main import app; print(app.title)"
Results:
uv run pytest: 8 passed, 1 warning in 0.24sAgent LabEvaluation note: real LLM configuration already exists through Settings, so Todo 4 should focus on documentation and a minimal manual smoke helper rather than adding another runtime layer.
Expose the domain runtime through FastAPI WebSocket and serve a usable static debug console.
This todo covers:
TestClient and a fake runtime/client where possible.This todo does not cover:
src/agent_lab/application/runtime.pysrc/agent_lab/infrastructure/chat_client.pysrc/agent_lab/settings.pysrc/agent_lab/main.pysrc/agent_lab/presentation/web.pysrc/agent_lab/presentation/static/index.htmlsrc/agent_lab/presentation/static/app.jssrc/agent_lab/presentation/static/styles.csstests/test_websocket_api.pydocs/plans/todos.md after evaluation only.Frontend sends one JSON object to /ws/debug:
{
"user_message": "debug this",
"system_prompts": ["You are a debugger."],
"pre_messages": [],
"chat_agent": {
"model": "gpt-4.1-mini",
"temperature": 0.2,
"max_tokens": 800
},
"event_agent": {
"enabled_tools": ["handoff_note"],
"max_event_loops": 3
}
}
Server sends newline-independent JSON WebSocket messages already produced by DebugRuntime.run(), plus an error message on validation/runtime failures.
/health and /ws/debug with a fake runtime or fake chat client.DebugRuntime to aggregate streamed assistant content and append assistant messages to history when a model turn completes.Settings with pydantic-settings fields:
openai_api_keyopenai_base_urlopenai_default_modelrequest_timeout_secondsOpenAICompatibleChatClient using httpx.AsyncClient.stream() against /chat/completions, with stream: true, configured model params, tool definitions, and ChatCompletionStreamParser.GET /healthGET /WebSocket /ws/debugRun focused tests:
uv run pytest tests/test_websocket_api.py tests/test_debug_runtime.py
Run full tests:
uv run pytest
Expected result:
uv run python -c "from agent_lab.main import app; print(app.title)".