feat: Anthropic eager input streaming for Code API tools#184
feat: Anthropic eager input streaming for Code API tools#184danny-avila wants to merge 2 commits into
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e89578523
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Adds Anthropic's current per-tool
eager_input_streaming: trueflag to the final Anthropic tool definition for CodeAPI/event-driven execution tools:execute_codebash_toolrun_tools_with_coderun_tools_with_bashread_fileThe flag is applied only in the Anthropic adapter after LangChain formats tools for Anthropic, because LangChain's generic tool
extrasschema does not currently pass this field through. Expliciteager_input_streaming: falseis preserved, and non-CodeAPI tools are left unchanged.Research Notes
Anthropic's current docs describe fine-grained tool input streaming as a per-tool
eager_input_streamingsetting rather than relying solely on the old beta header. Live testing showedinput_json_deltaevents still occur without the field on the tested model, but the field changed chunk/timing behavior and gave earlier tool-input deltas in samples.Live Validation
Model:
claude-haiku-4-5-20251001Raw Anthropic stream comparison:
input_json_deltainput_json_deltaeager_input_streaminginput_json_delta, earliest in sampleRun/eager event pipeline comparison with mocked host execution:
ON_TOOL_EXECUTEValidity check at the streamed-tool seal point:
eager_input_streaming: trueTests
ANTHROPIC_API_KEY=test NODE_OPTIONS='--experimental-vm-modules' npx jest src/llm/anthropic/llm.spec.ts --runInBand -t 'Anthropic (CodeAPI tool|fine-grained tool input streaming)'ANTHROPIC_API_KEY=test NODE_OPTIONS='--experimental-vm-modules' npx jest src/__tests__/stream.eagerEventExecution.test.ts --runInBand -t 'CodeAPI|eager|stale|redispatch|changed'ANTHROPIC_API_KEY=test npx tsc -p tsconfig.json --noEmitnpx eslint src/llm/anthropic/index.tsnpx prettier --check src/llm/anthropic/index.ts src/llm/anthropic/llm.spec.tsgit diff --check