feat(agents): Add streaming tool call argument support#4555
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4555 +/- ##
===========================================
+ Coverage 31.76% 55.05% +23.28%
===========================================
Files 213 318 +105
Lines 18202 37016 +18814
Branches 6418 10547 +4129
===========================================
+ Hits 5782 20379 +14597
- Misses 12402 16604 +4202
- Partials 18 33 +15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Electric Agents Mobile BuildLocal mobile checks ran for commit The EAS Android preview build was skipped because the |
✅ Deploy Preview for electric-next ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
I had Claude Fable review this PR, it seems to have found some problems that need to be addressed. Here's the full review: SummaryAdds runtime plumbing for streaming tool-call arguments: Pi What's Working Well
Issues FoundCritical (Must Fix)1. Persisted tool-call state machine changes for every tool call on streaming providers — breaks documented invariant and downstream consumers Files: The PR description says "ordinary tool execution still inserts a This breaks the conformance suite's E4 invariant, which asserts the Suggested fix: Either (a) update the conformance spec/tests and audit status consumers as part of this PR, treating the state-machine change as intentional and documented, or (b) have 2. File: Two related problems:
Suggested fix: serialize hook invocations per Important (Should Fix)3. The Files:
4. File:
Suggestions (Nice to Have)5. Latent key collision between provider tool-call IDs and legacy synthetic IDs — 6. Tool-call events missing 7. The status union is now hand-duplicated in five places — 8. Storage amplification for large streamed args — 9. Test gaps — no test covers: (a) the streamed call's transition to Issue ConformanceNo linked issue — worth adding a reference if one exists. The PR description is clear and the example is helpful, but it makes two claims the code doesn't currently honor: that non-streaming behavior is preserved (see Critical #1 — it's only preserved when the provider doesn't stream, which real providers do), and that the hook receives an abort signal (see Important #3). Both the description and the example should be updated alongside the fixes. Monorepo / Cross-Package Impact
Review iteration: 1 | 2026-06-11 |
Summary
Adds generic runtime support for tools that want to observe partial tool-call arguments while Pi is still streaming them. This PR is intentionally limited to the runtime protocol and persistence layer; it does not add any markdown-document behavior.
What changes:
AgentTool.onArgsDelta(context, signal)as an optional hook on runtime tools.toolcall_start,toolcall_delta, andtoolcall_endassistant-message events through the runtime adapter.tool_callrows usingargs_streamingandargs_completestatuses.tool_arg_deltabuilt-in collection so streamed argument chunks are durable and inspectable.tool_callrow withstatus: "started".Example
Validation
pnpm --filter @electric-ax/agents-runtime typecheckpnpm --filter @electric-ax/agents-runtime exec vitest run test/outbound-bridge.test.ts test/pi-adapter.test.tspnpm --filter @electric-ax/agents-runtime exec vitest run test/runtime-dsl.test.ts