Not in a published release yet. These adapters ship in the next SDK release (Python
tracelane and npm @tracelanedev/sdk, after 0.4.0, unreleased). Until then, install from source in the open-source repository.Approval holds for MCP tool calls are a Preview and are turned on per workspace. The adapters below are Preview too, and none of them is published to PyPI or npm yet. Their tests and examples run against a mock gateway, not a real workspace. The frameworks do not provide any of this themselves, and we make no claim about what they guarantee.
Before you start
Follow Protect a payment tool first: it creates the API key (MCP scope), the tool server and the policy these adapters call. A protected tool needs the Streamable HTTP transport.How a call flows
- The adapter sends
tools/calltoPOST /v1/mcp/<server>with your API key and anIdempotency-Keythat is a new UUID for each distinct call. - If the policy holds it, the gateway answers
409 approval_required. The adapter waits for the decision inside the tool call, or, in LangGraph, pauses the graph withinterrupt(). - After approval the adapter retries the same call with the same key and the approval id. If the arguments changed, the adapter treats it as a new call: a new key, no approval id, and the gateway holds it again.
- A denied, expired, mismatched or wrong-reviewer answer (for example
403 separation_required) is passed back as a refusal. The tool does not run. An approval that was already used (approval_consumed) is different: an identical call may have performed the action, so it is worded “may have run” and its key is kept. If the request fails before it is sent (connection refused, DNS), nothing ran. If it times out or resets after it was sent, or the gateway answers 5xx or reports the outcome as unknown, the action may have run: the adapter keeps the sameIdempotency-Key, so a retry replays that call instead of creating a new hold, and the model is told to check Tracelane before retrying. A call the gateway ran is reported as performed with its execution id; a failed one is reported as failed.
resolve() (Python resolve(name, arguments, scope=..., principal=...), TypeScript resolve(name, args, scope, principal)) after checking Tracelane. resolve() drops the key, so the next identical call is a new call; use it only once a person has reconciled the earlier one. The adapter remembers at most 1,024 in-flight calls and drops the oldest one that did not run first. If all 1,024 may have run, it refuses a new call and says why.
scope only separates this adapter’s local key cache. It is not sent to the gateway. To keep end users’ approvals apart at the gateway, pass principal (sent as the tracelane-principal header). One adapter shared by several users must pass both, as scope= and principal= on call/attempt/langgraph_tool_call, or as scope(ctx) and principal(ctx) functions on the framework adapters (openai_agents_tool, pydantic_ai_tool, google_adk_tool, gatewayExecute, vercelAiTool, claudeAgentToolHandler). Otherwise use one adapter per run. The default request timeout is 130 seconds. The gateway can spend up to 120 seconds in each of its reserve, forward and finish steps, so a slow call can still return “may have run”.
principal is an end user’s token and is checked before anything is sent: it must be a compact token of three dot-separated parts, at most 8,192 characters, with nothing trimmed. Anything else is refused as principal_malformed without sending a request, and the error never contains the value. The local key cache is keyed by scope, principal and call, so two principals under one scope never share a key.
OpenAI Agents SDK (Python)
pip install "tracelane[openai-agents]". needs_approval is left off on purpose: the SDK’s own approval is a yes or no inside your process, and here Tracelane decides. The run waits inside the tool call, up to wait_timeout (300 seconds by default). A refusal comes back to the model as text, and the run continues: “not performed” only when nothing can have run, otherwise “may have run; check Tracelane before retrying”.
OpenAI Agents SDK (TypeScript)
LangGraph (Python)
pip install "tracelane[langgraph]". A held call raises interrupt() with {"type": "tracelane.approval_required", "approval_id": ...}. Resume with Command(resume={"decision": "approved"}) after wait_for_decision returns approved; any other answer ends the call as not approved, except consumed (the approval was already used), which ends it as “may have run” and keeps the key. LangGraph runs the node again on resume, and the adapter reuses the same key, so that run is the retry. The key and approval id are kept in memory. After a restart the adapter sends the same call with no approval id, and the gateway looks for an unexpired, unconsumed approval for the same requester, call and policy: it returns the existing pending one (the same approval id) or, if it was already approved, runs the call. If a denied approval exists for the same call, the retry gets approval_denied. If there is none, it opens a new hold. A call that was already sent under the lost key is not replayed, so check Tracelane for a call that may have run. Keep side effects out of the node before the call.
CrewAI (Python)
args_schema is the pydantic model the model fills in; CrewAI validates against it first and the adapter sends the validated arguments. CrewAI gives a tool no run context, so scope and principal are fixed strings: build one tool per user or run when they differ. The tool answers through _run and _arun, and the run waits inside the call.
Pydantic AI (Python)
Tool.from_schema, so the model sees your JSON parameters. scope(ctx) and principal(ctx) receive the run’s RunContext.
Google ADK (Python)
str, int, float, bool, list, dict). A tool_context parameter is handed to scope(tool_context) and principal(tool_context) and is not sent to the gateway.
Vercel AI SDK (TypeScript)
toolApproval off for this tool: the SDK’s own approval is a local yes or no. scope(options) and principal(options) receive the options object the SDK passes to execute.
Claude Agent SDK (TypeScript)
isError: true for every refusal. It governs only the tool you register: the SDK’s built-in tools are not routed through Tracelane, so leave the ones you do not want in disallowedTools.
Refusals you may see
From the gateway (its own code, in the responseerror): approval_denied, approval_expired, approval_mismatch, approval_not_approved, idempotency_mismatch, separation_required, control_changed, key_revoked, principal_required, principal_invalid, mcp_tool_definition_changed, protected_execution_unavailable and the other refusal codes of the protected endpoint.
Added by the adapter: approval_pending (still pending after an approved answer), approval_timeout (the wait deadline passed; the approval may still be pending), approval_consumed (the approval was already used; the action may have run), http_NNN (a status with no gateway code), execution_failed and execution_unknown (from the receipt state; unknown includes in-flight), invalid_response (a 200 that could not be read), tool_error (a non-protected tool reported an error) principal_malformed (the principal failed the check above) and unconfirmed_calls_limit (1,024 earlier calls may have run).
The model is told “not performed” only when nothing can have run. Every code above except the pre-send failures can carry the “may have run; check Tracelane before retrying” wording once the call may have run. The adapter never includes the response body or your key.