Skip to content

Agent Policy & Approvals

The agent policy decides what an AI agent connected through recon mcp may send. Each network call is allowed, denied, or held until a human approves it. Use it to let an agent read freely while you keep mutating calls, production environments and sensitive hosts under your control.

The policy applies only to MCP tool calls. recon send, recon test, the web studio and the other CLI commands ignore it.

recon init --demo writes a workspace that requires approval for every mutating agent call:

[agent_policy]
allow_read_only = true
allow_local_mutations = true
require_approval_for_mutations = true
approval_timeout_secs = 60
require_approval_envs = []
allow_mutating_envs = []
allow_load_envs = []
blocked_hosts = []

Start the web studio in that workspace with recon ui, and connect an agent to recon mcp in the same workspace. When the agent calls recon_send_request with {"request":"Create Enrollment","env":"local"}, the call waits and a pending approval appears:

Terminal window
curl -s "http://127.0.0.1:4210/api/v1/agent/approvals?status=pending"
{
"approvals": [
{
"actor_label": "mcp-agent",
"decided_at_utc": null,
"decided_by": null,
"decision_note": null,
"env_name": "local",
"expires_at_utc": "2026-11-30T16:01:59.347327791+00:00",
"id": "01a22d30-23d3-7329-b69d-53db1ff63d15",
"method": "POST",
"reason": "Mutating POST request to `127.0.0.1` in env `local` requires live operator approval under `agent_policy`.",
"request_name": "Create Enrollment",
"seq": 4,
"status": "pending",
"tool_name": "recon_send_request",
"ts_utc": "2026-11-30T16:00:59.347327791+00:00",
"url": "http://127.0.0.1:4210/_sandbox/local/v1/enrollments"
}
]
}

Approve it. Mutating routes need the session token from the recon-token meta tag of the page recon ui serves:

Terminal window
curl -s -X POST "http://127.0.0.1:4210/api/v1/agent/approvals/01a22d30-23d3-7329-b69d-53db1ff63d15/decide" \
-H "X-Recon-Token: $TOKEN" -H 'content-type: application/json' \
-d '{"approved": true, "note": "looks fine"}'
{"approval":{"actor_label":"mcp-agent","decided_at_utc":"2026-11-30T16:00:59.852962784+00:00","decided_by":"human","decision_note":"looks fine","env_name":"local","expires_at_utc":"2026-11-30T16:01:59.347327791+00:00","id":"01a22d30-23d3-7329-b69d-53db1ff63d15","method":"POST","reason":"Mutating POST request to `127.0.0.1` in env `local` requires live operator approval under `agent_policy`.","request_name":"Create Enrollment","seq":4,"status":"approved","tool_name":"recon_send_request","ts_utc":"2026-11-30T16:00:59.347327791+00:00","url":"http://127.0.0.1:4210/_sandbox/local/v1/enrollments"}}

The agent’s call then completes with an airlocked response:

{
"airlocked_body": "{\n \"course\": \"CS-401\",\n \"id\": \"enr_2026_091\",\n \"status\": \"enrolled\",\n \"student_id\": \"007218\",\n \"timestamp\": \"2026-11-30T16:01:00.104615633+00:00\"\n}",
...
"masked_paths": [
{
"path": "$.student_id",
"strategy": "id"
}
],
...
"status": 201,
...
}

If you deny it with {"approved": false, "note": "not during finals week"}, the agent gets an error instead:

E_AGENT_APPROVAL_DENIED: not during finals week

The policy lives in the [agent_policy] table of .recon.toml. Every field is optional. If the table is missing, all defaults apply. recon init writes the table with the defaults.

Field Type Default Meaning
allow_read_only bool true Allow GET, HEAD and OPTIONS calls. When false, every non-mutating call is denied.
allow_local_mutations bool true Allow mutating calls whose host is localhost, 127.0.0.1 or ::1.
require_approval_for_mutations bool false Hold every permitted mutating call for human approval.
approval_timeout_secs integer 60 How long a held call waits. Values below 1 are treated as 1.
require_approval_envs list of env names [] Environments where every call, read-only or mutating, needs approval. Case-insensitive.
allow_mutating_envs list of env names [] Environments where mutating calls are permitted against any host. Case-insensitive.
allow_load_envs list of env names [] Environments where recon_load_test may target a non-loopback host. Case-insensitive.
blocked_hosts list of host patterns [] Hosts an agent may never call, for any method.

Mutating means any method other than GET, HEAD and OPTIONS.

blocked_hosts patterns use the same matching as secret allowed_hosts: * matches every host, *.example.com matches example.com and any subdomain, and anything else must equal the host exactly. Matching is case-insensitive and ignores the port. See Outbound Secret Firewall.

Each MCP tool call reads .recon.toml again, so policy changes apply to a running recon mcp without a restart.

Recon takes the method, environment name and fully resolved URL of the call and checks, in order:

  1. The URL does not parse: deny.
  2. The host matches a blocked_hosts pattern: deny.
  3. The method is read-only:
    • allow_read_only is false: deny.
    • The environment is in require_approval_envs: require approval.
    • Otherwise: allow.
  4. The method is mutating. It is permitted only if the host is loopback (localhost, 127.0.0.1, ::1) and allow_local_mutations is true, or the environment is in allow_mutating_envs. Otherwise: deny.
  5. A permitted mutating call needs approval if require_approval_for_mutations is true or the environment is in require_approval_envs. Otherwise: allow.

A deny always wins over an approval requirement. No approval can unlock a blocked host or a forbidden mutation.

Every outcome produces a reason string. These are the exact formats:

Outcome Reason
Invalid URL invalid URL `<url>`
Blocked host host `<host>` matches agent_policy.blocked_hosts `<pattern>`
Read-only disabled agent_policy.allow_read_only is disabled
Read-only in an approval env env `<env>` is listed in `agent_policy.require_approval_envs` and requires human approval before <METHOD> `<host>`
Mutation not permitted Agent guardrail blocked mutating <METHOD> call against env `<env>` (`<host>`). Only loopback targets or envs explicitly listed in `agent_policy.allow_mutating_envs` permit mutations.
Mutation needs approval Mutating <METHOD> request to `<host>` in env `<env>` requires live operator approval under `agent_policy`.
Tool Method used for the check
recon_send_request The request’s method. For an ad-hoc url, the method argument, default GET.
recon_twin_run The request’s method, checked once for each of the two environments.
recon_run_flow Each step’s method. See below.
recon_load_test The request’s method, then a separate load check. See below.
recon_paginate, recon_sse_stream The request’s method.
recon_ws_exchange GET with no messages, POST with messages. A ws:// or wss:// URL is checked as http:// or https://.
recon_graphql POST if the operation is a mutation, otherwise GET. An operation is a mutation when its first word, after dropping # comment lines, is mutation (any case). Introspection is always GET.
recon_grpc_call Always POST, so a remote gRPC call is denied unless its environment is in allow_mutating_envs.

Tools that only read local data, such as recon_latest_runs, recon_inspect_run or recon_verify_airlock, are not checked.

Before a flow starts, every step that can be resolved without captured variables is checked, and approvals are requested one at a time. Steps that cannot be resolved yet are skipped in this pre-check. While the flow runs, each step is checked again against its final URL. At that point a deny fails the step with E_AGENT_POLICY_DENIED: <reason>, and a step that needs approval runs without a second prompt.

recon_load_test accepts total_requests from 1 to 500 (default 50) and concurrency from 1 to 25 (default 5). Values outside these ranges are rejected before any policy check:

E_AGENT_POLICY_DENIED: MCP recon_load_test caps total_requests at 1..=500 (requested 1000); use CLI `recon load` for unbounded suites.
E_AGENT_POLICY_DENIED: MCP recon_load_test caps concurrency at 1..=25 (requested 50).

After the normal method check, a load check runs: blocked hosts are denied, loopback hosts are allowed, environments in allow_load_envs are allowed, and everything else is denied:

E_AGENT_POLICY_DENIED: Agent guardrail blocked load test against env `local` (`api.example.com`). Only loopback targets or envs explicitly listed in `agent_policy.allow_load_envs` permit load testing.

The load check is not written to the activity log. The log shows the method check, which was allowed in this example.

When a call needs approval, recon mcp:

  1. Writes a pending row to the agent_approvals table in .recon/flight.db, with an expires_at_utc of now plus approval_timeout_secs. Tracked secrets in the URL are replaced with [SECRET:<label>].
  2. Logs a pending_approval activity event.
  3. Checks the row every 250 ms until it is decided or the timeout passes.

Anyone with access to the same workspace’s flight.db can decide it. In practice that is the web studio started with recon ui in the same workspace. A decision can only change a pending row. Deciding a row that is already approved, denied or expired returns it unchanged.

The agent then gets one of:

Result What the agent receives
Approved The normal tool result. The activity log records approved with your note as the reason.
Denied E_AGENT_APPROVAL_DENIED: <note>, or E_AGENT_APPROVAL_DENIED: Denied by human operator without a note.
Timed out E_AGENT_APPROVAL_TIMEOUT: approval `<id>` timed out after <n>s without human decision. The row becomes expired.

With approval_timeout_secs = 2 and require_approval_envs = ["staging"], a read-only call in staging that nobody answered returned:

E_AGENT_APPROVAL_TIMEOUT: approval `01a22d30-b56c-7614-87f0-1cb0c4fecd46` timed out after 2s without human decision

Every tool error is returned to the agent as an MCP result with isError: true and the message as text.

Field Meaning
id UUIDv7.
seq Row sequence number.
ts_utc, expires_at_utc Created and expiry times, RFC 3339.
actor_label Always mcp-agent.
tool_name, request_name, method, env_name, url What the agent asked to do.
reason The policy reason.
status pending, approved, denied or expired.
decided_by human when decided through the HTTP API or web studio.
decided_at_utc, decision_note When it was decided and the note given.

Stale pending rows are marked expired whenever approvals are read, listed or decided.

Every policy outcome is written to the agent_activity table:

Terminal window
curl -s "http://127.0.0.1:4210/api/v1/agent/activity?limit=2"
{
"activity": [
{
"actor_label": "mcp-agent",
"airlock_redactions": 0,
"approval_id": "01a22d30-23d3-7329-b69d-53db1ff63d15",
"decision": "approved",
"env_name": "local",
"id": "01a22d30-26c8-776e-83f5-1bc3bfdb72ef",
"method": "POST",
"reason": "looks fine",
"request_name": "Create Enrollment",
"run_id": null,
"seq": 11,
"tool_name": "recon_send_request",
"ts_utc": "2026-11-30T16:01:00.104095270+00:00",
"url": "http://127.0.0.1:4210/_sandbox/local/v1/enrollments"
},
{
"actor_label": "mcp-agent",
"airlock_redactions": 0,
"approval_id": "01a22d30-23d3-7329-b69d-53db1ff63d15",
"decision": "pending_approval",
...
}
]
}

decision is one of allowed, denied, pending_approval, approved or expired. A human denial is logged as denied with the note as reason.

Two fields are not filled in yet: run_id is always null and airlock_redactions is always 0. To find the run an agent produced, look for runs with actor agent in the Flight Recorder.

  • Banner. While approvals are pending, a banner shows AGENT APPROVAL REQUIRED (n) with Approve, Deny and Inspect buttons. Approve and Deny act on the first pending approval in the list, without a note. Inspect opens the drawer.
  • Drawer. The top bar button labelled “Agent Activity & Approvals” shows the pending count and opens the “Agent Activity & Live Approval Gate” drawer. It lists “Pending Approvals (n)” with a note field and Approve and Deny buttons for each, and an “MCP Governance Timeline” of activity events. The command palette entry Open Live Agent Activity & Approval Gate opens the same drawer.
  • Settings. The Agent Governance tab of workspace settings edits every policy field: three checkboxes (“Allow read-only MCP calls (GET / HEAD / OPTIONS)”, “Allow mutating MCP calls against localhost / loopback”, “Require live human approval for mutating MCP calls”), an approval timeout, and comma-separated lists for the four list fields. Saving writes .recon.toml and shows “Saved Agent Governance Policy to .recon.toml”. The studio saves a timeout below 5 seconds as 5; a hand-edited .recon.toml can go down to 1.

The studio’s server checks the database every 350 ms and pushes new activity and approval changes over the /ws WebSocket as events of type agent_activity, agent_approval_requested and agent_approval_resolved.

Error text Cause
E_AGENT_POLICY_DENIED: <reason> The policy denied the call, a flow step, or a load test outside its caps.
E_AGENT_APPROVAL_DENIED: <note> A human denied the approval.
E_AGENT_APPROVAL_TIMEOUT: ... Nobody decided within approval_timeout_secs.
failed creating approval gate: <error> The approval row could not be written.

From the HTTP API:

Status Code Cause
401 E_UNAUTHORIZED POST .../decide without a valid X-Recon-Token header.
404 E_NOT_FOUND approval `<id>` not found.

See Error Codes for the full list.

  • MCP resource: recon://activity/recent returns the 40 most recent activity events and the 20 most recent approvals. See MCP Tools.
  • HTTP: GET /api/v1/agent/activity?limit=N (default 50, clamped to 1 to 200), GET /api/v1/agent/approvals?status=<status>&limit=N (default 50, clamped to 1 to 200), POST /api/v1/agent/approvals/{id}/decide with {"approved": bool, "note": "..."} (token required). POST /api/v1/workspace/config with an agent_policy object saves the policy (token required). See HTTP API.
  • Web studio: see Web Studio.