このページでは

For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.

Send OpenInference traces to Agent Analytics

このページはまだあなたの言語に翻訳されていません。 現在取り組んでいますので、後でもう一度確認してください。

Agno, smolagents, DSPy, Haystack, the Google GenAI SDK, and AutoGen AgentChat emit OpenInference spans. Point that exporter at Amplitude. You don't need the Amplitude AI SDK in the agent process.

This page covers agno 3.1.11, smolagents 1.26.0, dspy 3.4.1, haystack-ai 3.4.1, google-genai 2.33.0, and autogen-agentchat 0.7.5. Amplitude stores the spans you export. Scrub personal data before it leaves your infrastructure. Refer to Agent Analytics privacy modes.

Paste this prompt into your AI coding agent, such as Cursor, Claude Code, Windsurf, GitHub Copilot, or Codex.

text
Connect this OpenInference agent to Amplitude Agent Analytics with native OpenTelemetry.

Fetch https://raw.githubusercontent.com/amplitude/Amplitude-AI-Node/main/docs/integrations/openinference.md
and follow "Part 2: Coding agent procedure".
If @amplitude/ai is installed, the same file is under node_modules/@amplitude/ai/docs/integrations/.
Also follow https://raw.githubusercontent.com/amplitude/Amplitude-AI-Node/main/docs/integrations/privacy.md
and scrub content before export.
Follow links in the guide. If your source isn't listed, start at https://raw.githubusercontent.com/amplitude/Amplitude-AI-Node/main/docs/integrations/README.md

Review the changes, then verify with the steps in Get started.

What this means for you

  • You run: The agent process, with the OpenInference instrumentor for that framework pointed at Amplitude.
  • You need: The pinned package above, the matching openinference-instrumentation-* package, your Amplitude project API key, and a span processor that sets user.id, session.id, and gen_ai.agent.id.
  • Protocol: OTLP over HTTP. Amplitude accepts protobuf and JSON. Amplitude doesn't accept gRPC. Don't send OTLP logs.
  • Privacy: Amplitude doesn't scrub content after receipt. Mask or drop content attributes before export.

Export

Set these variables in the agent process. Encode the space in the header value as %20 when the value is in an environment variable. Leave Authorization= as written.

bash
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://api.amplitude.com/otlp/v1/traces
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer%20<project API key>"
OTEL_SERVICE_NAME=order-support

EU data residency uses https://api.eu.amplitude.com/otlp/v1/traces.

Identity

What carries over

Haystack and the Google GenAI SDK still produce the session, the user, the model, both token counts, and the reply text.

TraceConfig with the hide-input and hide-output flags omits message attributes, so the prompt and reply text don't arrive. input.value and output.value are the placeholder __REDACTED__. Amplitude drops that placeholder, so tool arguments and tool results are empty. Agno and AutoGen still send the arguments on tool.parameters. Google GenAI still sends them on message.tool_calls.0.tool_call.function.arguments. smolagents still sends the user question on smolagents.task. Amplitude stores those attributes. Session, user, and agent stay. Agno, smolagents, Haystack, Google GenAI, and AutoGen keep the model name and both token counts. DSPy keeps the model name and drops the token counts. Agno, smolagents, DSPy, and AutoGen keep tool.name. Haystack and the Google GenAI SDK still have no tool span.

Session close

[Agent] Session End is optional and recommended. A native OpenInference export doesn't send it. Amplitude closes the session after 30 minutes without a qualifying agent event by default, and 24 hours from the session start when no per-session override is set. The first close is the one that counts. Enrichment, including the Session Record and content-based signals, runs once after that close. The OpenTelemetry translator doesn't read an idle-timeout attribute from a span. Refer to How sessions close.

Get started

Follow the OpenInference integration guide. Send two turns with the same session id, then confirm in Live Events:

  1. Session ID is the processor session id, not a trace ID.
  2. User ID is the product-analytics user, not unknown.
  3. Agent ID is gen_ai.agent.id.
  4. Agno, smolagents, DSPy, and AutoGen show a tool call. Haystack and the Google GenAI SDK show the reply and don't show a tool call.
  5. The AI Response has the model name and both token counts.

Guide last verified on October 28, 2026, against agno 3.1.11, smolagents 1.26.0, dspy 3.4.1, haystack-ai 3.4.1, google-genai 2.33.0, and autogen-agentchat 0.7.5. Those names are trademarks of their owners. Amplitude isn't affiliated with or endorsed by those owners.

これは役に立ちましたか?