text stringlengths 0 59.1k |
|---|
messageId: string; |
feedbackId?: string; |
}) { |
// This is a custom app endpoint you implement. |
await fetch(`/api/agents/${input.agentId}/feedback/provided`, { |
method: "POST", |
headers: { "Content-Type": "application/json" }, |
body: JSON.stringify(input), |
}); |
} |
``` |
### Persist provided-state on the server |
Call `agent.markFeedbackProvided(...)` after feedback submit succeeds. This is not a built-in HTTP route; expose it from your own backend endpoint. |
```ts |
const updated = await agent.markFeedbackProvided({ |
userId, |
conversationId, |
messageId, |
feedbackId, // optional |
}); |
``` |
This updates the stored assistant message metadata so reloaded conversations still show feedback as completed. |
## API usage |
Use the API directly when you are not calling the SDK or when you want a custom feedback flow. |
### Create a feedback token |
```bash |
curl -X POST "https://api.voltagent.dev/api/public/feedback/tokens" \ |
-H "X-Public-Key: $VOLTAGENT_PUBLIC_KEY" \ |
-H "X-Secret-Key: $VOLTAGENT_SECRET_KEY" \ |
-H "Content-Type: application/json" \ |
-d '{ |
"trace_id": "trace-id", |
"feedback_key": "satisfaction", |
"expires_in": { "hours": 6 }, |
"feedback_config": { |
"type": "categorical", |
"categories": [ |
{ "value": 1, "label": "Satisfied" }, |
{ "value": 0, "label": "Unsatisfied" } |
] |
} |
}' |
``` |
Response: |
```json |
{ |
"id": "token-id", |
"url": "https://api.voltagent.dev/api/public/feedback/ingest/token-id", |
"expires_at": "2026-01-06T18:25:26.005Z" |
} |
``` |
If the key is already registered, you can omit `feedback_config` and the stored config is used. |
### Submit feedback with the token |
```bash |
curl -X POST "https://api.voltagent.dev/api/public/feedback/ingest/token-id" \ |
-H "Content-Type: application/json" \ |
-d '{ |
"score": 1, |
"comment": "Resolved my issue", |
"feedback_source_type": "app" |
}' |
``` |
### Direct feedback create |
If you want to submit feedback directly (without a token), call the feedback endpoint with project keys: |
```bash |
curl -X POST "https://api.voltagent.dev/api/public/feedback" \ |
-H "X-Public-Key: $VOLTAGENT_PUBLIC_KEY" \ |
-H "X-Secret-Key: $VOLTAGENT_SECRET_KEY" \ |
-H "Content-Type: application/json" \ |
-d '{ |
"trace_id": "trace-id", |
"key": "satisfaction", |
"score": 0, |
"comment": "Did not help" |
}' |
``` |
## Custom feedback |
Use different keys and configs to collect multiple signals. |
```ts |
const result = await agent.generateText("Review this answer", { |
feedback: { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.