Skip to content
Agentic Control Plane

How a call is decided

Every ACP integration lands at the same decision pipeline. That goes for the Claude Code hook, the CrewAI decorator, and the OpenAI-compatible proxy. Learn the model here. Each framework guide then comes down to wiring that framework’s tool dispatch into the pipeline.

The shape of a policy-checked call

Every tool call goes through the same six steps:

  1. Identity binds to the request. The end user’s JWT is attached with set_context(user_token=...) (Python) or withContext(...) (TS). It is the human’s token, not your service key.
  2. Pre-tool check. Before the tool runs, the SDK POSTs { tool_name, tool_input, session_id } plus Authorization: Bearer <user-jwt> to /govern/tool-use.
  3. ACP evaluates. The server verifies the JWT against your identity provider, then runs the control pipeline: immutable rules, scope intersection, ABAC, rate limits, plan limits, PII detection.
  4. Decision returns. One of allow, flag, ask, or deny, with a reason a person can read.
  5. The tool runs, or it doesn’t. Allow runs your function. Flag runs it and marks the row for review. Ask holds the call for a human, and the agent sees [ACP] Approval required: <reason> (see Approvals). Deny returns [ACP] Denied by policy: <reason>, which the LLM sees as the tool’s output.
  6. Post-tool scan. The output is POSTed to /govern/tool-output for PII, prompt-injection, and secret detection. Findings go to the audit log. If policy says redact, the redacted string replaces the output.

That is the whole model. Everything else is framework-specific plumbing.

Two install patterns

ACP enters the loop in one of two places, depending on the framework.

Pattern A: wrap the tool (@governed)

If you define tools as functions or classes, you stack a policy decorator on each tool. The check runs before your function body.

from acp_langchain import governed, set_context

@tool
@governed("web_search")
def web_search(query: str) -> str:
    """Search the web."""
    return my_search(query)

CrewAI, LangChain / LangGraph / Deep Agents, and the Anthropic Agent SDK use this pattern. The LLM call itself goes direct to your model provider.

Pattern B: proxy the LLM (OpenAI-compatible)

If the framework talks to an OpenAI-compatible client, you point its base_url at ACP. Every LLM call, and the tool calls it emits, flows through the proxy. An x-acp-agent-name header gives you per-agent attribution.

from openai import AsyncOpenAI

client = AsyncOpenAI(
    base_url="https://api.agenticcontrolplane.com/v1",
    api_key=os.environ["ACP_API_KEY"],
    default_headers={"x-acp-agent-name": "researcher"},
)

The OpenAI Agents SDK and anything else that speaks the OpenAI chat-completions API use this pattern.

You can use both at once: wrap tools and proxy the LLM. Both land in the same audit log.

Four building blocks

Every framework starter uses the same four pieces.

1. End-user JWT binding

Your service holds the service account. ACP needs the token of the human who triggered the run, so it can attribute the call to that person.

@app.post("/run")
def run(payload: Payload, authorization: str = Header(...)):
    set_context(user_token=authorization.removeprefix("Bearer ").strip())
    # ...kickoff the agent

ACP verifies this JWT on every /govern/tool-use call against the identity provider you set under Settings → Identity Provider. Firebase, Auth0, Okta, or any OIDC provider works.

2. The @governed decorator

It marks a tool as policy-enforced. Stack it under the framework’s own tool decorator so the check runs inside the tool’s dispatch:

@tool                          # framework (CrewAI / LangChain) decorator, outer
@governed("send_email")        # ACP decorator, inner
def send_email(to, subject, body):
    return sendmail(to, subject, body)

Tools without @governed are not checked. That is on purpose: control is an explicit choice, and it shows up in diffs.

3. Session IDs

Every tool call for one request shares a session_id, so the audit log groups them into one trace. The SDKs generate it for you on each set_context call, so you rarely set it yourself.

The Activity view in the dashboard uses it to show that these five tool calls came from the same user request.

4. Fail-open

If /govern/tool-use times out (5 seconds by default) or can’t be reached, the SDK returns allow with reason fail-open, and the tool runs. This is deliberate. A downed gateway shouldn’t break your agent.

The Claude Code plugin works the same way for interactive sessions. The call runs, with a loud [ACP] UNGOVERNED notice and a line in ~/.acp/lapse.log. For unattended sessions (subagent, background, and API) the plugin fails closed, so a run nobody is watching stops instead of running unchecked. The hook other harnesses use fails open unless you set ACP_FAIL_MODE=closed or write closed to ~/.acp/failmode on that machine. Framework SDKs fail open.

If you need fail-closed behavior for specific tools, set that in policy on the server.

Decisions and their semantics

Decision What happens LLM-visible
allow Tool runs. Output passes through post-scan. Yes: real tool output.
flag Tool runs. Row is marked for review. Yes: real tool output.
ask Tool is held until a human answers on the Approvals page. Approval grants one retry within the grant window. No answer counts as deny. Yes: [ACP] Approval required: <reason>.
deny Tool does not run. Agent sees [ACP] Denied by policy: <reason>. Yes: the model sees the error string and adapts.
redact A transform, not a decision. The tool runs, and the post-scan rewrites the output per policy. Yes: redacted output.
fail-open Gateway unreachable. Tool runs. Reason is noted in the audit log. Same as allow.

Each of these writes a structured row to the audit log at cloud.agenticcontrolplane.com/activity.

What’s audited

Every decision (allow, flag, ask, deny, redact, fail-open) writes one row with:

  • Actor. The end user’s sub from the JWT, not your service key.
  • Tool name. The string you passed to @governed("..."), or the framework’s tool name.
  • Decision and reason. Readable by a person and by a machine.
  • Session ID. Groups all tool calls from one request.
  • Findings. PII detected in input or output, if any.
  • Latency, cost, depth. Numbers for dashboards and budgets.

Claude Code, Cursor, CrewAI, and LangGraph all write to the same audit log, keyed by the same end-user identity. That gives you one log per person across every agent.

Inter-agent handoffs

Some frameworks pass work between agents without a tool call:

  • CrewAI has sequential task handoffs and hierarchical “delegate to coworker” tools.
  • LangGraph has supervisor-worker patterns.
  • OpenAI Agents SDK has first-class handoffs.

These don’t hit /govern/tool-use because no tool was called. Each SDK adapter has a hook for them, such as install_crew_hooks(crew). It writes synthetic Agent.Handoff audit events for the transitions. PII scanning applies, and your existing callbacks are chained, not overwritten.

Framework coverage today

Framework Pattern Controls tool calls Controls handoffs SDK
CrewAI A via @governed via install_crew_hooks acp-crewai
LangChain / LangGraph A via @governed via graph callbacks acp-langchain
Anthropic Agent SDK A via governHandlers n/a (single-agent loop) @agenticcontrolplane/governance-anthropic
OpenAI Agents SDK B via proxy per-agent via header No install, just a base_url change
Claude Code A via PreToolUse hook via delegation chain install.sh

Running coding agents? ACP records each tool call its hook sees and makes the dangerous shell commands (a force-push, destructive SQL, curl | sh) wait for you. One command, free up to 5 agents:

macOS · Linux · WSL
curl -fsSL https://agenticcontrolplane.com/install.sh | bash
Windows · PowerShell
irm https://agenticcontrolplane.com/install.ps1 | iex

What the installer writes  ·  Getting started