OpenTelemetry GenAI LLM Agent Tracing Sandbox PoC
Goal
Create a small local proof that an LLM-agent run can be represented with OpenTelemetry GenAI-style spans:
- one parent
invoke_agentspan - one
chatLLM client span - two
execute_toolchild spans - model, provider, token-count, finish-reason, and tool-call attributes
No production credentials, API keys, real user prompts, or live LLM calls were used.
Commands Run
python3 --version
docker --version
python3 -m pip index versions opentelemetry-sdk
python3 -m pip index versions opentelemetry-instrumentation-anthropic
Relevant output:
Python 3.12.8
Docker version 29.2.0, build 0b9d198
opentelemetry-sdk (1.42.1)
opentelemetry-instrumentation-anthropic (0.61.0)
Sandbox setup:
rm -rf /tmp/effloow-otel-genai-poc
mkdir -p /tmp/effloow-otel-genai-poc
python3 -m venv /tmp/effloow-otel-genai-poc/.venv
/tmp/effloow-otel-genai-poc/.venv/bin/python -m pip install --upgrade pip
/tmp/effloow-otel-genai-poc/.venv/bin/python -m pip install \
opentelemetry-sdk==1.42.1 \
opentelemetry-exporter-otlp==1.42.1 \
opentelemetry-instrumentation-anthropic==0.61.0
Installed package output:
opentelemetry-api==1.42.1
opentelemetry-exporter-otlp==1.42.1
opentelemetry-instrumentation-anthropic==0.61.0
opentelemetry-instrumentation==0.63b1
opentelemetry-proto==1.42.1
opentelemetry-sdk==1.42.1
opentelemetry-semantic-conventions-ai==0.5.1
opentelemetry-semantic-conventions==0.63b1
Failure Found
Importing opentelemetry.instrumentation.anthropic failed after installing only the instrumentation package:
importlib.metadata.PackageNotFoundError: No package metadata was found for pydantic
The instrumentation package imported successfully after adding the Anthropic client and Pydantic:
/tmp/effloow-otel-genai-poc/.venv/bin/python -m pip install anthropic pydantic
Relevant installed versions:
anthropic==0.105.2
pydantic==2.13.4
opentelemetry-instrumentation-anthropic==0.61.0
Trace Export
The PoC created a custom JSON span exporter and manually emitted the agent span tree. The trace was written to:
/tmp/effloow-otel-genai-poc/trace-export.json
Summary output:
/tmp/effloow-otel-genai-poc/trace-export.json
span_count 4
chat CLIENT 211221f62b7b1a6e ['gen_ai.operation.name', 'gen_ai.provider.name', 'gen_ai.request.model', 'gen_ai.response.finish_reasons', 'gen_ai.response.model', 'gen_ai.system', 'gen_ai.usage.input_tokens', 'gen_ai.usage.output_tokens']
execute_tool INTERNAL 211221f62b7b1a6e ['effloow.output.rows', 'gen_ai.operation.name', 'gen_ai.tool.call.id', 'gen_ai.tool.name']
execute_tool INTERNAL 211221f62b7b1a6e ['effloow.output.rows', 'gen_ai.operation.name', 'gen_ai.tool.call.id', 'gen_ai.tool.name']
invoke_agent INTERNAL None ['effloow.lab_run.slug', 'gen_ai.agent.name', 'gen_ai.operation.name']
Trace JSON summary:
{
"environment": {
"python": "3.12.8",
"platform": "macOS-15.6-arm64-arm-64bit",
"otel_sdk": "1.42.1",
"otel_exporter_otlp": "1.42.1",
"anthropic_instrumentation": "0.61.0",
"anthropic_client": "0.105.2",
"api_calls_made": false
},
"span_count": 4,
"span_names": ["chat", "execute_tool", "execute_tool", "invoke_agent"],
"trace_id": "0f1035558bef566e0d26981c0031d202"
}
Jaeger Attempt
Command attempted:
docker run -d --name effloow-otel-jaeger-poc \
-e COLLECTOR_OTLP_ENABLED=true \
-p 16686:16686 \
-p 4318:4318 \
jaegertracing/all-in-one:latest
Result:
Unable to find image 'jaegertracing/all-in-one:latest' locally
docker: error getting credentials - err: signal: terminated, out: ``
Docker blocked in credential lookup while pulling the image, so the process was terminated. No Jaeger UI screenshot was captured, and no claim should be made that this run verified the Jaeger UI.
What Worked
- Python OpenTelemetry SDK 1.42.1 installed cleanly in a temporary virtualenv.
- Anthropic instrumentation 0.61.0 installed, but required the Anthropic client/Pydantic path to import successfully in this sandbox.
- A local trace export captured a coherent agent tree with one root
invoke_agent, onechatspan, and twoexecute_toolspans. - The trace included both legacy-style
gen_ai.systemand newergen_ai.provider.nameprovider attributes, making the example resilient to convention transition. - Prompt and tool payload content was intentionally not recorded.
What Failed or Was Not Tested
- No live Claude or OpenAI request was made.
- No API key was loaded or used.
- Automatic Anthropic client instrumentation was imported but not exercised against a real Anthropic SDK call.
- Jaeger all-in-one did not start because Docker image pull credential lookup blocked.
- No OTLP backend ingest, Jaeger UI screenshot, production collector config, sampling policy, cost dashboard, or eval metric was verified.
Limitations for the Article
The article may truthfully say that Effloow Lab ran a local OpenTelemetry span-export PoC for an agent-shaped trace. It must not say that Effloow verified live Anthropic/OpenAI auto-instrumentation, Jaeger UI rendering, provider token accounting, or production observability behavior.
Read the article
This note supports the public article and records what was actually checked.