Repository navigation
feat: [2/2] Execute multi-agent HTTP Responses and verify recorded contracts - #373
Conversation
Signed-off-by: maral <[email protected]>
Signed-off-by: maral <[email protected]>
Signed-off-by: maral <[email protected]>
Signed-off-by: maral <[email protected]>
Signed-off-by: maral <[email protected]>
96494f8 to
86be78b
Compare
Signed-off-by: maral <[email protected]>
Signed-off-by: maral <[email protected]>
Signed-off-by: maral <[email protected]>
Signed-off-by: maral <[email protected]>
|
the PR says multi-agent WebSocket support is separate work, but the WebSocket handler accepts this request shape and sends it through the executor. generate:false takes the local completion path, so a socket client can receive a successful multi-agent response without the durable tree needed for continuation. we should reject multi_agent.enabled on WebSocket until that lifecycle is covered, or add end-to-end coverage and treat it as supported. |
Signed-off-by: maral <[email protected]>
Signed-off-by: maral <[email protected]>
…ort-pr-1 Signed-off-by: maral <[email protected]>
Added a guard in the shared response-session rehydration path used by WebSocket execution and |
…pport-pr-2 Signed-off-by: maral <[email protected]>
Signed-off-by: maral <[email protected]>
…pport-pr-2 Signed-off-by: maral <[email protected]>
|
@franciscojavierarceo Thanks for the review! The changes are ready for another review. I’ve addressed the comments and added OpenAI reference and gateway cassette recordings covering tool search, discovered function calls, and custom tool calls in multi-agent runs, for both streaming and non-streaming. These recordings and the corresponding Rust integration tests account for the additional files in the PR. |
Signed-off-by: maral <[email protected]>
…ort-pr-2 Signed-off-by: maral <[email protected]>
|
Addressed the remaining compatibility gaps and refreshed the gateway recordings:
All eight gateway recordings across review, proposals, mixed-tools, and client-owned tools pass the Rust contract comparisons against OpenAI references. These validate lifecycle and call/output relationships while allowing model-dependent differences. |
Signed-off-by: maral <[email protected]>
Signed-off-by: maral <[email protected]>
…ort-pr-2 Signed-off-by: maral <[email protected]>
## Summary Several user-facing docs had fallen behind `main` or contradicted each other and the code. This PR brings them in line with what has shipped. It changes documentation only. **Corrected claims** - README listed the Messages API as "🚧 Planned" while another README section documents `/v1/messages`. It is now listed as shipped; only stateful Messages stays planned. - README and `docs/index.md` advertised "Background execution" and gateway-executed file search. Neither exists yet: background mode is #357, and `file_search` declarations parse but are dropped before inference (`tool/normalize.rs`). Both claims are removed. - `docs/api/index.md` quoted fixed WebSocket and executor limits (256 KiB SSE lines, 1 MiB events and response budget). These now come from the configurable `[responses]` settings, which default to 16 MiB and 8 MiB. - `docs/api/index.md` listed only some of the conditions that route a Responses request through the executor. The list now also includes non-function tools, `multi_agent.enabled`, and tool-search state, matching `handler/http/responses.rs`. - CHANGELOG listed Tavily under 0.8.0, but it merged on Sep 28, after the Sep 19 release. The two Tavily entries move to `[Unreleased]`. **Newly documented features** - README: a multi-agent Responses section with an example and the gateway's limits (`store: true`, HTTP/SSE only, default of 3 concurrent subagents, no `max_tool_calls` or reasoning summaries). Also new rows in the API table for `/v1/responses/compact`, the full Conversations routes, `/v1/messages` with `/v1/messages/count_tokens`, and Swagger/OpenAPI (`ENABLE_OPENAPI_DOCS`). The features list, diagram, and tool ownership table now include MCP, the code interpreter, Claude Code, compaction, and OpenTelemetry. - `docs/api/index.md`: new sections for `GET /v1/responses/{response_id}`, multi-agent, Conversations, and Messages. - CHANGELOG `[Unreleased]` was empty. It now has entries for #345, #347, #349, #351/#370, #354, #368, #369, #372/#373, #380, and #387. **Roadmap** - ROADMAP.md marks multi-agent HTTP execution as shipped, with WebSocket injection (#300) and stateless requests (#393) still open. It adds a status note for Messages, a code interpreter entry, and a file search item linking #34 and #356. - README "Roadmap at a Glance" checks off Messages and Conversations and adds unchecked items for multi-agent, file search, and stateful Messages. **Smaller fixes** - The repository layout in README and AGENTS.md now lists `agentic-llm-d`, `agentic-cli-docs`, and `python/agentic_api/`. - ARCHITECTURE.md's list of multi-agent rejections now includes `max_tool_calls`, matching `executor/rehydrate.rs`. - `mkdocs.yaml` adds the existing but unlinked `design/shell-tool.md` to the nav. **Not changed:** the README's "Rust 1.85+" badge is wrong (1.85 cannot build the lockfile, see #377), but #379 already updates it to 1.88 along with `rust-version` and a CI check, so this PR leaves it alone to avoid a conflict. Signed-off-by: haoshan98 <[email protected]>
Summary
issue: #229
PR 1 teaches the gateway to represent multi-agent Responses items, but does not run agents. This PR adds the HTTP runtime: a stored request with
multi_agent.enabled: truecan spawn and coordinate subagents, return their work in one Responses result or SSE stream, and resume the tree throughprevious_response_id. Themulti_agentoption belongs to the gateway; it is not forwarded as a provider option. The gateway exposes collaboration actions to the model as gateway-owned function tools while retaining ordinary client tools such as web search, MCP, and local shell. This is separate fromparallel_tool_calls, which controls tool-call parallelism within a model turn rather than agent lifecycles.Request admission requires
store: true, rejects a zero concurrency limit, and rejects reasoning summaries and explicit compaction triggers with multi-agent enabled. An omittedmax_concurrent_subagentsuses three active descendant slots; the root is separate from that limit. The gateway validates continuation against the stored tree, rather than trusting client-supplied collaboration transcript items to recreate an agent.Implementation and review boundary
EngineOrchestrationselects the existing single-agent path or aMultiAgentRun. The response coordinator owns the agent registry, task ownership, mailboxes, pending client calls, shared response budget, completion, and persistence. Each agent has its ownAgentPipeline, tool registry, context, and round progress. This split lets agent tasks run concurrently without creating an independent public response per child. Collaboration functions implement spawning, messaging, follow-up, waiting, interruption, and listing; per-agent guidance narrows the assigned job and discourages unnecessary delegation and waits.StoredTreeSnapshotrecords the canonical agent tree, histories, and pending-call relationships. Checkpoint loading validates references and limits before constructing live tasks. Typedcommit_treemethods on the existing response and conversation handlers persist the tree with the public result; storage serialization remains at that boundary. Continuations match client outputs to their owning agent and call ID. Public encrypted agent-message content remains separate from gateway-owned canonical mail.CompactionPlancarries the agent identity and context generation;CompactionCommit::{Applied, Stale}replaces that prefix only if the generation still matches. This preserves intervening mail, pending calls, and appended history. Discovery items and prompt-cache settings are retained through the compaction request. The existing single-agent compaction path is still available when multi-agent is disabled.The runtime code is divided across
engine/agent_turn.rs,engine/multi_agent/*,executor/multi_agent/*, and pipeline delivery/projection modules so the coordinator, per-agent execution, registry, collaboration actions, streaming, checkpoint validation, and compaction each have a clear owner. The resulting file-size baseline change removes the old oversizedengine.rsentry; a narrow documented allowance covers the expanded request-admission module.Recorded scenario comparison
Gateway:
Qwen/Qwen3.6-35B-A3B-FP8. OpenAI reference:gpt-5.6-sol. Counts represent unique calls across each complete session, including client-tool continuations, rather than repeated SSE appearances. Model-generated text, reasoning, names, and action counts are not expected to match exactly.Proposals
Prompt: Delegate retrieval and assessment of proposals alpha and beta, then recommend one using the returned data. Tests parallel delegation and client-owned function-call continuation.
Gateway streaming recovered from six invalid
list_agentsrequests containingtimeout_ms.Review
Prompt: Delegate correctness, security, and test-coverage review of a Python cache using
pickle.loadson unauthenticated input, then consolidate findings. Tests agent creation, messaging, and completion without external tools.Gateway nonstreaming rejected one extra spawn at the concurrency limit.
Mixed tools
Prompt: Delegate Python CSV web research, tiktoken research through the remote GitMCP server, and the local-shell calculation
python3 -c 'print(sum(range(1, 11)))', then combine the findings. Tests mixed tool ownership and continuation with mocked client shell outputs.OpenAI streaming created a replacement fourth agent over the session; the limit applies to concurrent subagents. Gateway repeated some shell work. Shell outputs are scripted fixtures, not actual shell executions.
All twelve recordings reached completed responses. Collaboration calls have matching outputs, and streaming sequence and item-identity checks passed. Successful gateway
list_agentsresults useagent_nameandagent_status, including completed answer text. The Rust cassette comparison tests passed: 7 passed, 0 failed, 1 optional test ignored (cargo test -p agentic-server-core --test multi_agent_contract_test --offline -- --test-threads=2).Stack and scope
This is PR 2 of 2, branch
multi-agent-http-support-pr-2at96494f8, targeting PR 1multi-agent-http-support-pr-1atb8e71e6.Test Plan
cargo testrecoded cassettes