Guides
Human input: approvals, questions, and MCP elicitations in camelRun v2
Pause camelRun v2 runs for human answers, tool approvals, or signed MCP form and URL elicitations, then resume via /v2/agents/:idOrKey/inputs.
A camelRun v2 run can pause mid-turn and wait for human input without holding an open connection. When paused, the run's status becomes input_required, its inputs array lists the pending PendingInputView record, and an input_required event (and run.input_required webhook) is emitted.
Answering the input resumes the exact paused turn state, even hours later or from a different server process.
Ways a run pauses for input
1. The model asks a question (ask_human)
Include "human" in builtins. When the model needs clarification or confirmation, it calls ask_human({ question, options? }), creating a pending input with kind: "question".
const agent = await client.agents.upsert("ops-assistant", {
instructions: "Ask the user before choosing a deployment environment.",
builtins: ["human"],
});
let run = await agent.run("Deploy the latest build.");
if (run.status === "input_required") {
const pending = run.inputs[0];
console.log(pending.prompt); // { question: "Which environment?", options: ["staging", "prod"] }
run = await agent.answerInput(pending.id, {
approved: true,
answer: "staging",
});
}
console.log(run.text);2. Tool approval (requiresApproval: true)
Mark any custom local or HTTP webhook tool with requiresApproval: true. Before executing the tool, camelRun pauses the run with kind: "approval":
const agent = await client.agents.upsert("billing-agent", {
instructions: "Help support agents process refunds.",
tools: [
{
name: "issueRefund",
description: "Refund a charge",
parameters: {
type: "object",
properties: { chargeId: { type: "string" }, amountUsd: { type: "number" } },
required: ["chargeId", "amountUsd"],
},
url: "https://app.example.com/tools/refund",
requiresApproval: true,
},
],
});When responding to kind: "approval", you must pass an explicit boolean approved:
{ approved: true }executes the tool and continues the turn.{ approved: false }skips the tool, tells the model the action was denied, and lets the turn continue.
3. Signed MCP approval and elicitation
An MCP server configured with auth: { type: "runtime" } can pause a tool call by returning resultType: "input_required" in its JSON-RPC result with one entry in inputRequests and an optional requestState string (up to 64 KiB):
- Approval (
method: "agent-runtime/approval"): Pauses withkind: "approval". After approval, camelRun re-invokestools/callwith the originalagent-runtime/idempotencyKeyand a signedapprovalclaim ({ input, by: { id }, at }) in the runtime JWT. - Form elicitation (
method: "elicitation/create",params: { mode: "form", message, requestedSchema }): Pauses for structured form fields. Submitapproved: truewith an object inanswer(orapproved: falseto decline). camelRun resumestools/callwithinputResponses: { [key]: { action: "accept" | "decline", content } }andrequestState. - URL elicitation (
method: "elicitation/create",params: { mode: "url", message, url, elicitationId }): Pauses for an out-of-band HTTPS step (for example OAuth or checkout). Resume withapproved: true(orfalseto decline).
Responding to signed MCP inputs requires a tenant API key (cr_live_...). Scoped agent tokens (agt_tok_...) receive 403 forbidden when attempting to answer signed MCP approvals or elicitations. Keep your tenant API key on your server and verify the user's permission before calling POST /v2/agents/:idOrKey/inputs/:inputId.
Listing and answering inputs
List pending inputs
curl -s "https://run.camelai.com/v2/agents/ops-assistant/inputs" \
-H "Authorization: Bearer $CAMELRUN_API_KEY"Returns { "runs": [ RunRecord, ... ] } containing every run on the agent with unexpired pending inputs.
Respond to an input
curl -s -X POST "https://run.camelai.com/v2/agents/ops-assistant/inputs/$INPUT_ID" \
-H "Authorization: Bearer $CAMELRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"approved": true,
"answer": "staging",
"wait": true
}'| Field | Type | Notes |
|---|---|---|
approved | boolean | Required for kind: "approval". Defaults to true for kind: "question". |
answer | unknown | Answer payload for ask_human questions or form elicitation (must be a JSON object for MCP form mode). |
wait | boolean | Defaults to true (waits for the resumed turn to settle). Pass false to return immediately and watch SSE events. |
actor | string | Required (with a tenant API key) when the paused run was started with actor. Must match the run's actor, otherwise returns 403 input_actor_mismatch. |
Input lifecycle and errors
Each PendingInputView contains { id, runId, toolCallId, kind, prompt, status, expiresAt }.
- Answering an already resolved input returns
409 input_already_resolved. - Answering after
expiresAtmarks the inputexpiredand returns410 input_expired. - Answering with a mismatched
actoror missing tenant credential on an actor-bound run returns403 input_actor_mismatch. - Resolving an input emits
input_resolvedandrun_resumedon the agent's event stream.