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.
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).
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.
┌─ 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.
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
- What is ConstleConstle lets you give AI agents real work under rules you set, enforced from outside the agent instead of trusting it to follow them.
- QuickstartValidate an Agentfile, give the agent an identity, run it in a sandbox, verify its signed audit log and gate an MCP tool call.
- Known limitationsThe cases where the runtime is weaker than the rest of these docs could lead you to assume, each traced to the code, plus what Constle leaves out by design.
- What Constle is notNot an agent framework, a cloud, a monitoring overlay, a TLS-inspecting proxy, a filesystem policy engine or a fleet platform. Where Constle stops.
- Why ConstleWhy the rules belong outside the agent, the four choices Constle makes, and what it deliberately does not do.
Guides
- All guidesTask-by-task guides: write an Agentfile, limit where an agent can send data, approve MCP tool calls that pass through the gate, cap what priced tools may cost, contain prompt injection and verify audit logs.
- Your first AgentfileWrite a first Agentfile: scaffold it, set the network, credentials, isolation and limits, read what validate tells you, and avoid the fields that do nothing.
- Limit agent egressSend an AI agent's internet traffic through a proxy that checks a list the agent cannot change, and see which exfiltration channels that closes and which it leaves open.
- MCP tool allowlistsPut each remote MCP server you declare behind a gate on your machine: its real URL is never passed into the sandbox, when you list tools only those pass the gate, and ambiguous requests are refused.
- Approval at the MCP gateMake named MCP tool calls that pass through the gate wait for a person's approval, at the terminal or with an Ed25519-signed decision, and refuse them by default when nobody answers.
- Spend caps for priced toolsSet per-run and per-day USD caps on an AI agent's priced MCP tool calls that pass through the gate, and see which spending those caps do not cover.
- Contain prompt injectionAssume an injected instruction succeeds, then limit what the agent can reach, call and receive, what its priced tools may cost, and how long it runs. One Agentfile, and the gaps it leaves.
- Agent identityCreate a did:key identity per agent, keep its private key off the sandbox, and use it to sign the audit log, key the daily spend ledger and sign A2A calls.
- Verify an agent's logGive an AI agent an identity so each line of its audit log is signed and chained, read the events that matter, and check the log offline with constle audit verify, pinned to the identity you expect.
How it works
- ArchitectureConstle’s three layers and the chokepoints where each rule is enforced, all on the host, outside the sandbox.
- Network isolationHow the sandbox's network and the Squid allowlist proxy work together on Docker and Firecracker, what they refuse, and where that stops.
- Spend caps & meteringPer-run and per-day USD caps on priced tool calls that pass through the gate, metered against each server's declared pricing, and exactly which traffic that does not cover.
- Human gatesPause named MCP tool calls that pass through the gate until a human decides, at the terminal or through an Ed25519-signed webhook decision, and exactly what happens when nobody answers.
- Audit log & verificationThe JSONL audit log (signed and hash-chained once the agent has an identity), how constle audit verify catches an edited, inserted or reordered line, and what an intact chain does and does not prove.
- IdentityEach agent's did:key identity (the W3C CCG method, Ed25519), where its private key lives, how a run fails closed without it, and how it signs the audit log.
- Agent-to-agent (A2A)Signed agent-to-agent calls between explicitly declared peers, signed and verified by the host, delivered into the sandbox only after verification.
Reference
- The AgentfileOne YAML file declares what an AI agent may reach and call, and what its priced tools may cost. An annotated example, the four enforcement labels, and every section at a glance.
- Field referenceThe Agentfile field reference isn't public yet. Start from the annotated example, the four enforcement labels and the sections at a glance.
- CLI referenceThe constle commands and flags, the environment variables that change them, and the startup screen.
- ReleasesWhat a signed Constle release carries, and how the release workflow signs its checksums.
Project