CONCEPTS · 02
Agents
An agent is a small, audited program. It reads an intent, drafts a plan, and emits casts — under a seal you control.
What is an agent
An agent is a deterministic-where-possible, audited program that takes an intent and turns it into onchain action. Agents are versioned by content hash and registered onchain so you can prove which version you summoned.
Importantly: an agent does not hold your keys. It executes through a scoped session — a seal— that you grant it. Revoke the seal and the agent stops acting, permanently.
Anatomy
Every agent implements the same interface:
typescriptinterface Agent<P = {}> {
ref: AgentRef; // versioned, content-addressed
capabilities: Capability[]; // ["lending/stable", ...]
fit(intent: Intent): number; // 0..1 — how well it can satisfy
plan(intent: Intent, ctx: AgentContext): Promise<Plan>;
execute(plan: Plan, sealed: SealedSigner): Promise<CastResult>;
audit: AuditRef; // contract address of the audit attestation
}fit is how the mesh decides who responds to an intent.plan is pure simulation — no chain writes. executeis the only function that produces transactions, and it can only do so through the SealedSigner passed to it.
How a cast happens
- Intent broadcast. You sign an intent; it lands on the agent mesh.
- Fit poll. Every agent with a matching capability returns a
fitscore. - Plan. The highest-fit agent runs
plan(intent)— pure simulation, no chain writes. - Verify. The plan is checked against bounds. Anything out of bounds is rejected without notifying the chain.
- Execute. The plan is executed via the sealed signer. A
castevent is emitted. - Report. The activity feed gets pre-trade plan, on-chain receipt, and post-trade delta.
Safe failure
Agents are required to fail loudly. Specifically:
- If an external venue is unreachable, the agent emits a
skipevent with a reason — it does not retry silently. - If the plan is rejected by bounds checks, the agent emits a
haltand pauses itself until you renew the intent. - If a transaction reverts, the agent emits a
revertwith the simulated vs. actual delta and stops casting on that intent.
Silent retries are forbidden. An agent that cannot satisfy its intent today must say so today.
Multiple agents, one intent
You can bind multiple agents to a single intent. They will race or cooperate based on the composition policy you choose. The most common is highest-fit-wins: only the best-fit agent acts at each opportunity. The most powerful is cooperative: agents coordinate to satisfy the intent together, useful for cross-venue strategies.