User feedback captures direct signals from end users about your AI capability’s performance. By linking feedback events to traces, you can correlate user perception with system behavior to understand exactly what went wrong and prioritize high-impact improvements.Documentation Index
Fetch the complete documentation index at: https://axiom.co/docs/llms.txt
Use this file to discover all available pages before exploring further.
How user feedback works
User feedback collection works across your server and client in the following way:- Server: Your AI capability runs inside
withSpan, which creates a trace. ExtracttraceIdandspanIdfrom the span and return them to the client alongside the AI response. - Client: When users provide feedback (thumbs up/down, ratings, comments), send it to Axiom with the trace IDs. This links the feedback to the exact trace.
- Axiom Console: View feedback events and click through to see the corresponding AI trace to understand what happened.
Types of feedback
Axiom AI SDK supports the following feedback types:| Type | Description | Example |
|---|---|---|
thumb | Thumbs up (+1) or down (-1) | Response quality rating |
number | Numeric value | Similarity score (0-1), star rating (1-5) |
bool | Boolean true/false | ”Was this helpful?” |
text | Free-form string | User comments |
enum | Constrained string value | Category selection |
signal | No value, indicates event occurred | ”User copied response” |
Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom dedicated for storing feedback data. Feedback events are stored separately from trace data.
- Create an API token in Axiom with minimal permissions because it’s exposed in the frontend. Add ingest-only permissions to the feedback dataset you have created.
- Install Axiom AI SDK in your project. For more information, see Quickstart.
Server-side configuration
On the server side, capture trace context withwithSpan when you run your AI capability, and pass the trace and span IDs to the frontend using FeedbackLinks:
FeedbackLinks links feedback events to traces, and allows you to see what your AI capability did when a user provided feedback.
Client-side configuration
On the client side, initialize a feedback client with your Axiom credentials:For browser-based feedback collection, use environment variables prefixed for your framework. For example, use
NEXT_PUBLIC_ for Next.js..env
Replace
API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME with the name of the Axiom dataset where you send your data.Replace AXIOM_DOMAIN with the base domain of your edge deployment. For more information, see Edge deployments.Send feedback
Use theFeedback helper to create feedback objects, and send them with sendFeedback:
- Thumbs up/down
- Numeric
- Boolean
- Text
- Enum
- Signal
- Metadata
Error handling
The feedback client logs errors to the JavaScript console by default. To handle errors differently, pass anonError callback:
Example: Chat interface with feedback
This example shows a complete pattern for a chat interface with thumbs up/down feedback in Next.js.- Server-side code
- Client-side code
The server-side code returns the trace and span IDs to the client-side code, which is used to link the feedback to the trace:
/app/actions.ts
View feedback in Console
After collecting feedback, analyze it in the Axiom Console.AI engineering tab
Using the AI engineering tab, analyze the feedback events for each capability.- Click the AI engineering tab.
- Click Feedback in the sidebar.
- Select the capability from the dropdown.
- Optional: Click to filter the feedback events by name.
- Click the feedback event to see the details.
- Click View in the Trace column to navigate to the corresponding AI trace.
- Analyze the trace in the waterfall view. For more information, see Traces.
Query tab
Using the Query tab, query the feedback dataset as any other dataset. For example, to see the number of thumbs up and thumbs down for each capability:- Click the feedback event in the list.
- In the event details panel, click the trace ID to navigate to the corresponding AI trace.
- Analyze the trace in the waterfall view. For more information, see Traces.