Skip to content

@tanstack/ai-claude-code: stream tool-call arguments (forward input_json_delta → TOOL_CALL_ARGS) #901

Description

@ozolcar

Summary

@tanstack/ai-claude-code doesn't stream tool-call arguments. Its stream translator handles only text_delta and thinking_delta, so a tool call surfaces only once it's complete. This is the sole blocker for streaming structured output while using the Claude Code harness.

Request

Forward the Agent SDK's partial tool-input events as AG-UI TOOL_CALL_ARGS deltas — the same way @tanstack/ai-anthropic / @tanstack/ai-openai already stream tool args.

Details

@tanstack/ai-claude-code (0.2.0) is built on @anthropic-ai/claude-agent-sdk. With includePartialMessages: true, the SDK already emits partial tool input:

content_block_delta → delta.type: "input_json_delta"   (partial_json fragments)

But the adapter's stream/translate.js has cases only for text_delta and thinking_delta — there is no input_json_delta case, so those fragments are dropped and tool calls arrive whole. (structuredOutput() also throws "not yet supported — use a model adapter".)

Why it matters

Routing structured data through a tool call is the only streaming path on the Claude Code harness (subscription auth + native file tools). Today that metadata paints atomically at run end; forwarding input_json_delta would let it stream token-by-token. It would also be the foundation for a real supportsCombinedToolsAndSchema / structuredOutputStream on this adapter (wire outputSchema through a forced tool call and stream its args) — bringing the harness adapter to parity with the model adapters for streaming structured output.

Environment

  • @tanstack/ai-claude-code 0.2.0 (latest; only 0.1.0 / 0.2.0 published)
  • @tanstack/ai 0.39.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions