Prerequisites
Before recording metric events, you need:- A metric created in your Lemma project (find the metric ID in your dashboard under Metrics)
- A run ID from an agent execution (see Tracing Your Agent)
Record a Metric Event
To record feedback against a trace, send a POST request to the metric events endpoint:The
runId is returned by wrapAgent when tracing your agent. See Tracing Your Agent for setup instructions.Request Body
| Field | Type | Required | Description |
|---|---|---|---|
metricId | string | Yes | UUID of the metric to record against |
runId | string | Yes | The run ID returned by wrapAgent |
value.feedback | boolean | Yes | Whether the feedback is positive (true) or negative (false) |
value.description | string | No | Optional context about the feedback |
Use Cases
User Feedback
The most common use case is capturing explicit user feedback—thumbs up/down, ratings, or flag buttons:Automated Quality Checks
You can also record metric events from automated systems—moderation filters, fact-checkers, or format validators:Downstream Outcomes
Track whether the agent’s output led to a successful outcome:Viewing Metric Events
Once recorded, metric events appear in your Lemma dashboard:- On the trace detail page — see all feedback associated with a specific execution
- In the metrics view — filter and aggregate events to spot trends
- When analyzing experiments — compare feedback rates across different agent versions

