JavaScript
Objectives
Submit feedback for an objective
Score a finished objective from -1.0 to 1.0. Under Feedback Driven selection, that score teaches the agent which variation to reach for next.
POST
JavaScript
Feedback closes the loop. Score an objective and, if its agent uses
Unlike most of the API, this endpoint validates strictly. Omit
That is a feature when several reviewers weigh in, and a bug when your retry logic fires twice. Each submission compounds into selection, so make the call idempotent on your side, or set
The agent-level list is the interesting one, because it is where you find out which variation earned a score. Pass
Set
VARIATION_SELECTION_MODE_WEIGHTED, the variation that ran it becomes more or less likely to run the next one. No retraining, no redeploy. This is the endpoint behind that.
metadata and data are both required. An empty metadata object is fine.
metadata and you get a 400. Send a score outside [-1.0, 1.0] and you get a 400.
Score is evidence, not a rating
A score is a number from-1.0 to 1.0. Think of it as a vote on whether this variation should run again, not as a star rating you are averaging for a dashboard.
A score of
0.0 is neutral evidence. It adds 0.5 to both sides of the variation’s Beta posterior, pulling its mean toward 0.5 without favoring success or failure. Omitting score defaults to this neutral update.Feedback appends
Every submission inserts a new record. There is no upsert, and nothing stops you from scoring the same objective twice.metadata.externalId to your own review ID and check before you resubmit.
How a score moves the odds
Weighted selection is Thompson Sampling over a Beta distribution. Each variation carries two numbers, both starting at1.0, which together describe how good Cadenya currently believes that variation is.
- A positive score adds its magnitude to the variation’s success count.
- A negative score adds its magnitude to the failure count.
- A zero score adds
0.5to both counts.
+1.0, another -0.5, and a third 0.0, then read the variation:
info.score is the variation’s current believed quality, and it runs from 0.0 to 1.0, not from -1.0 to 1.0. A brand new variation reads 0.5. Here the posterior is Beta(2.5, 2.0), so the score reads about 0.556. The neutral submission contributed 0.5 to both sides, and feedbackCount counted all three records.
Two different numbers get called “score”. The one on a feedback record is your raw
-1.0 to 1.0 vote. The one on variation.info is the agent’s belief, 0.0 to 1.0. Analytics charts average the former.Read feedback back
Two views. Per objective, and across an agent.includeInfo: true and each record carries its objective and agentVariation. Without it you get submittedBy and nothing else, which tells you who complained but not about what.
It also takes real filters, and they work: sentiment, agentVariationId, query (a case-insensitive substring search over comments), createdAfter, createdBefore, and labels.
The per-objective list is thinner: it takes only cursor, limit, and labels, with no includeInfo.
Put it to work
Score from the place that knows whether the agent succeeded, which is rarely the place that started the objective. A support agent’s real signal is whether the ticket reopened. A code agent’s is whether the pull request merged.metadata.externalId on the objective and you never have to store the obj_ ID to score it later. Labels ride along, so you can slice feedback by source and separate a human reviewer’s judgment from an automated signal.
Related
Build an agent that improves
Two variations, live feedback, and selection shifting toward the winner.
Agents and variations
The lifecycle in code, including how selection mode is set.
Create an objective
Pin a variation to smoke-test it before it takes live traffic.
Use your own IDs
Score an objective by your ticket number, months later.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Example:
"workspace_01HXKD2E5NQM3T9AYWCF133E3Q"
The ID of the objective. Supports "external_id:" prefix for external IDs.
Example:
"obj_01HXKD2E5NQM3T9AYWCFQAZGFV"
Body
application/json
Response
OK