[FEATURE] Add onProgress / onToolCall callback to query() for real-time tool call events

Resolved 💬 3 comments Opened Feb 21, 2026 by alario-tang Closed Feb 24, 2026

Problem

query() from @anthropic-ai/claude-agent-sdk only resolves with the final result after all turns complete. There is no way to receive intermediate tool call events (tool name, status, input/output) as they happen.

Use Case

We're building a chat application on top of the SDK. During long-running tasks (file edits, shell commands, web fetches), users see a blank loading state with no feedback. We want to show real-time progress like "Claude is editing file X".

Proposed API

for await (const msg of query({
  prompt: '...',
  options: {
    onProgress: (event: { tool: string; status: 'running' | 'completed'; callID: string }) => {
      // stream tool call events to the UI
    },
  },
})) { ... }

Or emit tool call events as part of the existing async generator stream.

Current Workaround

None. The only option is to poll after the fact.

Note: @openai/codex-sdk has the same limitation (openai/codex#2109).

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗