Skip to content

Requests

Answering a request

answer_interaction answers a request over MCP. Over HTTP it is POST /v1/orgs/{org}/playbooks/{playbook}/runs/{run_id}/answer. It takes the run_id of the interaction function's run, which list_interactions shows, and the answer:

json
{ "answer": { "verdict": "approve", "note": "Ready to launch." }, "claimed_for": "the campaign team" }

A person often answers in a conversation with their agent: they approve, reject, ask for changes, or say it in other words. The agent then calls answer_interaction on the request's run_id, with the answer in the shape of the request's answer_schema:

  • list_interactions shows the answer_schema beside the run_id. It is the function's output.schema as it stood when the request was asked. Once the function has changed, get_definition no longer shows it.
  • For a function whose answer has a verdict of approve or revise and an optional note, the person's "approve" is { "verdict": "approve" }, and "revise: name the job role" is { "verdict": "revise", "note": "Name the job role." }. A function with another output.schema takes its own shape, whatever words the person used: for a function whose answer has a decision of approve, revise or skip and an optional note, it is { "decision": "approve" }.
  • This holds for a request held for an agent and for one sent through a tool, such as a chat's.
  • Running the function or its workflow again answers nothing: it makes a new request, the first stays open until it expires, and the run that waits for it goes on waiting.

Rules of an answer:

  • A caller that may write to the playbook can answer.
  • The answer is checked against the answer schema the request recorded.
  • It is recorded on the run as one fact, request_answered, with the answer and claimed_for. claimed_for is whom the caller says it answers for: a claim the runtime keeps and never checks. The fact records the caller and the time itself.
  • answer_interaction returns that fact: the run_id, the answer_id of the fact (which get_event reads), the answer, claimed_for, answered_by (the caller who answered, by id and name) and answered_at.
  • The request leaves the open requests at once. The run takes the answer within about a second (the server checks waiting runs every second by default). It succeeds with the answer as its output, settled as the caller that answered.
  • An answer that does not match is invalid_input, with a pointer under /answer for each problem, and leaves the request open.
  • The same answer sent again returns the fact the run took. A different answer is conflict, since a run takes one answer.
  • An answer to a request that has ended, or whose run was asked to cancel, is conflict, and so is an answer to a notification.

Listing requests

list_interactions, or GET /v1/orgs/{org}/playbooks/{playbook}/interactions over HTTP, lists the playbook's open requests, newest first. An answered request leaves the list. Each request shows:

  • the run_id, and the type, the name and the version of the function that asked;
  • to, and the delivery: the tool the request is sent through, or null for a request held for an agent;
  • the message, whether it takes an answer, and when it was asked and expires;
  • the attempts made, and how its delivery stands: held_for_an_agent, to_deliver, delivering, delivered, retrying, undelivered, or cancelling once a cancel of its run was asked;
  • its answer_schema, the JSON Schema an answer is checked against as the request recorded it, or null for a notification;
  • for a request answered by reply, the conversation the playbook reads, its answerer and how many of its replies were refused.

Filters:

  • to keeps the requests to one party;
  • type keeps those of one type of function;
  • function keeps those of functions of one name. A name is unique within its type, so function with type names one function.

The list pages with limit and cursor. Every reader of the playbook sees each party and message, as a run's input is seen.