Get release news

Constle documentation

Constle enforces an AI agent's rules from outside the agent: the hosts it can reach through the proxy and, for calls that pass through the gate, the approvals and the caps on priced tools that you set. The agent runs inside. The rules don't.

On this page

Important

Before you rely on it

Constle is early, and its interfaces may change between releases. Read Known limitations before you rely on any of this.

Note

Release status

The docs are live. The current source and its signed releases aren't public yet. More in Project status.

You declare the policy in one YAML file, the Agentfile. Constle runs the agent in a sandbox that reaches the internet through an allowlisting proxy. On Docker, the agent's network has no route out, and your host has no address on it. DNS through Docker's own resolver is untested. On Firecracker, the host drops everything but the proxy and its gates. Name a tool, and its calls that pass through the gate wait for a yes. Price an MCP server and set a cap. Among calls that pass through the gate, the one that crosses the cap is the last one through, and the run stops. With an identity, each line of the audit log is signed with the agent's own key and chained to the one before. None of it runs in the agent's process, and what the agent is allowed to do doesn't change while it runs. Traffic to hosts you allow isn't gated. If an allowed host shares a server with an MCP server, a request can reach that MCP server past the gate (limitation 2).

How a request moves through Constle, and what goes into the logAGENT · SANDBOXAgent processSquid proxychecks network.allowed_hostsALLOWEDBLOCKEDMCP gate proxychecks human_gates.require_approval_forHumanterminal · signed webhookAPPROVEDDENIED / TIMEOUTno decision:on_timeout: abortforwardedinternal/audit/Signed, hash-chained audit logAllows, blocks and gate decisions the proxy and gates see, signed with an identity.Both outcomes are logged the same way: the block is how you find out it happened. How a request moves through Constle, and what goes into the logAGENT · SANDBOXAgent processSquid proxychecks network.allowed_hostsALLOWEDBLOCKEDMCP gate proxychecks human_gates.require_approval_forHumanterminal · signed webhookAPPROVEDDENIED / TIMEOUTno decision: on_timeout: abortinternal/audit/Signed, hash-chainedaudit logAllows, blocks and gate decisions the proxyand gates see, signed with an identity.Both outcomes are logged the same way: the blockis how you find out it happened.
Request flow · the proxy and the MCP gate, outside the agent, and one audit log
Text description

The agent process runs in the sandbox. The proxy and the MCP gate it sends its calls to sit outside the agent.

Network calls go to the Squid proxy, which checks network.allowed_hosts and marks each one ALLOWED or BLOCKED.

Tool calls that pass through the gate are checked at the MCP gate proxy against human_gates.require_approval_for, and with gates on, a matching call goes to a human at the terminal or through a signed webhook. APPROVED calls are forwarded. DENIED calls are refused, and a gate with no decision by its deadline is resolved by on_timeout: under the default abort the call is refused and the run stops (under proceed it would be forwarded without approval).

Allows, blocks and gate decisions the proxy and gates see are written by internal/audit/ to the audit log under ~/.constle/logs/, signed and hash-chained when the agent has an identity. Network events are written when the run ends, and the run’s last moments can be missing. Both outcomes are logged the same way: the block is how you find out it happened.

Constle has three layers, all on the host, outside the sandbox. The quickstart walks through validating, running and verifying an agent under enforcement, with its output, abridged.

Enforcement, demonstratedLink to this section

An agent whose Agentfile declares allowed_hosts: [api.groq.com] reaches for one declared host and one undeclared one. The output is abridged: real log entries also carry timestamp, run_id and agent_name, plus did, prev_hash and sig when the log is signed.

Output
  ┌─ agent output ──────────────────────────
  │ https://api.groq.com/        CONNECT allowed   TLS tunnel opened, server replied
  │ https://evil.example.com/    CONNECT refused   Tunnel connection failed: 403 Forbidden
  └─────────────────────────────────────────

$ grep '"event":"network_' ~/.constle/logs/egress-probe-$(date -u +%F).jsonl
{"event":"network_allowed","details":{"bytes":5314,"host":"api.groq.com","http_status":200,"method":"CONNECT"}}
{"event":"network_blocked","details":{"bytes":3404,"host":"evil.example.com","http_status":403,"method":"CONNECT"}}

The proxy refused the second request and never opened its tunnel. Both attempts are in the audit log, copied from the proxy's log when the run ends. The blocked one is how you find out it happened. Raw-IP bypass attempts, IPv6 and the DNS trust boundary are covered in Network isolation.

What Constle enforcesLink to this section

Eight capabilities.

What Constle enforces: eight capabilitiesCAPABILITYMECHANISMSTATUSSandboxed executionFirecracker microVM or two-network Docker sandbox. Failsclosed rather than silently running on a weaker boundary.IMPLEMENTEDNetwork egressSquid proxy allowlist, name-based matching. Raw-IP bypassis blocked too. Allows and blocks the proxy sees arelogged when the run ends.IMPLEMENTEDMax durationAgent is killed when max_duration_seconds elapses,recorded as terminated_by_limit.IMPLEMENTEDAudit logJSONL per agent per day. With an identity, signed andhash-chained, and constle audit verify names a changedline.IMPLEMENTEDSpending limitsPer-run / per-day USD caps on calls that pass through thegate to priced MCP servers. Counted after each call. Thedaily cap needs an identity.IMPLEMENTEDHuman gatesNamed tool calls that pass through the gate wait forapproval. With no decision, on_timeout decides (defaultabort).IMPLEMENTEDCryptographic identitydid:key (the W3C CCG method), Ed25519. Private key neverenters the sandbox. Fails closed if missing.IMPLEMENTEDAgent-to-agent messagingSigned envelopes to declared peers only. No discoverymechanism, by design.IMPLEMENTED What Constle enforces: eight capabilitiesCAPABILITY · STATUSSandboxed executionIMPLEMENTEDFirecracker microVM or two-network Dockersandbox. Fails closed rather than silentlyrunning on a weaker boundary.Network egressIMPLEMENTEDSquid proxy allowlist, name-based matching.Raw-IP bypass is blocked too. Allows and blocksthe proxy sees are logged when the run ends.Max durationIMPLEMENTEDAgent is killed when max_duration_secondselapses, recorded as terminated_by_limit.Audit logIMPLEMENTEDJSONL per agent per day. With an identity, signedand hash-chained, and constle audit verify namesa changed line.Spending limitsIMPLEMENTEDPer-run / per-day USD caps on calls that passthrough the gate to priced MCP servers. Countedafter each call. The daily cap needs an identity.Human gatesIMPLEMENTEDNamed tool calls that pass through the gate waitfor approval. With no decision, on_timeoutdecides (default abort).Cryptographic identityIMPLEMENTEDdid:key (the W3C CCG method), Ed25519. Privatekey never enters the sandbox. Fails closed ifmissing.Agent-to-agent messagingIMPLEMENTEDSigned envelopes to declared peers only. Nodiscovery mechanism, by design.
What Constle enforces · eight capabilities, all implemented
Text description

Sandboxed execution (implemented): Firecracker microVM or two-network Docker sandbox. Fails closed rather than silently running on a weaker boundary.

Network egress (implemented): Squid proxy allowlist, name-based matching. Raw-IP bypass is blocked too. Allows and blocks the proxy sees are logged when the run ends.

Max duration (implemented): Agent is killed when max_duration_seconds elapses, recorded as terminated_by_limit.

Audit log (implemented): JSONL per agent per day. With an identity, signed and hash-chained, and constle audit verify names a changed line.

Spending limits (implemented): Per-run / per-day USD caps on calls that pass through the gate to priced MCP servers. Counted after each call. The daily cap needs an identity.

Human gates (implemented): Named tool calls that pass through the gate wait for approval. With no decision, on_timeout decides (default abort).

Cryptographic identity (implemented): did:key (the W3C CCG method), Ed25519. Private key never enters the sandbox. Fails closed if missing.

Agent-to-agent messaging (implemented): Signed envelopes to declared peers only. No discovery mechanism, by design.

Each capability in more detail
Capability Mechanism Status
Sandboxed execution A two-network Docker sandbox, the default, which shares the host kernel, or a Firecracker microVM with a kernel of its own. On Docker, the agent's network has no route out, and your host has no address on it. On Firecracker, the host drops everything but the proxy and its gates. Docker by default. Firecracker when the isolation contract needs kernel, or with --backend. A declared isolation: level is a minimum: it may be stronger than the declared capabilities require but never weaker, or the Agentfile is rejected at validate time. isolation: kernel selects Firecracker and the run fails closed if Firecracker is unavailable, unless an operator explicitly accepts a weaker boundary with --accept-isolation=<level>, which is named and recorded. Implemented
Network egress A Squid proxy allowlists network.allowed_hosts: through the proxy, the agent reaches only the hosts you list. Matching is name-based (dstdomain) with reverse lookups off, so a raw IP is denied unless that IP is itself listed, including the real IP of an allowed host and an address whose PTR record names one. Destinations in loopback, link-local, metadata and private ranges are refused on the resolved address, and CONNECT is confined to 443. Allows and blocks the proxy sees become audit events when the run ends. The last moments can be missing (limitation 6). On the Docker backend, the agent's network is created with the isolated-gateway option, and a Docker Engine that cannot provide it is refused. On Docker, DNS through Docker's own resolver is untested. Implemented
Max duration The agent is killed when limits.max_duration_seconds elapses, and the kill is recorded as terminated_by_limit. Implemented
Audit log JSONL per agent per UTC day. With identity.did set, every entry is Ed25519-signed and hash-chained. constle audit verify checks every entry's signature and its link to the entry before it, and reports the line that fails. A gate decided over the signed webhook also records the approver's signed decision, which constle audit verify --agentfile=… re-verifies. Caveats: limitation 6. Implemented
Spending limits Spending is a meter, not a bill: the usage each priced MCP server reports, times the price you declare. The max_per_run_usd and max_per_day_usd you set cap priced tool calls that pass through the gate, metered against each server's declared pricing. The daily cap needs identity.did and a priced server. Costs are counted after each call, so spending can pass a cap before the run is stopped. Each overlapping run of one identity can pass the daily cap by one call. The daily ledger is durable across runs, keyed by DID so a rename can't reset it. A priced server's successful reply that omits a declared usage value stops the run. Scope caveats: limitations 2 and 3. Implemented
Human gates Declared MCP servers are reached through a protocol-aware gate proxy. Tool calls go through the tool checks. The handshake, ping, tools/list, notifications and responses pass. Resource, prompt, completion and logging requests pass only if the server's methods list names them, and any other request the agent sends is refused. What the server sends, its own requests included, is relayed without method checks. Gates are off until human_gates.enabled: true. A named tool's calls that pass through the gate pause for approval at the terminal and, with approver_pubkey set and a notify webhook URL resolving, at a signed decision channel too. The first decision wins. A decision that arrives is verified, and one that fails any check can only deny. With no decision by the deadline, on_timeout decides (default abort). Caveats: limitations 1, 2 and 9. Implemented
Cryptographic identity did:key (the W3C CCG method, Ed25519). The private key stays at ~/.constle/identities/<name>/ (mode 0600) and never enters the sandbox. constle run fails closed on a declared DID with no local key. Implemented
Agent-to-agent messaging Signed envelopes to explicitly declared peers only. The host signs and verifies. The sandbox does no cryptography and is never given a peer's real endpoint. No discovery mechanism exists, by design. Replay caveat: limitation 4. Implemented

All three layers run on the host, outside the sandbox. The agent's private key never enters the sandbox, and Constle never passes your MCP servers' real addresses or your A2A peers' real endpoints into it. API keys you declare under credentials do: they are passed in as environment variables. Constle is not a framework: it doesn't decide how an agent reasons or plans. On Docker, the agent is an ordinary container image. Its HTTP client must use the proxy it's given, and it reaches MCP servers at the CONSTLE_MCP_<ID>_URL it's given. More in What Constle is not and Why Constle.

Find your way aroundLink to this section

The guides start from one job each: write an Agentfile, limit where the agent can send data, approve named MCP tool calls that pass through the gate, cap priced tools, verify a log.

Getting started

Guides

How it works

Reference

Project