Repository navigation
feat: add shell tool wire types - #264
Conversation
| vec![] | ||
| } | ||
| Self::Shell(_) => { | ||
| tracing::debug!("shell tool skipped in normalize - handler not yet registered"); |
There was a problem hiding this comment.
@bojiang3 shell tool type as below taken from openai examples in https://developers.openai.com/api/docs/guides/tools-shell
"tools": [ { "type": "shell", "environment": { "type": "container_auto", "network_policy": { "type": "allowlist", "allowed_domains": ["pypi.org", "files.pythonhosted.org", "github.com"] } } }
is not recognized by vLLM upstream. even if some of the types might be recognized by upstream still to keep agentic-api consistent and compatible with multiple upstreams for inference we always normalize/canonicalize any tool types into function types. so all tool support on agentic-api either client owned like shell or owned on gateway by agentic-api need to implement a ToolHandler interface so that we can normalize and validate the tools's schema for inference. kindly follow ARCHITECTURE.md and TERMINOLOGY.md.
there should be also request and responses cassettes recording for this tool type from openai as ground truth and agentic-api (gateway) to match the behavior of gateway with openai Responses API. you can read https://github.com/vllm-project/agentic-api/blob/main/crates/agentic-server-core/tests/cassettes/README.md how to record a cassettes and there are shell script examples like https://github.com/vllm-project/agentic-api/blob/main/crates/agentic-server-core/tests/cassettes/record_web_search_cassettes.sh, https://github.com/vllm-project/agentic-api/blob/main/crates/agentic-server-core/tests/cassettes/record_mcp_cassettes.sh
that use our python cassettes recorder.
There was a problem hiding this comment.
Addressed the handler/normalization feedback in 0aaebc9: shell now has a client-owned ShellHandler, validates local-only environments, registers as client-owned, normalizes to a vLLM-compatible function schema, and restores both blocking and streaming calls to typed shell_call items. Unsupported environments and malformed actions fail closed; no gateway command execution was added. I also added record_shell_cassettes.sh for matching OpenAI/gateway streaming and non-streaming recordings. I could not capture authentic YAML in this environment because OPENAI_API_KEY is unset and the configured gateway endpoint is unavailable, so I intentionally did not hand-author fixtures. Validation: full cargo test -p agentic-server-core passed (448 passed, 8 environment-dependent ignored), plus fmt and clippy with warnings denied.
There was a problem hiding this comment.
@bojiang3 do you have resources to record cassettes for both gatewayand for openai ? openai would need api key! if you cant actually record cassettes , I will record and push in your branch then you can write integration test comparing openai ground truth to agentic-api behavior. cassettes are a required for landing features specially for tool supports.
franciscojavierarceo
left a comment
There was a problem hiding this comment.
the local shell wire types, call/output pairing, and storage round-trip look consistent with this slice. i don't have additional findings beyond the existing handler and cassette feedback. this was a source review; i haven't independently run the tests.
Signed-off-by: bojiang3 <[email protected]>
Signed-off-by: bojiang3 <[email protected]>
5cf6c7c to
0aaebc9
Compare
|
the client-executed shell loop still breaks on continuation, and the public Rust API doesn't yet let someone plug in their own shell executor. on
for pluggability, we should expose an optional typed shell executor registration through i captured eight local cassettes covering streaming, blocking, continuation, and explicit selection against OpenAI directly and this gateway backed by the same model. they aren't pushed yet. all 448 core unit tests pass, as do Clippy and formatting; the recordings expose the strict replay failure above, and five focused review assertions fail. |
Signed-off-by: bojiang3 <[email protected]>
- Prevent duplicate type tags in serialized shell inputs - Convert shell calls and outputs to matching function history - Support explicit shell tool selection and completed call status - Translate shell command SSE events and validate native stream lifecycle - Add two-turn cassettes and gateway/OpenAI compatibility tests Signed-off-by: maral <[email protected]>
|
@bojiang3 @franciscojavierarceo
The latest recordings match on shell actions, limits, completion status, command lifecycle, and continuation behavior. Delta fragment sizes differ, but reconstruct the same commands. The recordings use simulated client command outputs. |
|
@bojiang3 please resolve the conflicts. afterwards I'll re-record cassettes again to make sure there is no regression. |
Signed-off-by: Francisco Javier Arceo <[email protected]>
Signed-off-by: Francisco Javier Arceo <[email protected]>
franciscojavierarceo
left a comment
There was a problem hiding this comment.
the remaining persistence and response metadata issues are fixed in bb9fc65. public shell items now survive storage, later continuations normalize correctly, and response metadata preserves the shell declaration and selector. the regressions, workspace tests, Clippy, and pre-commit checks pass. client execution stays framework-independent; a gateway-side executor remains follow-up work.
ARCHITECTURE.md described an application-provided ShellExecutor slot, GatewayExecutorRegistration::Shell, an opt-in gateway shell history projection, and a ShellHandler::model_input entry point that do not exist in the implementation. Shell remains client-executed: ShellHandler deliberately does not implement GatewayExecutor (PR vllm-project#264 removed the optional executor), and RFC vllm-project#352 tracks a possible gateway-executed shell backend as future work. Also refresh the GatewayExecutors slot list to include the opt-in Eryx-backed code interpreter executor added in PR vllm-project#368. Fixes vllm-project#353 Signed-off-by: LeaderOnePro <[email protected]>
ARCHITECTURE.md described an application-provided ShellExecutor slot, GatewayExecutorRegistration::Shell, an opt-in gateway shell history projection, and a ShellHandler::model_input entry point that do not exist in the implementation. Shell remains client-executed: ShellHandler deliberately does not implement GatewayExecutor (PR vllm-project#264 removed the optional executor), and RFC vllm-project#352 tracks a possible gateway-executed shell backend as future work. Also refresh the GatewayExecutors slot list to include the opt-in Eryx-backed code interpreter executor added in PR vllm-project#368. Fixes vllm-project#353 Signed-off-by: LeaderOnePro <[email protected]>
ARCHITECTURE.md described an application-provided ShellExecutor slot, GatewayExecutorRegistration::Shell, an opt-in gateway shell history projection, and a ShellHandler::model_input entry point that do not exist in the implementation. Shell remains client-executed: ShellHandler deliberately does not implement GatewayExecutor (PR vllm-project#264 removed the optional executor), and RFC vllm-project#352 tracks a possible gateway-executed shell backend as future work. Also refresh the GatewayExecutors slot list to include the opt-in Eryx-backed code interpreter executor added in PR vllm-project#368. Fixes vllm-project#353 Signed-off-by: LeaderOnePro <[email protected]>
…401) ## Summary Aligns ARCHITECTURE.md with the implemented, client-executed shell tool (#353). - ARCHITECTURE.md described shell-executor interfaces that do not exist: an application-provided `ShellExecutor` slot, a `GatewayExecutorRegistration::Shell` execution grant, an opt-in gateway-executed shell history projection, and a `ShellHandler::model_input` entry point. Shell is client-executed only: `ShellHandler` deliberately does not implement `GatewayExecutor` (PR #264 removed the optional executor to keep execution on the client), and RFC #352 tracks the proposed gateway-executed shell backend as future work. - Rewrites the two shell passages (the `translate/` section and the `tool/` registry section) to describe the implemented flow: declarations normalize to canonical function tools, calls restore to `shell_call` and command SSE events, the client executes each call and submits `shell_call_output` with the same `call_id`, and shell history stays public in storage, lowering into function history through the standard output-to-input conversion plus typed input conversions. - Refreshes the `GatewayExecutors` slot list: MCP servers are the only lazily connected slot (configured clients and discovered handlers are cached by `server_label` across requests; request-declared servers connect afresh per request, their discovered handlers reused only within that request), alongside the shared `WebSearchHandler` and the opt-in Eryx-backed `CodeInterpreterExecutor` added in #368 (disabled by default). Adds `shell` to the client-owned tool list. Fixes #353 ## Test Plan - Documentation-only change; no code paths affected. - Verified every claim against the implementation: `GatewayExecutorRegistration` variants (`tool/executors.rs`), `ShellHandler` not implementing `GatewayExecutor` (`tool/shell.rs`), MCP client caching by `server_label` with fresh request-declared connections (`tool/executors.rs`), and shell history lowering (`types/io/input.rs`, `docs/design/shell-tool.md`). - `rg 'ShellExecutor|GatewayExecutorRegistration::Shell|ShellHandler::model_input|opt-in gateway executor' ARCHITECTURE.md` returns no matches. - `git diff --check` is clean and the diff touches only `ARCHITECTURE.md`. - Locally, `pre-commit run --files ARCHITECTURE.md` passes all hooks. Signed-off-by: LeaderOnePro <[email protected]>
Summary
shell_callandshell_call_outputitems, command limits, stdout/stderr, and exit/timeout outcomes.shell_call_output. This PR does not register a gateway-side shell executor; that remains follow-up work.Part of #170.
Test Plan
cargo test --offline --workspace: 1,198 passed, 9 ignored.cargo test --offline -p agentic-server-core: 870 passed, 9 ignored after the final assertions.cargo clippy --offline --workspace --all-targets -- -D warnings.uvx --from pre-commit pre-commit run --all-files, including formatting and merge-conflict checks.