TOOL_CALL_END as the completion marker for UI spinners and progress bars.
How It Works
Quick Start
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
Use TOOL_CALL_END as the completion signal
Use TOOL_CALL_END as the completion signal
Don’t rely on
TOOL_CALL_RESULT for completion detection. TOOL_CALL_END is the definitive marker:Handle tool ID mapping
Handle tool ID mapping
Track tool calls by their unique IDs, not just names:
Gracefully handle missing events
Gracefully handle missing events
Network issues may cause missed events. Implement timeouts:
Event Data Reference
TOOL_CALL_START Event
| Field | Type | Description |
|---|---|---|
type | string | Always "tool_call_start" |
timestamp | float | High-precision timestamp |
tool_call.id | string | Unique tool call identifier |
tool_call.name | string | Tool function name |
tool_call.arguments | dict | Parsed tool arguments |
TOOL_CALL_END Event
| Field | Type | Description |
|---|---|---|
type | string | Always "tool_call_end" |
timestamp | float | High-precision timestamp |
tool_call.id | string | Tool call identifier |
tool_call.name | string | Tool function name |
metadata.duration_ms | float | Execution duration in milliseconds |
metadata.success | bool | Whether execution succeeded |
metadata.error | string | Error message if failed |
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.
| Field | Type | Description |
|---|---|---|
type | string | Always "tool_progress" |
timestamp | float | High-precision timestamp |
content | string | None | Partial text output chunk (e.g. a stdout line) |
metadata.progress | float | None | Completion fraction 0.0–1.0 |
metadata.stream | string | None | Optional stream tag, e.g. "stderr" |
STREAM_UNAVAILABLE Event
The agent or model adapter emitsSTREAM_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.
| Field | Type | Description |
|---|---|---|
type | string | Always "stream_unavailable" |
timestamp | float | High-precision timestamp |
error | string | Human-readable summary (often Streaming unavailable: …) |
metadata.reason | string | Provider-specific reason code or message |
Related
Agent Streaming
Core streaming concepts
Tool Progress Streaming
Stream incremental output from inside running tools
Tool Development
Creating custom tools

