Tracing and Events
Timbal's tracing system provides complete visibility into execution flows, capturing detailed information for monitoring, debugging, and analysis.
The tracing system consists of three main components:
- Events: Generated during execution to capture state changes
- Collectors: Process events and manage state accumulation
- Traces: Store complete execution information including timing, usage, and results
Events
Events are emitted during execution to capture key moments and data:
Core Event Types
- StartEvent: Emitted when execution begins
- ChunkEvent: Contains streaming response chunks
- OutputEvent: Final execution result with metadata
These events are found when making async calls to agents or workflows.
Collectors
Collectors process events and accumulate results based on event types.
Built-in Collectors
TimbalCollector - Automatically selected for Timbal events. Extracts final output from OutputEvent.
DefaultCollector - Fallback for any event type. Collects all events in a list when no specific collector matches.
Custom Collectors
Tracing
Traces store complete execution information organized by call hierarchy.
RunContext
The RunContext
manages execution state and tracing:
Data Sharing
Tracing Providers
Providers handle trace storage and retrieval.
Built-in Providers
InMemoryTracingProvider - Default in-memory storage
PlatformTracingProvider - Stores traces on Timbal platform
Configuration is automatic based on environment variables:
TIMBAL_API_HOST
,TIMBAL_API_KEY
- Platform configurationTIMBAL_ORG_ID
,TIMBAL_APP_ID
- Organization context