The Agentfile
One declarative YAML file says what the agent needs, and the runtime makes the infrastructure decisions. Constle reads it once, when the run starts, and enforces it from your machine.
Tip
Step by step
Your first Agentfile builds a first Agentfile section by section and lists the fields that look like controls and are not.
Tip
constle init writes a starter Agentfile, agent.yaml. Start there instead of copying this example by hand.
An annotated exampleLink to this section
An example that uses each section the runtime enforces:
apiVersion: constle.dev/v1alpha1
kind: AgentManifest
identity:
name: invoice-processor
version: "1.0.0"
owner: finance@company.com
did: did:key:z6Mk...4doK # from `constle identity create`; only the public DID lives here
sandbox:
image: invoice-processor:latest
isolation: kernel # or omit: inferred from capabilities
memory_mb: 512
network:
allowed_hosts: # the whole list of hosts the proxy admits
- api.groq.com
capabilities:
- external_api
- external_transfer
credentials: # the only host variables the sandbox receives
- name: GROQ_API_KEY
mcp:
servers:
- id: accounting
url: https://mcp.accounting.internal # host-side only; never enters the sandbox
tools: [list_invoices, pay_invoice]
pricing: # required for spending to be enforced
meters:
- usage_path: result.usage.input_tokens
usd_per_unit: "0.000003"
spending:
max_per_run_usd: "0.50"
max_per_day_usd: "5.00" # durable across runs; requires identity.did
limits:
max_duration_seconds: 300
human_gates:
enabled: true
require_approval_for:
- pay_invoice # must exactly match an MCP tool name (limitation 1)
approver_pubkey: did:key:z6Mk...Ap7w # from `constle webhook-keygen`; required when gating
notify:
- channel: webhook
url_secret_ref: HUMAN_GATE_WEBHOOK_URL
on_timeout: abort # the default: stop, never proceed
a2a:
listen: ":9443"
peers:
- name: auditor
did: did:key:z6Mk...9xQz
endpoint: https://auditor.internal:9443Note
The DIDs are placeholders
The did:key values above are shortened. constle identity create and constle webhook-keygen print the full ones to paste in. human_gates.approver_pubkey is required whenever require_approval_for is non-empty, and an Agentfile with no credentials passes no host variables at all.
Enforcement labelsLink to this section
Fields in the Agentfile's specification are labelled with one of four labels. The distinction that matters most is between ENFORCED and DECLARED, because a DECLARED field parses and changes nothing.
| Label | Meaning |
|---|---|
| E ENFORCED | The runtime actively prevents violations at execution time: it blocks the action or stops the run. |
| V VALIDATED | Checked for well-formedness and consistency at parse time. The manifest is rejected if it isn't. It is not a constraint during execution. |
| D DECLARED | Parsed and may be defaulted, but no code path changes behaviour based on it. |
| I INFORMATIONAL | The runtime decides nothing on it, and at most displays it. For humans and external tooling. |
If a field is DECLARED, you cannot rely on the runtime to stop the agent from violating it. Constle warns at validate and run wherever it can detect that a declared control won't be enforced.
The sections at a glanceLink to this section
| Section | What it controls | Enforced at |
|---|---|---|
identity |
Name, version, owner label and the did:key that signs the audit log |
run start (fails closed without the key) |
sandbox |
Image, command, memory, the isolation level | backend selection, supervisor |
sandbox.network |
allowed_hosts, the whole list of hosts the proxy admits |
Squid egress proxy |
capabilities |
Declared action classes, which set the isolation floor | validation |
credentials |
The complete set of host variables the sandbox receives | sandbox environment construction |
mcp |
MCP servers, their tool allowlists and pricing | MCP gate proxy |
a2a |
Signed agent-to-agent peers | A2A gate and host listener |
spending |
Per-run and per-day USD caps on priced calls that pass through the gate | MCP gate (metering) |
limits |
max_duration_seconds |
supervisor |
human_gates |
Tool calls that pass through the gate and wait for a human | MCP gate proxy |
compliance, metadata |
Descriptive fields | not enforced (declared or informational) |
Check a fileLink to this section
- Check an Agentfile without running anything:
constle validate agent.yaml.