Skip to main content
Track tool execution in real time with streaming events — use TOOL_CALL_END as the completion marker for UI spinners and progress bars.
The user runs a tool-heavy prompt; streaming events mark when each tool finishes.

How It Works

Quick Start

1

Subscribe to Tool Events

Listen for tool execution completion events:
2

UI Integration

Use tool events for progress indicators in your UI:

Tool Event Types

TOOL_CALL_START

Emitted when tool execution begins with parsed arguments:

TOOL_CALL_END

The stream end marker - signals tool execution completion:

TOOL_CALL_RESULT

Final tool output after execution:

Event Flow Sequence

Key Marker: TOOL_CALL_END is the completion signal for UI consumers. Use this to:
  • Hide loading spinners
  • Show completion checkmarks
  • Enable follow-up actions
  • Update progress bars

Multiple Tool Handling

When agents use multiple tools simultaneously:

Error Handling

Tools can fail during execution:

UI Integration Patterns

React Component

Terminal Progress


Best Practices

Don’t rely on TOOL_CALL_RESULT for completion detection. TOOL_CALL_END is the definitive marker:
Track tool calls by their unique IDs, not just names:
Network issues may cause missed events. Implement timeouts:

Event Data Reference

TOOL_CALL_START Event

TOOL_CALL_END Event

TOOL_PROGRESS Event

TOOL_PROGRESS events carry incremental output emitted by a tool while it runs — before it returns a result. Tools call emit_tool_progress() to surface partial output without changing their signature.
See Tool Progress Streaming for the full guide.

STREAM_UNAVAILABLE Event

The agent or model adapter emits STREAM_UNAVAILABLE when token streaming cannot run in the current configuration — for example when a provider falls back to a non-streaming response instead of failing silently. Treat it as an observable fallback signal for UIs and loggers.

Agent Streaming

Core streaming concepts

Tool Progress Streaming

Stream incremental output from inside running tools

Tool Development

Creating custom tools