Monitor custom AI agents and multi-framework agentic applications with Fiddler using OpenTelemetry’s native instrumentation.Documentation Index
Fetch the complete documentation index at: https://handbook.fiddler.ai/llms.txt
Use this file to discover all available pages before exploring further.
What You’ll Learn
In this guide, you’ll learn how to:- Set up OpenTelemetry tracing for custom agent frameworks
- Configure Fiddler as your OTLP endpoint with proper authentication
- Map agent attributes to Fiddler’s semantic conventions
- Create instrumented LLM and tool spans with required attributes
- Verify traces in the Fiddler dashboard
When to Use Raw OpenTelemetryThis guide is for advanced scenarios requiring full manual OTLP control:
- Multi-framework environments requiring unified observability across different agent frameworks
- Existing OpenTelemetry infrastructure where you want to route Fiddler traces through your own OTel pipeline
- Advanced control over trace sampling, batch processing, and attribute mapping
- Custom Python agents → Use Fiddler OTel SDK (
@tracedecorator, typed span wrappers, zero OTLP setup) - LangChain V1 agents → Use Fiddler LangChain SDK (one
instrument()call) - LangGraph agents/workflows → Use Fiddler LangGraph SDK (auto-instrumentation)
- Strands Agents → Use Strands Agents SDK (native integration)
Prerequisites
Before you begin, ensure you have:- Fiddler Account: An active account with a GenAI application created
- Python 3.10+
- OpenTelemetry Packages:
pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
- LLM Provider (for examples): OpenAI API key or similar
- Fiddler Access Token: Get your token from Settings > Credentials
For a complete working example with advanced patterns, download the Advanced OpenTelemetry Notebook from GitHub or open it in Google Colab.
Create Fiddler Application
- Log in to your Fiddler instance and navigate to GenAI Applications
- Select “Add Application” to create a new application
- Copy your Application ID - This must be a valid UUID4 format (e.g.,
550e8400-e29b-41d4-a716-446655440000) - Get your Access Token from Settings > Credentials
Configure Environment Variables
Set up your environment to connect to Fiddler’s OTLP endpoint:Environment Variable Breakdown:
Python Configuration (alternative to environment variables):
| Variable | Description | Example |
|---|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | Your Fiddler instance URL | https://org.fiddler.ai |
OTEL_EXPORTER_OTLP_HEADERS | Authentication and app ID headers | authorization=Bearer sk-...,fiddler-application-id=550e8400... |
OTEL_RESOURCE_ATTRIBUTES | Resource-level application identifier | application.id=550e8400-e29b-41d4-a716-446655440000 |
Initialize OpenTelemetry
Set up OpenTelemetry with Fiddler’s OTLP exporter:What This Does:
- TracerProvider: Manages trace generation
- OTLPSpanExporter: Exports spans to Fiddler via OTLP protocol
- BatchSpanProcessor: Batches spans for efficient network transmission
Local Debugging: Add a console exporter to see traces locally while developing:
Instrument Your Agent
Create instrumented spans for your agent’s operations. Fiddler requires specific attributes to properly categorize and visualize your agent traces.Required Fiddler AttributesResource Level (set via environment variable):Key Implementation Details:
application.id- UUID4 of your Fiddler application
fiddler.span.type- Type of operation:"chain","tool","llm", or"agent"
- Chain Spans: Use
fiddler.span.type = "chain"for high-level workflows - LLM Spans: Include model, system prompt, user input, output, and token usage
- Tool Spans: Include tool name, input JSON, and output JSON
- Nested Spans: Create parent-child relationships to show execution flow
Verify Monitoring
- Run your instrumented code using the example above
- Wait 1-2 minutes for traces to appear in Fiddler
- Navigate to GenAI Applications in your Fiddler instance
- Verify application status changes to Active
- View traces to see your agent spans, hierarchy, and attributes
fiddler.span.type is set on every span ✅ LLM token usage is tracked ✅ Tool inputs and outputs are capturedAttribute Reference
Required Attributes
Resource Level:| Attribute | Type | Description | Example |
|---|---|---|---|
application.id | string | UUID4 of your Fiddler application | "550e8400-e29b-41d4-a716-446655440000" |
| Attribute | Type | Description | Valid Values |
|---|---|---|---|
fiddler.span.type | string | Type of operation | "chain", "tool", "llm", "agent" |
Optional Attributes
Agent Identification:| Attribute | Type | Description | Example |
|---|---|---|---|
gen_ai.agent.name | string | Name of the AI agent | "travel_agent" |
gen_ai.agent.id | string | Unique identifier for the agent | "travel_agent_v1" |
Set agent attributes on every span.
gen_ai.agent.name and gen_ai.agent.id are optional, but if you include them, set both on every span within the trace. Fiddler uses these attributes to attribute spans to the correct agent — spans missing these fields will be unattributed even if other spans in the same trace carry them.| Attribute | Type | Description | Example |
|---|---|---|---|
gen_ai.conversation.id | string | Session/conversation identifier | "conv_123" |
| Attribute | Type | Description | Example |
|---|---|---|---|
gen_ai.request.model | string | Model name | "gpt-4o-mini", "claude-3-opus" |
gen_ai.system | string | LLM provider | "openai", "anthropic" |
gen_ai.llm.input.system | string | System prompt | "You are a helpful assistant" |
gen_ai.llm.input.user | string | User input | "What's the weather?" |
gen_ai.llm.output | string | LLM response | "The weather is sunny" |
gen_ai.usage.input_tokens | int | Input tokens used | 42 |
gen_ai.usage.output_tokens | int | Output tokens used | 28 |
gen_ai.usage.total_tokens | int | Total tokens used | 70 |
gen_ai.input.messages | string (JSON array) | Chat history provided to model | [{"role": "user", "content": "Hello"}] |
gen_ai.output.messages | string (JSON array) | Messages returned by model | [{"role": "assistant", "content": "Hi"}] |
| Attribute | Type | Description | Example |
|---|---|---|---|
gen_ai.tool.name | string | Tool/function name | "search_database" |
gen_ai.tool.input | string | Tool input (JSON) | "{"query": "hotels"}" |
gen_ai.tool.output | string | Tool output (JSON) | "{"results": [...]}" |
| Pattern | Level | Example |
|---|---|---|
fiddler.session.user.{key} | Trace (all spans) | fiddler.session.user.user_id = "usr_123" |
fiddler.span.user.{key} | Span (individual) | fiddler.span.user.department = "sales" |
Troubleshooting
Common Issues
Problem: Application not showing as “Active” Solutions:- Verify environment variables are set correctly
- Check that
OTEL_EXPORTER_OTLP_ENDPOINTincludes your Fiddler instance URL - Ensure
OTEL_EXPORTER_OTLP_HEADERScontains valid authorization token and application ID - Add console exporter to verify spans are being generated locally
- Check network connectivity:
curl -I https://your-instance.fiddler.ai
ModuleNotFoundError for OpenTelemetry packages
Solutions:
-
Verify required attributes are set:
-
Check resource attributes:
-
Enable console exporter for debugging:
- Regenerate your access token from Fiddler Settings > Credentials
- Verify header format:
authorization=Bearer <token>,fiddler-application-id=<uuid> - Ensure no extra spaces in header values
- Check token hasn’t expired
- Copy Application ID directly from Fiddler UI
- Verify UUID4 format:
550e8400-e29b-41d4-a716-446655440000 - Ensure no extra quotes or whitespace
Configuration Options
Basic Configuration
Advanced Configuration
High-Volume Applications (Batch Processing Tuning):If you have Option 2: Use SDK span wrappers (typed helper methods, automatic attribute propagation):Both approaches handle OTLP configuration automatically. For graceful exit (e.g. servers or short scripts), call
fiddler-otel installed, you can use FiddlerClient for simplified setup — it handles OTLP configuration automatically. There are two levels of abstraction:Option 1: Get a pre-configured tracer (use raw OTel spans, but skip OTLP configuration):client.shutdown() (or await client.ashutdown() in async) so buffered spans are sent before the process exits. See Manual Instrumentation for complete span wrapper documentation.Next Steps
Now that you have OpenTelemetry integration working:- Advanced Patterns: Download the Advanced OpenTelemetry Notebook for:
- Multi-agent configurations
- Conversation tracking across sessions
- Custom user-defined attributes
- Production-ready error handling
- Comprehensive debugging techniques
- Consider SDKs for Common Frameworks:
- Fiddler OTel SDK -
@tracedecorator for custom Python agents (no raw OTel boilerplate) - Fiddler LangChain SDK - Auto-instrumentation for LangChain V1 agents
- Fiddler LangGraph SDK - Auto-instrumentation for LangGraph/LangChain
- Strands Agents SDK - Native Strands agent integration
- Fiddler OTel SDK -
- Explore Fiddler Capabilities:
- Production Deployment:
- Review sampling strategies for cost optimization
- Implement error handling and retry logic
- Set up monitoring alerts
- Configure custom attributes for your business context