OpenTelemetry

Already instrumented? Point your exporter at Agent Ping and you are done. Agent Ping accepts standard OTLP/HTTP trace exports, protobuf or JSON, and maps them onto runs and steps. No new SDK, no code changes.

The endpoint

POST https://eu.ingest.agentping.io/v1/traces

Use the host matching your data residency (eu or us). Authenticate with your team API key (apk_...) as a Bearer token; exporters that cannot set Authorization can send X-AgentPing-Key instead. Per-agent ping_ tokens do not work here; OTel traffic can create agents, so it needs the team key.

Generic exporter setup

Any OpenTelemetry SDK works with two environment variables:

export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://eu.ingest.agentping.io/v1/traces"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="authorization=Bearer apk_eu_..."

How traces map to runs

OpenTelemetry Agent Ping
Trace Run (one run per trace; re-exports are deduplicated)
Root span The run record; its name becomes the run's goal
Span with model/provider attributes LLM call step, with tokens and server-side cost
Span with a tool name Tool call step
MCP tool call (mcp.method.name with a tool name) Tool call step, with the MCP server it went to
A2A SendMessage / SendStreamingMessage Tool call step named after the remote agent
Any other span Step
service.name The agent (created automatically on first sight)

LLM calls are recognised across emitter conventions, not just the canonical gen_ai.* set. Agent Ping reads the model from gen_ai.request.model, gen_ai.response.model, OpenInference's llm.model_name, or the Vercel AI SDK's ai.model.id; the provider from gen_ai.system, llm.provider, or ai.model.provider; and token counts from any of gen_ai.usage.input_tokens / output_tokens, the older prompt_tokens / completion_tokens, OpenInference's llm.token_count.*, or Vercel's ai.usage.*. An OpenInference span tagged openinference.span.kind = LLM or TOOL is mapped even without gen_ai.* attributes.

Two attributes are worth setting explicitly:

  • agentping.agent on the resource overrides the agent identity when service.name is not what you want on the dashboard.
  • agentping.goal on the root span tells evaluations what the run was supposed to achieve. Setting it materially improves evaluation quality; without it the root span's name is used.
  • agentping.version (or the standard service.version on the resource) labels the run with the build or prompt version that produced it, so the Spend and Verify charts can mark where a new version was first seen.

Time to first token is read from gen_ai.server.time_to_first_token (seconds), the Vercel AI SDK's ai.response.msToFirstChunk, or agentping.ttft_ms (milliseconds), and charted on Pulse.

MCP and agent-to-agent calls

Spans that follow the OpenTelemetry conventions for the Model Context Protocol and the Agent2Agent protocol keep their protocol detail on the step.

Span Step Kept on the step
MCP client span for a tool call Tool call mcp: method, session id, protocol version. target: the server's address
MCP client span for anything else (initialize, tools/list, ...) Step The same
A2A client span, SendMessage or SendStreamingMessage Tool call, named after the remote agent a2a: method, task id, task state, message id, context id. target: the remote agent's name, version and address
A2A client span, any other method (GetTask, ...) Step The same
MCP or A2A server span Step mcp or a2a, no target

A few things follow from this:

  • A call counts once. When the MCP client and server both report into one trace, only the client's span is the tool call.
  • Failures the protocol reports are failures. A step is an error when its span sets error.type (an MCP tool result with isError is tool_error), or when an A2A task comes back failed or rejected, even if the request itself succeeded.
  • The remote agent does not rename your run. An A2A client span carries the remote agent's gen_ai.agent.name and its context id as gen_ai.conversation.id. Both describe the agent you called, so neither is used for your run's agent or conversation.
  • Name stdio MCP servers yourself. The convention identifies a server only by server.address, which a stdio server does not have. Set agentping.mcp.server on the span to name it.

Every MCP server and remote agent your agents call is listed under Dependencies in the dashboard, with its call volume, failure rate and p95 latency as seen from the calling side, which agents call it, and (for a remote agent) when its version changed. The same works over the runs API: put a target object (kind of mcp_server or agent, plus a name or address) on a tool_call event.

A2A carries no token usage or cost, so a remote agent's spend shows up only if that agent reports to Agent Ping itself.

Multi-agent traces

A trace is one run, so when one agent invokes another inside a trace, the invoked agent's model and tool calls are recorded on the caller's run and counted as the caller's spend.

Turn on Give nested agents their own runs in Team settings → General to change that. From then on, each invoke_agent span that sits beneath another invoke_agent span becomes a run of its own:

  • It belongs to the agent named by its gen_ai.agent.name, created on first sight like any other agent.
  • It is a sub-run of the run that invoked it, so the caller's run page lists it and shows the invocation's total cost.
  • It holds every span beneath the invoke_agent span. The invoke_agent step itself stays on the caller's run.
  • It finishes as failed when its invoke_agent span errored, otherwise as a success, at the span's end.

The split happens when the trace settles (see Run completion), so a running trace still shows as one run. An invoke_agent span with no other invoke_agent above it is the run's own agent and is never split.

Three things to know before turning it on. It adds an agent per nested agent and a run per invocation. The calling agent's spend drops from that day, because the nested agents now carry their own. And it does not apply to conversations or to runs that already finished.

Conversations

A trace is a run. For a chat that means a run per message, which is rarely what you want: see Conversations for why the session is the better unit.

To make a trace one turn of a longer run, name the run on the trace:

"resource": {"attributes": [
  {"key": "service.name", "value": {"stringValue": "support-chat"}},
  {"key": "agentping.run", "value": {"stringValue": "run_eu_018f3a2b9c1d7e8fa4b9c2d7e8f1a3b6"}},
  {"key": "agentping.idle_timeout_seconds", "value": {"intValue": "900"}},
  {"key": "agentping.idle_timeout_status", "value": {"stringValue": "success"}}
]}
Attribute Effect
agentping.run This trace is a turn of that run, not a run of its own. Its spans become steps on it. Must be a valid run_<region>_<32 hex> id.
agentping.idle_timeout_seconds Close the run once no span has arrived for this long. OTLP has no way to say "finished", so without this a conversation stays open until you call /finish yourself.
agentping.idle_timeout_status What that silence meant. Defaults to timeout; send success for a chat.
agentping.turn On a span: which exchange of the conversation it belongs to, counting from 1. Groups the several spans of one turn.

Any of these can go on the resource (the whole service) or on a span (this turn); the span wins where both are set.

Naming the run changes two things. The settle window below no longer applies: the run is yours to end, not ours to guess at, and the root span becomes an ordinary step rather than the run record, because the run already exists.

Mixing is fine: report turns over OTLP and call POST /v1/runs/{id}/finish on the same id when the user closes the chat.

Conversation ids

Emitters that follow the GenAI semantic conventions tag each span with gen_ai.conversation.id. When a trace carries it and no agentping.run, Agent Ping derives the run for you: every trace with that id, from any agent in the team, lands on one run, named after the first turn's root span and carrying the id as its conversation. That run closes as a success once no span has arrived for 30 minutes; set agentping.idle_timeout_seconds or agentping.idle_timeout_status on the trace to change either. Nothing to mint, nothing to pass between services: the id your framework already emits is enough.

Run completion

OTel delivers spans in batches with no end-of-run signal, so a run ingested this way completes once its root span has arrived and no new span has landed for two minutes. Costs, health checks, and evaluations then run exactly as they do for SDK-reported runs.

Limits

Span attributes Agent Ping does not map are kept with the step, up to 8KB per step; beyond that the largest attributes are dropped and the step is flagged, never rejected. Prompt and completion attributes count as step content with the usual 64KB allowance.

Verified emitters

Anything that speaks OTLP/HTTP works; each needs only the endpoint and header configuration above. These are the ones we test against recorded fixtures, so an upstream attribute rename is caught by us, not by you:

Emitter What to set Mapped from
OpenLLMetry / Traceloop TRACELOOP_BASE_URL to the endpoint, plus the auth header gen_ai.*
Pydantic AI Enable instrumentation, point the OTLP exporter at the endpoint gen_ai.*
Vercel AI SDK experimental_telemetry: { isEnabled: true } plus an OTLP exporter ai.*
OpenInference (Arize Phoenix, OpenAI Agents SDK) OTLP exporter to the endpoint openinference.span.kind, llm.*
LangGraph (via OpenLLMetry's LangChain instrumentation) OTLP exporter to the endpoint gen_ai.*, node spans as steps
Laravel AI SDK (via laravel-ai-otel) OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_HEADERS gen_ai.*, invoke_agent and execute_tool spans as steps

CrewAI and LlamaIndex are supported through their OpenLLMetry / OpenInference instrumentation by the same path.

Further reading

For the conceptual background, what OpenTelemetry covers for AI agents, what agent spans contain, and which operational questions OTel deliberately leaves to the backend, see OpenTelemetry for AI agents.