Overview
Call track_feedback when a user reacts to an agent response. The messageId / message_id links the feedback directly to the agent_responses row, so you can correlate user sentiment with the model, prompt version, and cost of each specific turn.
At least one of satisfaction / rating / feedback must be provided. You can pass any combination of the three in a single call.
Required fields
Node.js / Python SDK: distinctId / distinct_id is also required. Browser SDK: optional if the user has already called Trodo.identify() in the session.
| Field (Node / Browser) | Field (Python) | Type | Description |
|---|
agentId | agent_id | string | The registered agent ID — e.g. 'agt_abc12345' |
conversationId | conversation_id | string | Stable ID for the conversation thread |
messageId | message_id | string | ID of the message turn the user is reacting to |
distinctId | distinct_id | string | Links the event to a Trodo user (required in Node/Python; optional in Browser if identify() was called) |
Feedback fields
Pass at least one of the following:
| Field (Node / Browser) | Field (Python) | Type | Description |
|---|
satisfaction | satisfaction | 'positive' | 'negative' | Thumbs up / thumbs down reaction |
rating | rating | number | Numeric score — the scale is yours (1–5, 1–10, NPS 0–10, etc.) |
feedback | feedback | string | Free-text comment from the user |
timestamp | timestamp | ISO 8601 string | Override event time |
Examples
// 1. Thumbs up only
Trodo.track_feedback({
agentId: 'agt_abc12345',
conversationId: 'conv_9kx2m7pq',
messageId: 'msg_01jf3t8r',
satisfaction: 'positive',
});
// 2. Star rating only
Trodo.track_feedback({
agentId: 'agt_abc12345',
conversationId: 'conv_9kx2m7pq',
messageId: 'msg_01jf3t8r',
rating: 4,
});
// 3. Text feedback only
Trodo.track_feedback({
agentId: 'agt_abc12345',
conversationId: 'conv_9kx2m7pq',
messageId: 'msg_01jf3t8r',
feedback: 'The answer was correct but a bit hard to follow.',
});
// 4. Combined — thumbs up, 5-star rating, and a comment
Trodo.track_feedback({
agentId: 'agt_abc12345',
conversationId: 'conv_9kx2m7pq',
messageId: 'msg_01jf3t8r',
satisfaction: 'positive',
rating: 5,
feedback: 'Exactly what I needed — found my invoice in seconds.',
});
// 1. Thumbs up only
await trodo.track_feedback({
agentId: 'agt_abc12345',
conversationId: 'conv_9kx2m7pq',
messageId: 'msg_01jf3t8r',
distinctId: 'user_7hq29zal',
satisfaction: 'positive',
});
// 2. Star rating only
await trodo.track_feedback({
agentId: 'agt_abc12345',
conversationId: 'conv_9kx2m7pq',
messageId: 'msg_01jf3t8r',
distinctId: 'user_7hq29zal',
rating: 4,
});
// 3. Text feedback only
await trodo.track_feedback({
agentId: 'agt_abc12345',
conversationId: 'conv_9kx2m7pq',
messageId: 'msg_01jf3t8r',
distinctId: 'user_7hq29zal',
feedback: 'The answer was correct but a bit hard to follow.',
});
// 4. Combined — thumbs up, 5-star rating, and a comment
await trodo.track_feedback({
agentId: 'agt_abc12345',
conversationId: 'conv_9kx2m7pq',
messageId: 'msg_01jf3t8r',
distinctId: 'user_7hq29zal',
satisfaction: 'positive',
rating: 5,
feedback: 'Exactly what I needed — found my invoice in seconds.',
});
# 1. Thumbs up only
await trodo.track_feedback(
FeedbackProps(
agent_id='agt_abc12345',
conversation_id='conv_9kx2m7pq',
message_id='msg_01jf3t8r',
distinct_id='user_7hq29zal',
satisfaction='positive',
)
)
# 2. Star rating only
await trodo.track_feedback(
FeedbackProps(
agent_id='agt_abc12345',
conversation_id='conv_9kx2m7pq',
message_id='msg_01jf3t8r',
distinct_id='user_7hq29zal',
rating=4,
)
)
# 3. Text feedback only
await trodo.track_feedback(
FeedbackProps(
agent_id='agt_abc12345',
conversation_id='conv_9kx2m7pq',
message_id='msg_01jf3t8r',
distinct_id='user_7hq29zal',
feedback='The answer was correct but a bit hard to follow.',
)
)
# 4. Combined — thumbs up, 5-star rating, and a comment
await trodo.track_feedback(
FeedbackProps(
agent_id='agt_abc12345',
conversation_id='conv_9kx2m7pq',
message_id='msg_01jf3t8r',
distinct_id='user_7hq29zal',
satisfaction='positive',
rating=5,
feedback='Exactly what I needed — found my invoice in seconds.',
)
)