Skip to content

People in the loop

A run can stop and wait for a person. There are two reasons:

  • An approval. The agent wants to call a tool that was granted with "approval": "confirm". The call is not made until a person approves it.
  • A question. The agent cannot settle something from its instructions, the playbook or its knowledge, and asks. The work waits for the answer.

Everything waiting for a person shows in Needs you, the third tab of the dashboard's Workforce runs screen (next to History and Running).


What the person sees

Each waiting item shows:

Column Meaning
Waiting for The kind: Approval or Question, with the agent's name (and the playbook, for a playbook run).
What For an approval, the tool and the exact arguments the agent wants to call it with. For a question, the question and any options.
Environment dev or live.
Asked When the agent asked.
Time left How long until the wait expires, or expired.

Items are listed oldest first. You can filter to approvals or to questions.

Why an approval is asked

An approval item also says why you are asked. These fields come with each approval in GET /approvals. They are left out for approvals requested before they existed.

Field Meaning
intent What the agent said just before the call, up to 500 characters. Left out when it said nothing.
tool_description What the tool does, up to 300 characters.
changes_data true if the tool can change data, false if it only reads. Left out when unknown.
reason Why a person is asked: setting when someone set this tool to need approval on the agent, default when the tool asks unless told otherwise.
set_by, set_at Who set it and when, for setting, when known.
step_title The title of the playbook step the agent was working on.

The same details are on the step's approval record (GET runs/{uuid}/steps/{index}), where the reason above is called why.

For each item you can:

  • Approve, with an optional reason. The agent makes the call and the run continues.
  • Deny, with a reason that is required. The agent is told why it was refused and carries on. A denial does not end the run.
  • Answer, for a question. Your answer goes to the agent as its instruction for how to proceed. If the agent offered options, pick one or write your own.

If you don't hold the right permission the item is shown but not actionable (can_decide is false).

Who may decide

Step Who
An approval Anyone with workforce::approve who may use the step's agent.
A question Anyone with workforce::approve who may use the step's agent, and the person who started the run (who must also be able to use that agent).
Anything waiting on the Prota agent Only an Owner or Maintainer.
A step that came from a chat with an agent Only the person in that chat, and only in that chat. The API answers 409 answer it in the chat that asked for it.

A person who started the run can answer its questions with only workforce::read, as long as they may use the step's agent. Holding workforce::approve is necessary but never enough: access to the agent comes from Kortex user access, where Owners and Maintainers may use every agent.

Approvals, denials and answers are decisions for people. An agent's own token is not accepted for them, so an agent can never approve its own call.


The email

When an agent's escalation settings say so, the people and roles it names are emailed as soon as a run starts waiting:

  • <agent> needs your approval when an approval or a question is waiting. The email says what is waiting, links to the run, and says when the wait expires.
  • <agent>'s approval expired when nobody decided in time and the run was closed.
  • <agent> needs attention when the agent escalated or a paused run was closed after 7 days, always; when the run failed, if the agent's on_failure is set; and when it hit a limit, if on_budget_hit is set.

A run waiting on several things in a row sends one approval email for that stretch, not one per item. For a playbook run, the contacts of every agent that took part are told, each person once.

If the run came from a chat, a message saying the same is added to that chat.

Who gets told

An agent's escalation setting:

Field Meaning
notify_user_uuids People to email.
notify_role_uuids Roles to email.
on_approval Email when a run waits on a person.
approval_timeout_sec How long a person has before the wait expires, in seconds. At least 60. Left out or 0: 36 hours. See Expiry.
on_failure Email when a run fails.
on_budget_hit Email when a run hits a limit.

An agent that names nobody notifies nobody; the waiting item still shows in Needs you.


Expiry

Every wait has a deadline: the agent's approval_timeout_sec from the moment it asked. It is plain clock time: nights and weekends count like any other time. Left empty, the wait is 36 hours. When it passes with no decision:

  • the item is closed as expired (a step is recorded as denied, with the reason nobody decided within 1 day, or the matching duration);
  • the run ends expired with the stop reason approval_expired, and its summary says what it was waiting for;
  • the contacts get the "approval expired" email.

Time spent waiting is not counted against the run's time limit.

When one path of a playbook is waiting, the other paths keep going. An expiry on any path closes the whole run.


Approval timeout

On the agent's page, under Who to tell:

Field Meaning
Approval timeout (hours) If nobody answers in this time, the request expires. At least 1 minute. Left empty: 36 hours.

In the API this is approval_timeout_sec in escalation:

"escalation": {
  "approval_timeout_sec": 14400
}

A value under 60 answers 400.


Answer from code

POST /runs/{run uuid}/steps/{index}/approve    { "reason": "Looks right" }
POST /runs/{run uuid}/steps/{index}/deny       { "reason": "Wrong account" }
POST /runs/{run uuid}/steps/{index}/answer     { "answer": "Ana Petrovic" }
GET  /approvals?kind=approval|question

approve and deny need workforce::approve. answer needs workforce::read and is then checked as in Who may decide. reason, answer are at most 4000 characters. deny requires a reason; approve may be sent without a body.

GET /approvals returns { "data": [ ... ], "total": n }, oldest first. Each item:

Field Meaning
run_uuid, step_index Where to send the decision.
kind approval or question.
agent_uuid, agent_name, playbook_name, node_id, env What is asking.
tool, arguments For an approval, the call to approve.
step_title, intent, tool_description, changes_data, reason, set_by, set_at For an approval, why you are asked and what the call does.
question, options For a question.
requested_at, expires_at The wait.
triggered_by Who started the run.
can_decide Whether you may decide it.

A decision answers 200 with { "run": { ... } }, the run after the decision. Errors:

Status Message Meaning
400 workforce: invalid: reason / answer A required text is empty.
400 workforce: invalid: this step is <kind>, not something to <approve, deny or answer> You used the wrong call for the step: approvals take approve or deny, questions take answer.
403 You can't decide this step. Not allowed for you.
403 You can't decide this: you don't have access to this agent. You hold the permission but may not use the step's agent.
403 Only an Owner or Maintainer can decide what Prota waits on. The step is Prota's.
404 not found No such run or step.
409 this step is not waiting for a person any more Already decided, expired, or the run ended.
409 answer it in the chat that asked for it The step came from a chat.
503 decisions are temporarily unavailable Try again.

What is recorded

A step that waited on a person carries an approval block:

Field Meaning
required true.
decision pending, approved, denied or expired.
requested_at, expires_at The wait.
decided_by, decided_at, reason Who decided, when, and the reason they gave (decided_by is system when it expired or the run was closed).

Every decision is also written to the project's activity ledger (GET /activity).

A question step's output is { "answer": "...", "answered_by": "<user uuid>" }.