On this page

Agent Analytics quickstart

Early Access

This feature is in Early Access. During this time, aspects of the functionality may still be developed, and this documentation may not always be up to date. If you have any questions, contact Amplitude Support.

Install the SDK, run one command, and your agent's traffic shows up in Amplitude about five minutes from now. You need a project with Agent Analytics enabled and its API key, and nothing else. Anonymous user and session IDs are fine.

This page is the fast path. To instrument production with full identity and privacy controls, go to Set up Agent Analytics and the SDK reference instead.

Install the SDK

bash
npm install @amplitude/ai @amplitude/analytics-node

Run the setup agent

Run this, paste the printed prompt into your coding assistant (Cursor, Claude Code, Windsurf, GitHub Copilot, or Codex), and approve the change it proposes.

bash
npx amplitude-ai

The agent finds every LLM call site and the session lifecycle, instruments them, and prints a dry-run report of the events and field fill rates before anything ships.

Patch one line instead

No coding assistant handy? One call at startup monkey-patches supported provider clients (OpenAI, Anthropic, Gemini, and more), so the SDK tracks your existing LLM calls with no other code changes.

typescript
import { AmplitudeAI, patch } from "@amplitude/ai";

const ai = new AmplitudeAI({ apiKey: process.env.AMPLITUDE_AI_API_KEY! });
patch({ amplitudeAI: ai });

The patch captures basic [Agent] AI Response events only: enough to verify the pipeline works, not the end state.

Watch the events arrive

Run the doctor to validate your environment variables, dependencies, and the event-pipeline connection:

bash
npx amplitude-ai doctor
Then open your project's Live Events stream. [Agent] AI Response events appear with model, provider, latency, token, and cost fields populated. For the full verification checklist, go to Verify your data.

Add IDs when you're ready

It's a ladder you climb over time, not a form you fill out on day one.

Placeholder IDs work: events still flow, sessions still enrich, and you can swap in real identity later without re-instrumenting. For the complete breakdown, go to What you set and what you get in the SDK reference.

Was this helpful?