Status: done
Implemented by subagent, then documentation was adjusted in README.md so the smoke example uses backend model fallback by default and documents AGENT_LAB_OPENAI_INCLUDE_USAGE.
Commands:
uv run pytest tests/test_websocket_api.py tests/test_ws_smoke.py
uv run pytest
uv run python -c "from agent_lab.main import app; print(app.title)"
uv run python scripts/ws_smoke.py --help
Results:
10 passed, 1 warning in 0.23s14 passed, 1 warning in 0.24sAgent LabFix code-review findings that can break real OpenAI Chat Completions compatible providers.
This todo covers:
tool messages do not send unsupported name fields.stream_options.include_usage for providers that reject stream options.This todo does not cover:
src/agent_lab/application/contracts.pysrc/agent_lab/infrastructure/chat_client.pysrc/agent_lab/settings.pysrc/agent_lab/presentation/static/index.htmlsrc/agent_lab/presentation/static/app.jsscripts/ws_smoke.py.env.exampledocs/plans/todos.md.AgentParams.model should be optional. If omitted or blank, OpenAICompatibleChatClient uses Settings.openai_default_model.
Provider message serialization should be role-aware:
system, user, assistant: include role, content, and assistant tool_calls when present.tool: include only role, content, and tool_call_id.Add Settings.openai_include_usage: bool = True. When true, send stream_options: {"include_usage": True}; when false, omit stream_options.
The static UI and smoke helper should send an empty model by default, allowing backend fallback. Users may still provide a model explicitly.
name while preserving tool_call_id.stream_options is omitted when configured off.AGENT_LAB_OPENAI_INCLUDE_USAGE setting and .env.example entry.Run:
uv run pytest tests/test_websocket_api.py tests/test_ws_smoke.py
uv run pytest
uv run python scripts/ws_smoke.py --help
Expected result: