---
title: Collect user feedback in Agent Analytics
description: "Send thumbs up, thumbs down, and CSAT ratings from your product to Agent Analytics as [Agent] Score events, so explicit feedback overrides detected negative feedback for a session."
product: general
lang: en
token_estimate: 955
---
# Collect user feedback in 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 records user feedback as `[Agent] Score` events that your application sends when a user rates a response. A score named `user-feedback` overrides the detected negative feedback signal for its session, so a thumbs up beats a false-positive frustration detection, and a thumbs down flags a session even when the model saw nothing wrong.

Amplitude never generates Score events. A chart of `[Agent] Score` where Score Name is `user-feedback` is a pure measure of what your users said. The classic quality chart is the disagreement view: sessions the signals judged fine that users rated thumbs down.

## Decide the score shape

Three decisions matter:

1. **Name it `user-feedback`.** Use this exact Score Name for a binary thumbs control, because of its override semantics. For a five-star or CSAT scale, use a different name, such as `csat`, so your thumbs metric stays clean.
2. **Target the message.** Rate the specific AI response the user reacted to by passing its `[Agent] Message ID` as the target, with target type `message`. Use target type `session` only for end-of-conversation ratings, such as a CSAT prompt.
3. **Send value 1 for up, 0 for down, with source `user`.** For other scales, pass the numeric value.

Sparse clicks are fine. Built-in signals score every session regardless, and Amplitude captures implicit behavior (copy, regenerate, abandonment) automatically. Explicit ratings sharpen the picture where you have them.

## Send feedback with the AI SDK

Wire your feedback control to the session's scoring method:

#### Node

```typescript
// Node: inside the session, when the user clicks the control
s.score('user-feedback', 1, aiMessageId, { source: 'user' });          // thumbs up
s.score('user-feedback', 0, aiMessageId, {
  source: 'user',
  comment: freeTextFromUser,   // optional; gated by privacy mode
});                                                                      // thumbs down
```

#### Python

```python
# Python
s.score("user-feedback", 1, ai_message_id, source="user")               # thumbs up
s.score("user-feedback", 0, ai_message_id, source="user",
        comment=free_text_from_user)                                    # thumbs down
```

Feedback often arrives after the request that produced the response has finished, for example when the user clicks minutes later in the frontend. For that path, call the client-level method with the session and target IDs you stored alongside the message:

```typescript
ai.trackScore({
  userId,
  name: 'user-feedback',
  value: 0,
  targetId: aiMessageId,
  targetType: 'message',
  source: 'user',
  sessionId,
});
```

The optional comment is content, so your [privacy mode](https://amplitude.com/docs/amplitude-ai/agent-analytics/privacy-modes) gates it.

## Send feedback without the AI SDK

POST the same event shape to the HTTP API. The override semantics apply identically.

```bash
curl -X POST https://api2.amplitude.com/2/httpapi \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "YOUR_API_KEY",
    "events": [{
      "event_type": "[Agent] Score",
      "user_id": "user-123",
      "event_properties": {
        "[Agent] Session ID": "ticket-42",
        "[Agent] Agent ID": "support-bot",
        "[Agent] Score Name": "user-feedback",
        "[Agent] Score Value": 1,
        "[Agent] Target ID": "msg-1",
        "[Agent] Target Type": "message",
        "[Agent] Evaluation Source": "user"
      }
    }]
  }'
```

For every Score property, refer to [\[Agent\] Score](https://amplitude.com/docs/amplitude-ai/agent-analytics/taxonomy#agent-score) in the taxonomy.

