Telemetry (OpenTelemetry)
Enable comprehensive observability with OpenTelemetry integration
AxCrew provides optional OpenTelemetry integration for comprehensive observability. You can pass custom tracer and meter instances to monitor agent operations, track performance, and analyze behavior across your crew.
Features
- Distributed Tracing: Track agent execution flows, function calls, and dependencies
- Metrics Collection: Monitor token usage, costs, latency, and error rates
- Multiple Exporters: Support for console, Jaeger, Prometheus, and other OpenTelemetry backends
Setup
Install OpenTelemetry dependencies:
Optional: Install exporters for enhanced visualization:
Basic Configuration
What Gets Traced
When telemetry is enabled, AxCrew automatically instruments:
- Agent Execution: Both
forward()andstreamingForward()calls create spans with timing and metadata - Function Calls: Tool/function invocations are traced with parameters and results
- Provider Information: Model name, provider, and configuration details
- Token Metrics: Input/output tokens and estimated costs
- Errors: Exceptions and failures are captured with full context
Note: Telemetry is injected into the underlying AxAI instance, so all LLM calls (both synchronous and streaming) are automatically instrumented.
Advanced Configuration with Jaeger
For enhanced visualization, export traces to Jaeger:
Start Jaeger with Docker:
View traces at: http://localhost:16686
Complete Example
Run the example:
AxCrewOptions Interface
Best Practices
- Production Setup: Use appropriate exporters for your infrastructure (Jaeger, Zipkin, Cloud providers)
- Sampling: Configure sampling strategies to control trace volume in production
- Context Propagation: OpenTelemetry automatically propagates trace context across agent calls
- Custom Attributes: Extend traces with custom attributes specific to your use case
- Performance: Telemetry adds minimal overhead when properly configured
See Also
- OpenTelemetry Documentation
- Jaeger Documentation
telemetry-demo.ts- Complete working example