Status: done
Implemented by subagent and committed as b2bba51 Add explicit runtime queues.
Main-session verification:
uv run pytest tests/test_debug_runtime.py
uv run pytest
Results:
5 passed in 0.06s19 passed, 1 warning in 0.25sRefactor the runtime internals to use explicit input, output, and event queues while preserving the existing WebSocket stream contract.
The MVP works, but the original requirement describes three data-exchange channels:
The current DebugRuntime.run() performs these steps directly. This todo introduces the queue structure now, without changing HTTP/WebSocket payloads.
This todo covers:
asyncio.Queue objects for input, output, and events.DebugRuntime.run() as the public async generator consumed by FastAPI.This todo does not cover:
src/agent_lab/application/queues.pysrc/agent_lab/application/runtime.pytests/test_debug_runtime.py.docs/plans/todos.md.Add a RuntimeQueues dataclass:
@dataclass
class RuntimeQueues:
input: asyncio.Queue[ChatMessage]
output: asyncio.Queue[dict[str, Any]]
events: asyncio.Queue[ToolCallEvent]
DebugRuntime.run() should:
input.output.events.events and put tool replies back on input.output so the WebSocket contract stays unchanged.Keep the implementation single-process and deterministic. Use sentinel-free sequential draining for this MVP; do not introduce background tasks unless needed by the tests.
RuntimeQueues;RuntimeQueues.DebugRuntime.run() to use the queues internally.Run:
uv run pytest tests/test_debug_runtime.py
uv run pytest
Evaluate whether Todo 10 still starts with tool registry management or should be adjusted based on the queue abstraction.
Expected result: