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 |
Related
Agent Streaming
Core streaming concepts
Tool Development
Creating custom tools

