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:
{ "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_interactionsshows theanswer_schemabeside therun_id. It is the function'soutput.schemaas it stood when the request was asked. Once the function has changed,get_definitionno longer shows it.- For a function whose answer has a
verdictofapproveorreviseand an optionalnote, the person's "approve" is{ "verdict": "approve" }, and "revise: name the job role" is{ "verdict": "revise", "note": "Name the job role." }. A function with anotheroutput.schematakes its own shape, whatever words the person used: for a function whose answer has adecisionofapprove,reviseorskipand an optionalnote, 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 andclaimed_for.claimed_foris 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_interactionreturns that fact: therun_id, theanswer_idof the fact (whichget_eventreads), theanswer,claimed_for,answered_by(the caller who answered, byidandname) andanswered_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/answerfor 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 thetype, the name and the version of the function that asked; to, and thedelivery: the tool the request is sent through, ornullfor 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, orcancellingonce a cancel of its run was asked; - its
answer_schema, the JSON Schema an answer is checked against as the request recorded it, ornullfor a notification; - for a request answered by reply, the
conversationthe playbook reads, itsanswererand how many of its replies were refused.
Filters:
tokeeps the requests to one party;typekeeps those of one type of function;functionkeeps those of functions of one name. A name is unique within its type, sofunctionwithtypenames 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.