Fiddler SDK for Strands Agent instrumentation with OpenTelemetry
Project description
Fiddler Strands SDK
OpenTelemetry instrumentation SDK for Strands AI agents, providing automatic observability and monitoring capabilities through Fiddler's platform.
Features
- 🎯 Automatic Instrumentation: Zero-code instrumentation of Strands agents using OpenTelemetry
- 🔍 Built-in Observability: Automatic logging hooks for agent interactions
- 📊 Fiddler Integration: Custom span processors for enhanced trace analysis
- 🛠️ Extensible: Easy to add custom hooks and processors
- 🚀 Production Ready: Built on OpenTelemetry standards
Installation
Using uv (Recommended)
# Install the SDK
uv add fiddler-strands
Using pip
pip install fiddler-strands
Quick Start
Prerequisites
Before using the SDK, ensure you have:
- Fiddler platform access with API credentials
- OpenAI API key (if using OpenAI models)
- Configure environment variables:
FIDDLER_ENDPOINT: Your Fiddler platform URLFIDDLER_TOKEN: Your Fiddler API tokenFIDDLER_APPLICATION_UUID: Your application UUID from Fiddler
See the full documentation for detailed configuration steps.
Basic Usage
import os
from strands import Agent
from strands.models.openai import OpenAIModel
from strands.telemetry import StrandsTelemetry
from fiddler_strandsagents import StrandsAgentInstrumentor
strands_telemetry = StrandsTelemetry()
strands_telemetry.setup_otlp_exporter()
strands_telemetry.setup_console_exporter()
# Enable automatic instrumentation
StrandsAgentInstrumentor(strands_telemetry).instrument()
# Create your agent as usual - LoggingHook will be automatically injected
model = OpenAIModel(api_key=os.getenv("OPENAI_API_KEY"))
agent = Agent(model=model, system_prompt="You are a helpful assistant")
# Use your agent - all interactions will be automatically instrumented
response = agent("Hello, how are you?")
Note: The OTLP exporter requires Fiddler credentials to be configured as environment variables.
API Reference
StrandsAgentInstrumentor
The main instrumentor class for automatic agent instrumentation.
from fiddler_strandsagents import StrandsAgentInstrumentor
instrumentor = StrandsAgentInstrumentor()
# Enable instrumentation
instrumentor.instrument()
# Check if instrumentation is active
is_active = instrumentor.is_instrumented_by_opentelemetry
# Disable instrumentation
instrumentor.uninstrument()
Helper Functions
The SDK provides helper functions to add custom metadata to your telemetry spans:
set_conversation_id(agent, conversation_id)
Set a unique conversation ID for tracking related interactions:
from fiddler_strandsagents import set_conversation_id
set_conversation_id(agent, 'session_1234567890')
set_session_attributes(agent, **kwargs)
Add custom session-level attributes to track business context:
from fiddler_strandsagents import set_session_attributes
set_session_attributes(agent,
role='customer_support',
cost_center='travel_desk',
region='us-west'
)
set_span_attributes(obj, **kwargs)
Add custom attributes to specific components (agents, models, or tools):
from fiddler_strandsagents import set_span_attributes
# Add attributes to a model
set_span_attributes(model, model_id='gpt-4o-mini', temperature=0.7)
# Add attributes to a tool
set_span_attributes(tool, department='search', version='2.0')
set_llm_context(model, context)
Set additional context for LLM interactions:
from fiddler_strandsagents import set_llm_context
set_llm_context(model, 'Available options: Option A, Option B, Option C...')
Getter Functions
Retrieve previously set metadata:
from fiddler_strandsagents import (
get_conversation_id,
get_session_attributes,
get_span_attributes
)
conversation_id = get_conversation_id(agent)
attributes = get_session_attributes(agent)
span_attrs = get_span_attributes(model)
License
This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.
Support
- 📧 Email: support@fiddler.ai
- 📖 Documentation: https://docs.fiddler.ai/api/fiddler-strands-sdk/strands
- 🐛 Issues: https://github.com/fiddler-labs/fiddler-strands-sdk/issues
Examples and Development
For example scripts and development information, please visit the GitHub repository.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fiddler_strands-0.3.0.tar.gz.
File metadata
- Download URL: fiddler_strands-0.3.0.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a9d8b84d44c15ea71850226437de04acbb7894c8cf58b13aa12172007bd2ab1
|
|
| MD5 |
563194ef0963037dd10b4a6db7aad839
|
|
| BLAKE2b-256 |
1e80b3193adba99eb2714e10948caa1288cecf8ffa271383114e74fefbb23907
|
Provenance
The following attestation bundles were made for fiddler_strands-0.3.0.tar.gz:
Publisher:
publish.yml on fiddler-labs/fiddler-strands-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fiddler_strands-0.3.0.tar.gz -
Subject digest:
0a9d8b84d44c15ea71850226437de04acbb7894c8cf58b13aa12172007bd2ab1 - Sigstore transparency entry: 704521036
- Sigstore integration time:
-
Permalink:
fiddler-labs/fiddler-strands-sdk@135275ce718665d8fa3b300804b0662d10515a58 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/fiddler-labs
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
publish.yml@135275ce718665d8fa3b300804b0662d10515a58 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file fiddler_strands-0.3.0-py3-none-any.whl.
File metadata
- Download URL: fiddler_strands-0.3.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b3949b71bc5a63bf67dca808179afda5e23516d961a12a959e9b203541f3ed5
|
|
| MD5 |
c4c699fb6aeba171fa4d0c0fc6d9830b
|
|
| BLAKE2b-256 |
5a4e7a141e920c9b16ef4b67533a1358f823775b0b831e6b099e982c6f57a79b
|
Provenance
The following attestation bundles were made for fiddler_strands-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on fiddler-labs/fiddler-strands-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fiddler_strands-0.3.0-py3-none-any.whl -
Subject digest:
0b3949b71bc5a63bf67dca808179afda5e23516d961a12a959e9b203541f3ed5 - Sigstore transparency entry: 704521076
- Sigstore integration time:
-
Permalink:
fiddler-labs/fiddler-strands-sdk@135275ce718665d8fa3b300804b0662d10515a58 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/fiddler-labs
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
publish.yml@135275ce718665d8fa3b300804b0662d10515a58 -
Trigger Event:
workflow_dispatch
-
Statement type: