AI agent observability: choosing between proxy, OpenTelemetry, and SDK tracing
Each path fits a different situation: proxy if you can't change application code, OTel if you already emit spans, or SDK if you need step-level visibility into tool calls and handoffs. The right choice depends on what your agent does, how much context you need per trace, and whether you can change application code.
By Arun Prasad · Published · Last updated
On this page
Why standard monitoring misses agent failures
Standard APM tells you a request went through. It doesn't tell you whether the agent completed the user's goal.
AI agents don't fail like normal software. A tool call can return HTTP 200 and the task can still fail. The model chose the wrong tool, misread the user's intent, or returned a confident answer that contradicted the facts it was given. Your existing monitoring sees a successful request. Your user sees a broken experience.
What you need is a tracing layer that records what the agent actually did: the prompt it received, the reply it gave, the tools it called, the steps it took to get there, and whether the outcome matched what the user came for. Span status is not a proxy for task outcome. A trace that includes only HTTP status codes is missing most of the picture.
The three instrumentation paths below each give you a different slice of that picture. A proxy captures model I/O at the network layer. OpenTelemetry carries whatever attributes your agent emits. An SDK attaches at the framework layer and can follow the agent step by step.
Most teams start with one and add a second later. Each path captures different data, and understanding the trade-offs before you instrument saves a rework.
Step 1: Gateway-based tracing (the proxy path)
Use a proxy when you can't change application code or want guardrails running inline on the model call. It captures model I/O but not tool calls or handoffs.
A proxy gateway sits between your application and the model provider, recording every request and response without any changes to your application code.
What it captures
The proxy records prompts, completions, latency, and token counts. Because it intercepts the call before it reaches the provider, it can also run guardrails inline: a blocked request never reaches the model, and a blocked response is withheld from the user while the original is still stored for review.
What it doesn't capture
The proxy sees only the model call. It has no visibility into what happened before or after: no tool calls, no retrieval steps, no multi-agent handoffs, no errors that occur outside the model call itself. If your agent calls three tools and then asks the model to summarize the results, the proxy records the summary request and nothing else.
When to use it
Use the proxy when you can't change application code, for example, when the model client is managed by a team you don't own, or when you want guardrails running inline on the call itself with no deployment step.
How the proxy path works in PRISM
Change the base URL in your model client config and add your PRISM key as a request header. For the Anthropic client:
Example
import anthropic
import os
client = anthropic.Anthropic(
base_url="https://api.prism.blockconvey.com/proxy/anthropic",
default_headers={"X-PRISMtrace-Key": os.environ["PRISMTRACE_API_KEY"]},
)For OpenAI: use https://api.prism.blockconvey.com/proxy/openai/v1. For Gemini: https://api.prism.blockconvey.com/proxy/gemini. Nothing is imported and no call site changes. PRISM forwards the call, records it, and runs your guardrails in both directions. It adds one network hop, roughly 5 to 15 ms depending on region.
Note that the base URL alone is not a working setup. The X-PRISMtrace-Key header must be in the same client config.
AWS Bedrock and Azure AI Foundry don't use the proxy path. Each connects from the Connectors page in the dashboard using stored credentials.
Step 2: OpenTelemetry-based tracing
Use OTel when your team already emits spans from a framework or service mesh. It needs no PRISM SDK and works for any runtime that supports OTel.
If your application already emits OpenTelemetry spans, you can point your existing exporter at PRISM with two environment variables and no PRISM SDK required.
What it captures
OTel sends whatever attributes your agent emits through your existing spans, with no new SDK dependency. The attributes follow the OpenTelemetry GenAI conventions.
Protocol constraints
PRISM accepts OTLP over http/protobuf or http/json. gRPC is not served. The exporter endpoint is https://api.prism.blockconvey.com/api/otlp; the exporter appends /v1/traces itself. Send your PRISM key in the key header.
Session grouping
Turns are grouped into conversations only from declared attributes: gen_ai.conversation.id, session.id, or prismtrace.session_id. PRISM does not infer sessions from timing or content. If you want multi-turn visibility, you must set one of these attributes on every span in the conversation.
When to use it
Use OTel when your team already emits spans from a framework or service mesh and you'd rather not add another SDK dependency. It's also the right path for teams running non-Python runtimes where the PRISM SDK isn't available, as an alternative to the HTTP path.
Step 3: SDK-based tracing
Use the SDK when you need visibility into tool calls, retrieval steps, and handoffs. Your framework must be on the supported list (LangChain, LangGraph, Google ADK, LiteLLM, or OpenAI Agents SDK).
The SDK attaches a handler to your framework and captures the agent's full trajectory: model calls, tool calls, retrieval steps, multi-agent handoffs, and errors, not just the final model exchange.
What it captures
Because the SDK sits inside your application rather than at the network boundary, it can follow every step the agent takes. For a LangGraph agent that queries a retrieval system, calls two tools, and then synthesizes a reply, the SDK records all of it as a structured trajectory. Multi-agent handoffs are recorded as handoff steps, so you can see exactly where control moved between agents.
Installation
Example
pip install "prismtrace-sdk>=0.5.1"The current release is 0.5.4. The minimum supported version is 0.5.1.
Supported frameworks
| Framework | Handler |
|---|---|
| LangChain | PRISMtraceCallbackHandler |
| LangGraph | PRISMtraceLangGraphHandler, wrap_langgraph |
| Google ADK | PRISMtraceADKAdapter |
| LiteLLM | install_litellm |
| OpenAI Agents SDK | install_openai_agents |
Other languages and frameworks
There is no npm package. TypeScript, JavaScript, Go, and Java use the HTTP endpoint or OpenTelemetry. The HTTP path is one POST per exchange:
Example
POST https://api.prism.blockconvey.com/api/traces
X-PRISMtrace-Key: <your key>
{
"project_id": "proj_abc123",
"model": "claude-3-5-sonnet-20241022",
"input_messages": [{"role": "user", "content": "What's my account balance?"}],
"output_message": "Your current balance is available in the account summary.",
"latency_ms": 820
}Required fields: project_id (string), model (string), input_messages (array of {role, content} objects), output_message (string), latency_ms (integer; send 0 if not measured). Optional fields include session_id, agent_id, agent_name, user_identifier, trace_id, token_count_input, token_count_output (integers), and metadata (object).
When to use it
Use the SDK when you need step-level visibility, tool calls, retrieval steps, handoffs, and your framework is on the list above. Use the HTTP path for any other runtime.
How to choose: proxy, OTel, or SDK
Each path fits a different situation. Use the table as a starting point, then read the caveats below it.
| Situation | Path |
|---|---|
| Can't change application code | Proxy |
| Want guardrails inline on the model call | Proxy |
| Already emitting OTel spans | OTel |
| Running TypeScript, Go, or Java | OTel or HTTP |
| Need tool-call and handoff visibility | SDK |
| Need multi-turn session grouping | SDK or OTel (with declared session attribute) |
| Using LangChain, LangGraph, Google ADK, LiteLLM, or OpenAI Agents SDK | SDK |
You don't have to pick one permanently. The three paths can coexist in the same PRISM project. A common pattern is to start with the proxy for quick coverage, then add SDK handlers for the agents where step-level visibility matters.
Session grouping applies to all paths. Traces sharing a session_id form one conversation and appear as a connected multi-turn journey in PRISM. Sessions cannot be backfilled: a trace sent without a session_id can't be added to a session later. Set the attribute from the first message if you want session-level views.
All three integration paths are available on every plan, including Free.
How this looks in production
Once a trace arrives, by any path, here is what PRISM does with it.
Automatic scoring
Every trace is analyzed on arrival, at no credit cost, until the plan's daily ceiling is reached. PRISM scores customer satisfaction (0–100), response quality (0–100, covering accuracy, helpfulness, and clarity), detects the user's intent, and flags a trace for review when either score falls below 40, the reply looks like a hallucination, the user seems very frustrated, or the conversation contradicts itself. Each plan has a daily ceiling on automatic scoring: 100 traces a day on Free and 200 on Builder. Past the ceiling, traces are still stored and deterministic checks still run; LLM scoring pauses until 00:00 UTC.
What a scored trace looks like
After PRISM analyzes a trace, it adds scores and metadata alongside the raw exchange. Here is what PRISM attaches to a trace once scoring runs:
{
"id": "trc_01j9x...",
"session_id": "sess_xyz789",
"model": "gpt-4o",
"latency_ms": 420,
"scores": {
"customer_satisfaction": 72,
"response_quality": 68
},
"intent": "account_balance_inquiry",
"flagged_for_review": false
}A trace where either score falls below 40, or where the reply looks like a hallucination, is flagged with a one-line reason. The session ID links this trace to every other turn in the same conversation.
Session grouping
Traces that share a session_id are assembled into a conversation view automatically. The Sessions view shows the full multi-turn journey and surfaces drift across turns.
Four connected views
Every trace lands in Agent Observability, which gives you four connected views:
- Traces, per-run request, response, model, cost, timing, scores, trajectory steps, guardrail flags
- Sessions, traces that share a session_id, read as one conversation with multi-turn journey and drift
- Agent Runs, steps, tool calls, retrieval, retries, handoffs, state, and where a run failed
- Scores & Alerts, aggregated quality signals and fired alert rules
Three working examples
The proxy setup for Anthropic (place both lines in the same client config):
Example
client = anthropic.Anthropic(
base_url="https://api.prism.blockconvey.com/proxy/anthropic",
default_headers={"X-PRISMtrace-Key": os.environ["PRISMTRACE_API_KEY"]},
)The HTTP path (one call per exchange; Authorization: Bearer is rejected, use X-PRISMtrace-Key):
Example
POST https://api.prism.blockconvey.com/api/traces
X-PRISMtrace-Key: pt-sk-...
Content-Type: application/json
{
"project_id": "proj_abc123",
"model": "gpt-4o",
"input_messages": [{"role": "user", "content": "Summarize my last three orders."}],
"output_message": "Your last three orders were placed on...",
"latency_ms": 420,
"session_id": "sess_xyz789"
}The OTel exporter endpoint:
Example
OTEL_EXPORTER_OTLP_ENDPOINT=https://api.prism.blockconvey.com/api/otlp
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_HEADERS=X-PRISMtrace-Key=<your key>The exporter appends /v1/traces itself.
Common mistakes
1. Sending only the base URL for the proxy and omitting the PRISM key header
The proxy won't authenticate and your traces won't arrive. The base URL and the X-PRISMtrace-Key header must both be in the same client config. A base URL change alone is not a working setup.
2. Using gRPC for the OTel exporter
PRISM serves OTLP over http/protobuf and http/json only. gRPC is not served. If your exporter defaults to gRPC, set OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf explicitly.
3. Installing an SDK version below 0.5.1
The minimum supported version is 0.5.1. Older versions are missing session support and several framework handlers. Install with pip install "prismtrace-sdk>=0.5.1" to enforce the floor.
4. Using Authorization: Bearer instead of X-PRISMtrace-Key
Authorization: Bearer is rejected for API keys on all endpoints except /mcp. Use X-PRISMtrace-Key: pt-sk-... as the auth header for all trace ingest and read requests.
5. Sending session_id only on the first trace and expecting earlier traces to join retroactively
Sessions are assembled from traces that share a session_id at the time they arrive. A trace sent without a session_id can't be added to a session later; sessions cannot be backfilled. Set the session_id on every trace in the conversation, starting from the first message.
How do I choose between a proxy and SDK for tracing my AI agent?
Use the proxy when you can't change application code or when you want guardrails running inline on the model call. The proxy captures prompts, completions, latency, and tokens, with no code imports and no call-site changes, and runs guardrail checks in both directions.
Use the SDK when you need visibility into what happens inside the agent: tool calls, retrieval steps, multi-agent handoffs, and errors that occur outside the model call itself. The proxy only sees the model exchange; the SDK follows the full trajectory.
The two paths can coexist. A common setup is to route all model traffic through the proxy for breadth, and attach SDK handlers on the agents where step-level detail matters.
What's the difference between gateway-based and SDK-based observability?
A gateway sits at the network layer, between your application and the model provider. It captures model I/O, prompts, completions, latency, tokens, without any code changes, but it has no visibility into the agent's internal logic: tool calls, retrieval, handoffs, and errors that happen outside the model call are invisible to it.
An SDK attaches at the framework layer, inside your application. It can follow every step the agent takes and record the full trajectory, model calls, tool calls, retrieval steps, handoffs, and errors, at the cost of a code dependency and an import.
The practical difference: if your agent calls three tools and then asks the model to summarize the results, a gateway records the summary request. An SDK records all four steps.
Can I use OpenTelemetry for agent tracing without an SDK?
Yes. Set two environment variables to point your existing OTel exporter at the PRISM endpoint, no PRISM SDK required.
Set OTEL_EXPORTER_OTLP_ENDPOINT to https://api.prism.blockconvey.com/api/otlp and OTEL_EXPORTER_OTLP_PROTOCOL to http/protobuf or http/json. The exporter appends /v1/traces itself. Send your PRISM key in the header.
One thing to set explicitly: session grouping. PRISM groups turns into conversations only from declared attributes, gen_ai.conversation.id, session.id, or prismtrace.session_id. It does not infer sessions from timing or content. Set one of these on every span in a conversation if you want multi-turn views.
Related
- AI observability toolsHow to choose one: a broader look at the tools category and what to evaluate
- Agent tracing guideStep-by-step tracing setup for AI agents
- Agent ObservabilityTraces and Sessions: what PRISM shows once your traces arrive
- AI Agent Evaluation and Quality ChecksHow to build reusable evaluation criteria on top of your traces
- AI Agent and LLM IntegrationsThe full list of supported connectors and frameworks
See what your agent actually does in production
Connect via proxy, OTel, or SDK in minutes. PRISM scores every trace, groups sessions, and surfaces failures your standard monitoring won't catch.
Free to start, 100 credits each month.