---
title: Set up Agent Analytics
description: "Set up Agent Analytics: pick a project, decide your session IDs and privacy mode, instrument with the AI SDK, OpenTelemetry, or the HTTP API, then verify your data."
product: general
lang: en
token_estimate: 1526
---
# Set up Agent Analytics

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

Agent Analytics groups your agent's messages, tool calls, and responses into sessions tied to your users, then scores each session. Setup takes four steps: pick a project, decide your session and privacy strategy, instrument with one path, and verify. For defaults with no customization, complete the [Agent Analytics quickstart](https://amplitude.com/docs/amplitude-ai/agent-analytics/quickstart) instead. If you're still evaluating, [Analyze agent results](https://amplitude.com/docs/amplitude-ai/agent-analytics/results) shows what Agent Analytics produces.

## How setup works

1. Pick the Amplitude project the data flows into, and get its project API key.
2. Decide your session ID, user ID, and privacy mode. Refer to [Before you instrument](#before-you-instrument).
3. Instrument your code with one path. Refer to [Choose an instrumentation path](#choose-an-instrumentation-path).
4. Check your events. Refer to [Verify](#verify).

Each turn of an instrumented session produces an `[Agent] User Message`, one `[Agent] Tool Call` per tool invocation, and an `[Agent] AI Response`. When the work ends, your code sends `[Agent] Session End`. After the session closes, Amplitude adds an `[Agent] Session Record` with the session's enrichment results. The timeline below shows this sequence. Click any event to inspect its shape.

**Video (2:35):** How Agent Analytics setup works — wistia id `j4frodo3ld` — [poster](https://amplitude.com/docs/images/amplitude-ai/agent-analytics/setup-video-poster.jpg)

## Before you instrument

Decide these before you write code. Each one is hard to change after rollout.

- **Session ID and user ID**: The ID that represents one unit of work, and the stable user ID you already use for product analytics. Refer to [Agent Analytics sessions and user identity](https://amplitude.com/docs/amplitude-ai/agent-analytics/sessions).
- **Privacy mode**: Whether prompt and response text leaves your infrastructure. Refer to [Choose a privacy mode](#choose-a-privacy-mode).

### Choose a privacy mode

Three modes control what leaves your infrastructure. `full` (the default) sends message content, `metadata_only` sends none, and `customer_enriched` sends none and carries quality labels you compute yourself. Every mode sends tokens, cost, latency, model names, and session grouping. For a full comparison and how to apply each mode on your path, refer to [Agent Analytics privacy modes](https://amplitude.com/docs/amplitude-ai/agent-analytics/privacy-modes).

## Choose an instrumentation path

Pick one path. Every path produces the same `[Agent]` events, so sessions, enrichment, and charts work the same way.

| Path | Use when | Guide |
| --- | --- | --- |
| AI SDK (Node, Python) | You can modify a Node or Python codebase | [Instrument your agent with the AI SDK](https://amplitude.com/docs/amplitude-ai/agent-analytics/instrument-ai-sdk) |
| OpenTelemetry | You already export GenAI spans or run an OpenTelemetry Collector | [Send OpenTelemetry traces to Agent Analytics](https://amplitude.com/docs/amplitude-ai/agent-analytics/instrument-opentelemetry) |
| HTTP API or standard Amplitude SDK | The AI SDK doesn't fit your runtime: browsers, edge runtimes, AI app builders, Java, Go, or Ruby | [Send agent events without the AI SDK](https://amplitude.com/docs/amplitude-ai/agent-analytics/instrument-http-api) |
| Integration | Conversations already live in a data warehouse, an LLM tracing tool, or a hosted agent platform | [Import agent conversations from other tools](https://amplitude.com/docs/amplitude-ai/agent-analytics/integrations) |

### Connect with the SDK

Install the AI SDK for Node or Python, then let your AI coding agent instrument the app or wire it in by hand. Go to [Instrument your agent with the AI SDK](https://amplitude.com/docs/amplitude-ai/agent-analytics/instrument-ai-sdk).

### Send OpenTelemetry traces directly

Point your OTLP exporter or Collector at Amplitude's endpoint and set a conversation attribute on your spans. Go to [Send OpenTelemetry traces to Agent Analytics](https://amplitude.com/docs/amplitude-ai/agent-analytics/instrument-opentelemetry).

### Send agent events without the AI SDK

Emit `[Agent]` events with a standard Amplitude SDK or the HTTP API when the AI SDK doesn't fit your runtime. Go to [Send agent events without the AI SDK](https://amplitude.com/docs/amplitude-ai/agent-analytics/instrument-http-api).

## Verify

Send one real interaction and check nine gates on its events in Live Events, then run the production checklist before rollout. Refer to [Verify your Agent Analytics instrumentation](https://amplitude.com/docs/amplitude-ai/agent-analytics/verify). If something's missing, refer to [Troubleshoot Agent Analytics setup](https://amplitude.com/docs/amplitude-ai/agent-analytics/troubleshooting).

## Extend your setup

These steps are optional:

- **Session timeouts**: Keep sessions open longer than 30 minutes for jobs that wait on humans. Refer to [Configure session timeouts](https://amplitude.com/docs/amplitude-ai/agent-analytics/configure-session-timeouts).
- **User feedback**: Send thumbs up, thumbs down, and CSAT ratings as `[Agent] Score` events. Refer to [Collect user feedback](https://amplitude.com/docs/amplitude-ai/agent-analytics/collect-user-feedback).
- **Session Replay**: Link each agent session to the recording of the visit it happened in. Refer to [Link agent sessions to Session Replay](https://amplitude.com/docs/amplitude-ai/agent-analytics/link-session-replay).
- **Multi-agent systems**: Record delegation from a parent agent to child agents. Refer to [Instrument multi-agent systems](https://amplitude.com/docs/amplitude-ai/agent-analytics/multi-agent).
- **Custom evaluators**: Add your own model provider key to run evaluators and calibration runs. Refer to [Set up custom evaluators](https://amplitude.com/docs/amplitude-ai/agent-analytics/custom-evaluators).

