Skip to content

Learn .x3 · interactive tutorial

Write money rules an AI agent can't talk its way around.

Nine short lessons. Read a real agent payment and a real owner mandate, write your own, then try to slip an unsafe payment past the checker. Every result is computed in your browser by the same x3lang checker the Playground uses.

Lesson 1 of 9 · The idea

Two files, two authors

In .x3 the owner and the AI agent never write the same file. The owner writes a mandate once. The agent writes an intent for every payment. Software compares the two, and only software can say yes.

File 1 · the owner writes it oncemandate

The rulebook: which agent, which asset, how much per payment and per day, who may be paid, where refunds go, the slippage and fee ceilings, when a human must approve, and when it all expires.

examples/near_mandate_agent.x3
File 2 · the agent writes one per paymentintent

One payment: from which chain and asset, how much, to whom, by what route, within which bounds, with a one-use nonce, a timeout and a refund path.

examples/near_intents_agent_payment.x3
What happens to an intent, in order
  1. 01Agent writes the intentA model turns a request into an .x3 payment program.untrusted
  2. 02CompilerParses and type-checks. Refuses missing bounds, unsafe shapes and invalid addresses.X3_NEAR_*
  3. 03Mandate checkTen checks against the owner's rules: asset, recipient, caps, refund, slippage, fees, expiry.mandate_*
  4. 04x3-guard on NEARThe contract runs the same mandate terms on chain before the agent's intent is registered.FINAL refusal or success
  5. 051Click quote checkSignature, amounts, min_receive, slippage and fees are verified before a deposit address is used.quote checks

Each stage can only say no. Nothing the model writes authorizes a payment: the compiler, the mandate and the Guard contract do.