Track Personal Agent Protocol traffic in Agent Analytics
このページはまだあなたの言語に翻訳されていません。 現在取り組んでいますので、後でもう一度確認してください。
When a person's personal agent talks to your customer-facing agent over Personal Agent Protocol (Poppy), Agent Analytics records who wrote each message on each side: the person or an AI on their behalf, and your agent or a person at your company. Set [Agent] Message Source from the Poppy message author, and add three context properties from the Poppy Session. Your human-experience metrics then stay clean, you can tune your agent for both audiences, and you can see which personal agents complete real outcomes and when the person steps in.
Use this page when your company runs its own agent that personal agents talk to. Your agent is the one Agent Analytics evaluates. The personal agent is a channel into it, like chat or voice. If personal agents reach you only through your APIs or website, with no agent of yours in the conversation, use Track product events only.
Set up with your AI coding agent (recommended)
Paste this prompt into your AI coding agent, such as Cursor, Claude Code, Windsurf, GitHub Copilot, or Codex.
Connect this agent's Personal Agent Protocol traffic to Amplitude Agent Analytics.
Fetch https://raw.githubusercontent.com/amplitude/Amplitude-AI-Node/main/docs/integrations/personal-agent-protocol.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 it leaves the app.
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: Your agent, which already accepts Poppy sessions and verifies the
Poppy-Sessionheader (spec section 5.3). Amplitude never verifies the header. Map only claims you've already verified. - You need: The Amplitude AI SDK for Node or Python in your agent, or a forwarder that sends
[Agent]events through the HTTP API, and your Amplitude project API key. - Identity: One Agent Analytics session per Poppy conversation. A device ID derived from the Session JWT before sign-in, and your product user ID after.
- Privacy:
poppy_personal_agentis the personal agent'sclient_idURL, not a person. Keep personal data such as email addresses out of[Agent] Context. Message text follows your SDK content mode and redaction settings. Refer to Agent Analytics privacy modes.
Who's who
| Party | In Poppy | In Agent Analytics |
|---|---|---|
| Your agent | The Company Agent | The agent you instrument and evaluate, identified by [Agent] Agent ID |
| The person | The User | device_id before sign-in, user_id after, and User Message events with Message Source user |
| The person's personal agent | The Personal Agent, identified by its client_id URL | User Message events with Message Source personal_agent, and the poppy_personal_agent context property |
| A person at your company | responder set to human after a handoff | AI Response events with Message Source human_agent |
Identity
| Field | Value |
|---|---|
[Agent] Session ID | The Conversation ID, which your company chooses (spec section 8.2). Use the ID your chat system already uses for the conversation, on every turn. |
device_id | poppy-sha256: followed by the SHA-256 hex of the Session JWT iss, a newline, and sub. Send it on every event, before and after sign-in. |
user_id | The user ID your product analytics already uses. Leave it empty until the person signs in. Never the sub. |
poppy_session_id in [Agent] Context | The Session JWT sid. |
poppy_personal_agent in [Agent] Context | The Session JWT iss, the personal agent's client_id URL. |
poppy_agent_id in [Agent] Context | The Session JWT agent_id, when present. |
A Poppy Session isn't a conversation. It covers one person's browsing, API calls, and conversations through one personal agent, and a conversation can continue in a new Session (spec section 5.5). Key Agent Analytics sessions on the Conversation ID so each conversation stays one session, and keep the sid in context to join the conversation to the rest of the Poppy Session.
Before the person signs in, you don't have a product user ID, only the pairwise sub (spec section 5.1). The personal agent assigns it. It contains no personal information, it's different for each company, and it stays the same each time the person returns to yours through the same personal agent. It's unique only within that personal agent, so two personal agents can send the same sub for different people, and the device_id must combine iss and sub. You choose the format; the examples on this page are one option. Repeat visits through the same personal agent group under one anonymous user. A personal agent can also send a new sub for each anonymous browsing session, and those visits don't group.
When the person signs in through Poppy, keep the same device_id and set user_id. Amplitude merges the anonymous events from that device ID into the user. Refer to Merged users. Don't send the sub as the user_id, because Amplitude doesn't merge two different user IDs automatically.
What carries over
| Poppy input | Amplitude event |
|---|---|
A message with author.type of human (spec section 8.8) | [Agent] User Message with [Agent] Message Source user |
A message with author.type of agent (spec section 8.8) | [Agent] User Message with [Agent] Message Source personal_agent |
| A reply from your agent | [Agent] AI Response |
| A reply a person at your company wrote, after a handoff (spec section 8.9) | [Agent] AI Response with [Agent] Message Source human_agent |
Conversation state closed set to true (spec section 8.12) | One [Agent] Session End |
| Browsing and API calls in the Poppy Session | No [Agent] events. Track them as product events. |
A summary, paraphrase, or translation of what the person said arrives as author.type agent, so it records as personal_agent. Only the person's own words record as user.
[Agent] Message Source value agent means something else: a parent agent in your own system instructing a child agent. The AI SDK provider wrappers set it automatically from the parent agent ID. Don't use it for personal agent messages. Refer to Instrument multi-agent systems.
Set up with the AI SDK
Track each turn in a session keyed on the Conversation ID, and send one Session End when the conversation closes. The option is messageSource in Node and message_source in Python. The step-by-step guide, with a tested example, is the Personal Agent Protocol integration guide.
import { createHash } from 'node:crypto';
// claims: the verified Session JWT claims. conversationId: the Conversation ID
// in the request URL. msg: the incoming Poppy message.
const agent = ai.agent('support-agent', {
context: {
poppy_personal_agent: claims.iss,
poppy_session_id: claims.sid,
...(claims.agent_id ? { poppy_agent_id: claims.agent_id } : {}),
},
});
// sub is unique only within one personal agent, so include iss.
const deviceId = `poppy-sha256:${createHash('sha256').update(`${claims.iss}\n${claims.sub}`).digest('hex')}`;
// Each turn. Don't wrap it in session.run(), which ends the session when it returns.
const s = agent.session({
sessionId: conversationId,
deviceId,
userId: accountUserId, // null until the person signs in
});
s.trackUserMessage(msg.text, {
messageSource: msg.author.type === 'human' ? 'user' : 'personal_agent',
});
// ... call the model, then track the reply with s.trackAiMessage(...)
// Once, where your server sets the conversation's closed to true.
agent.trackSessionEnd({
sessionId: conversationId,
deviceId,
...(accountUserId ? { userId: accountUserId } : {}),
});
The context properties land in [Agent] Context, and Amplitude echoes them onto the Session Record. Filter on them in Agent Analytics with the existing context filters. The SDK drops [Agent] Context in metadata_only content mode.
If your Poppy endpoints use the AI SDK middleware, turn off its session events (trackSessionEvents: false in Node, track_session_events=False in Python) and resolve the session ID to the Conversation ID. Otherwise the middleware ends the session after every request.
When a person at your company takes over the conversation, send their replies as [Agent] AI Response events with [Agent] Message Source set to human_agent, through the HTTP API or your help desk integration. Refer to Send agent events without the AI SDK.
Session close
Send [Agent] Session End once per conversation, when your server sets the conversation state's closed to true. Don't end the session after each turn. Enrichment, including the Session Record and content-based signals, runs once after the first close, so a close after each turn scores every turn on its own.
If a conversation never closes, 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. If your conversations can pause for hours, set the session's idle timeout (idleTimeoutMinutes in Node, idle_timeout_minutes in Python). Refer to How sessions close.
Track product events
Browsing and API calls in a Poppy Session don't produce [Agent] events. Track them as regular Amplitude analytics events, and join them to the conversations with the same identity and two event properties.
After your server verifies the Poppy-Session header on a request, add poppy_session_id, set to the sid, and poppy_personal_agent, set to the iss, as event properties on the events you already send for that request. Send them with the same device_id, and after sign-in the same user_id, as the agent events. These properties match the context keys on the agent events.
import { track } from '@amplitude/analytics-node';
track(
'Order Created',
{ orderId: order.id, poppy_session_id: claims.sid, poppy_personal_agent: claims.iss },
{ device_id: deviceId, ...(accountUserId ? { user_id: accountUserId } : {}) },
);
Refer to the Node.js SDK and Python SDK for setup.
Track the Poppy steps outside the conversation the same way. These names are recommendations:
| Event | When to send it |
|---|---|
Poppy Sign In Completed | The person finishes signing in through the personal agent. |
Poppy Scope Granted | The person approves access scopes for the personal agent. |
Poppy Browser Joined | The personal agent's browser joins the Poppy Session on your website. |
Poppy Operation Approved | The person approves an operation the personal agent asked to run. |
You can then build funnels from agent turns to approved operations and split them by personal agent.
When a browser joins a Poppy Session on your website, add the event property poppy_session_id to the events you track there with the Browser SDK. The browser has its own device ID, so until the person signs in, its events join the agent sessions and funnel events by poppy_session_id. After sign-in, set the same user ID in the Browser SDK as on the agent events.
Send OpenTelemetry traces
If your agent sends OpenTelemetry traces, set session.id to the Conversation ID, amplitude.device_id to the same device ID as the SDK examples, and enduser.id to the account's user ID only after the person signs in. The receiver maps all three. To record the message source, set amplitude.message.source to user or personal_agent on the span. The receiver doesn't map [Agent] Context, so filtering on poppy_personal_agent requires the Amplitude AI SDK, including its OpenTelemetry exporter. Refer to OpenTelemetry attribute reference.
Chart recipes
- Quality by personal agent: In Agent Analytics, filter sessions on the
poppy_personal_agentcontext property and compare Task Completed, Response Quality, and User Friction across personal agents, and against sessions without one. - Person stepped in: Count sessions that have
poppy_personal_agentset and also contain an[Agent] User Messagewith[Agent] Message Sourceuser. - Agent-driven and human-driven outcome rate: Build a funnel from
[Agent] User MessagetoPoppy Operation Approvedor your own conversion event. Split the first step by[Agent] Message Sourceto comparepersonal_agentwithuser.
For the built-in signals, refer to Agent Analytics built-in signals. For every Message Source value, refer to the Agent Analytics taxonomy.
Get started
Follow the Personal Agent Protocol integration guide. Send one conversation with a personal_agent turn and a user turn, close it, then confirm in Live Events:
- Session ID is the Conversation ID, not the
sid. - Device ID starts with
poppy-sha256:, and User ID appears only after sign-in. - Each
[Agent] User Messagehas[Agent] Message Sourcepersonal_agentoruser, matching who wrote it. [Agent] Contexthaspoppy_personal_agentandpoppy_session_id.- Exactly one
[Agent] Session Endarrives, after the close. - A product event from the same request has
poppy_session_id.
Guide last verified on November 19, 2026, against Personal Agent Protocol 1.0. The authors of Personal Agent Protocol publish the specification. Amplitude isn't affiliated with or endorsed by the protocol's authors.
これは役に立ちましたか?
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.