Skip to content

Feedback and rules

You teach the work in two ways. Feedback is a judgement of what a run did, step by step, and it is given to the same step on later runs. A rule is a correction worth keeping for good: it is written into a playbook version, or onto an assignment, and every run of it follows the rule.

Feedback steers on its own, for a while. A rule stays until you remove it.


Judge a run

On a run's page, mark a step Good or Not right, or judge the run as a whole. Anyone with workforce::read can judge a run.

POST /runs/{run uuid}/feedback
{
  "step_index": 4,
  "position": "at",
  "sentiment": "bad",
  "category": "wrong_arguments",
  "comment": "It paid the net amount, not the gross.",
  "should_have": {
    "tool": "payments_schedule",
    "arguments": { "amount": "gross" },
    "rationale": "Suppliers are paid the gross invoice total."
  }
}
Field Meaning
step_index The step you are judging (1-based). Leave out to judge the whole run.
position at (default) judges the step itself. before says something should have happened before this step, and needs a step_index.
sentiment good or bad.
category What kind of judgement it is; see the table.
comment Free text, up to 4000 characters.
should_have What should have happened instead: tool, arguments (a JSON object, up to 32 KB) and rationale. Optional, but it makes the judgement usable as a rule.
Category Dashboard label Sentiment
good_call Good call good
wrong_tool Wrong tool bad
wrong_arguments Wrong arguments bad
unnecessary_step Unnecessary step bad
missing_step Missing step (needs position: before) bad
wrong_order Wrong order bad
misread_input Misread the input bad
unsupported_claim Claim not backed by data bad
should_have_stopped Should have stopped or asked bad
should_have_continued Stopped too early bad

good_call must be good and every other category must be bad; a mismatch answers 400.

A judgement remembers what the agent was when the run happened, so it stays meaningful after the agent changes.

What a judgement looks like

Besides the fields you sent, a judgement carries:

Field Meaning
use What it is doing for later runs: in_use, waiting, off, made_rule or expired. See Feedback steers later runs.
use_set_by, use_set_at Who last turned it on or off, and when.
can_set_use Whether you may turn it on or off.
rules The rules made from it: [{ "playbook_uuid", "version", "assignment_uuid", "rule_id", "title" }]. Empty when none.

Read, change and remove

  • GET /runs/{uuid}/feedback lists a run's judgements: { "data": [...], "total": n }.
  • PATCH /feedback/{uuid} changes sentiment, category, comment or should_have; fields you leave out stay. Only the author may change it (403 only the author can change this feedback).
  • DELETE /feedback/{uuid} removes it. The author may, and so may anyone with workforce::manage.
  • A judgement that is a rule now cannot be changed or removed: both answer 409 This feedback is a rule now. Remove the rule from its version first.
  • GET /playbooks/{uuid}/feedback?node=&limit= lists the judgements on a playbook's runs, newest first. node keeps one step's. GET /assignments/{uuid}/feedback?limit= does the same for an assignment's runs. limit is at most 100 (default 50).

Summaries and exports

  • GET /playbooks/{uuid}/feedback/summary and GET /assignments/{uuid}/feedback/summary count the judgements: { "steps": [...], "run": {...} }. Each step (and the run as a whole) has good, bad, by_category and, for steps, worst_tools.
  • GET /feedback/export streams every judgement as JSON Lines, one per line, filtered by agent, from and to (RFC 3339 times or YYYY-MM-DD dates; a date as to includes that whole day) and paged with cursor.

Feedback steers later runs

Feedback on a playbook step is given to that step on later runs: the 10 newest notes on the step, plus the 3 newest on the run as a whole. An assignment that runs no playbook works the same way, with its own steps and runs.

Feedback is given only while it is in use, and only for 90 days.

Whose feedback steers

Feedback steers on its own when its author is a person who:

  • holds workforce::manage, and
  • may use the agent.

For the built-in agent Prota, the author must also be an Owner or Maintainer.

Anyone else's feedback is saved and shown, but it waits: it is not given to the agent until a manager turns it on.

The states

use Meaning
in_use Given to later runs of the step.
waiting Written by someone whose feedback does not steer on its own. Nobody has chosen yet.
off A manager chose Stop using it.
made_rule A rule was made from it, in any version of the playbook or on the assignment. It is the rule now: it is no longer given as feedback to any run, and it leaves the playbook's and assignment's feedback lists and counts. Runs read the rule wherever a version holds it.
expired Older than 90 days. It stays on record but is no longer given.

Use it and Stop using it

A person who holds workforce::manage and may use the agent can change a judgement's use:

POST /feedback/{uuid}/use
{ "on": true }

on: true is Use it and on: false is Stop using it. The answer is the judgement, with use, use_set_by and use_set_at updated. can_set_use says whether you may. Without workforce::manage the answer is 403 Only a person who manages agents can turn feedback on or off.; on Prota, only an Owner or Maintainer may (403 Only an Owner or Maintainer can decide what Prota waits on.). Feedback that is already a rule answers 409 This feedback is a rule now. Change the rule instead.


Rules

A rule is standing guidance for the work, written as a short instruction with a title and, optionally, a reason. It is given to the agent at the step it applies to, on every run.

These are guidance rules for an agent, not the true-or-false rules a condition decides by.

Rules do not belong to the agent. They belong to the work: a playbook version, or an assignment.

Rules on a playbook version

A playbook version's drawing has a rules list next to nodes and edges:

{
  "nodes": [ ... ],
  "edges": [ ... ],
  "rules": [
    {
      "id": "",
      "step": "pay",
      "title": "Pay the gross total",
      "rule": "Use the gross invoice total, never the net amount.",
      "why": "Suppliers are paid gross; net underpays them."
    }
  ]
}
Field Meaning
id Leave it empty on a new rule; the server gives one. Keep it on a rule you resend.
step The step the rule is for. Empty means every step.
title Required, up to 120 characters.
rule What to do. Required, up to 1000 characters.
why Why. Optional, up to 1000 characters.
source, added_by, added_at Set by the server: who added it and when, and the feedback it came from. What you send in these is ignored.

Rules fork with versions: a new version starts with a copy of its source's rules, and deploy and rollback carry them along with the version. A rule you add to one version does not change another.

A version holds at most 20 rules. Saving accepts more, so a half-finished drawing can be saved, but validation and deploy refuse them.

A step that decides by rules never reads rules, so a rule cannot be put on it.

Rules on an assignment

An assignment that runs no playbook can hold its own rules, at most 20, with no step:

PATCH /assignments/{uuid}
{ "...": "...", "rules": [ { "title": "Cite the invoice", "rule": "Name the invoice number in the summary." } ] }

Leave rules out and the assignment keeps the ones it has. An assignment that runs a playbook cannot have its own: Put them on the playbook.


Make feedback a rule

A manager can turn a judgement into a rule. It needs workforce::manage (and, on Prota, an Owner or Maintainer). The judgement must be on a playbook run or an assignment run.

From a playbook run

POST /feedback/{feedback uuid}/promote
{
  "version": "1.3",
  "title": "Pay the gross total",
  "rule": "Use the gross invoice total, never the net amount.",
  "why": "Suppliers are paid gross; net underpays them."
}
Field Meaning
version The version that gets the rule.
fork { "version": "1.4", "note": "..." }. Instead of changing version, fork a new version from it and add the rule there.
scope Optional. It follows from the judgement: feedback on a step becomes a rule for that step, and feedback on the whole run becomes a rule for every step. A different scope answers 422 Feedback on a step becomes a rule for that step. or 422 Feedback on the whole run becomes a rule for every step.
title, rule, why The rule, with the limits above.

The answer is 201:

{ "playbook_uuid": "...", "version": "1.4", "rule_id": "..." }

The version that runs in Live cannot be changed. Promoting into it answers 409 This version runs in Live. Add the rule to a new version instead. Fork a new version, then deploy it when you are ready. A version that already holds a rule from the same judgement answers 409 This version already has a rule from this feedback., and a judgement that is already a rule in another version answers 409 This feedback is already a rule in version 1.4.: change that rule instead.

Feedback on a step that decides by rules cannot become a rule, because that step reads none: 400 This step is decided by rules, so it can't have rules of its own.

From an assignment run

POST /feedback/{feedback uuid}/promote
{ "title": "Cite the invoice", "rule": "Name the invoice number in the summary.", "why": "" }

Only the text: the rule goes onto the assignment. The answer is 201:

{ "assignment_uuid": "...", "rule_id": "..." }

A second rule from the same judgement answers 409 This assignment already has a rule from this feedback. Feedback on a run that followed neither a playbook nor an assignment answers 409 and cannot become a rule.

Once a rule is made from a judgement, the judgement reads made_rule, and its rules list says where the rule went. Runs still list it in GET /runs/{uuid}/feedback. If the rule is removed from every version and assignment that held it, the judgement is ordinary feedback again.


What a run records

A step that the agent thinks through records what it was given:

Field Meaning
feedback_given The feedback given to it: uuid, run_uuid, step_index, sentiment, category and the comment (cut to 200 characters).
rules_given The rules given to it, by id, title and step: which rules, not their text.
earlier_notes The notes passed on from earlier steps: the earlier step's name (step) and how many notes (count), not the notes themselves. Steps with no notes are left out.

Both are in the think step's input, in GET /runs/{uuid}/steps/{index}.

All rule and feedback changes are written to the activity ledger (GET /activity).