agentRefs derives the vault, policy, and cap from the AgentCap it owns on chain.
Prerequisites
A Sui wallet on testnet
Install a Sui wallet (Sui Wallet, Suiet, or similar) and switch the network to Testnet.
Testnet SUI
Use the Sui testnet faucet to fund your operator wallet. Provisioning an agent costs gas plus the budget you deposit into the vault.
1. Provision an agent
Open altheia.xyz/sui, connect your Sui wallet on testnet, and click Create Agent. The dashboard provisions the vault, thePolicy, and the agent’s AgentCap in one owner signature, funds the agent key with gas, and shows you the agent’s private key once.
Set a tight policy to start. The demo below assumes:
| Field | Value |
|---|---|
| Budget asset | SUI |
| Per-tx cap | 0.5 SUI |
| Per-day cap | 2 SUI |
| Allowed actions | swap |
| Scope | the DeepBook pool |

2. Install the SDK
@altheia-xyz/sui re-exports the @mysten/sui primitives an agent author needs, so your project imports one package and there is one copy of @mysten/sui in play.
Create .env:
3. The agent, in about five lines
Createhello.ts:
hello.ts
4. What allowed and denied look like
policy::check_and_consume, which records the spend against the per-day cap and emits an AllowedAction event. The over-cap swap aborts inside the contract before any coin leaves the vault. decodePolicyAbort maps the Move abort code to a stable reason.
The swap is a policy decision, not a guaranteed fill. The agent submits a gated DeepBook order; on a thin testnet book it may fill zero. Allowed means the policy permitted the action and the transaction landed. It does not assert the order filled.
guardedSubmit: a policy abort is logged and the submit is skipped.
5. Verify in the dashboard
Open the agent in the dashboard. The Chronicle shows the audit ledger: the allowed swap settled on-chain, and (if you usedguardedSubmit) the denied attempt with its reason.

Where to go next
The Policy object
Caps, actions, scope, expiry, pause, revoke — what the contract enforces.
DeepBook swap example
The full runnable agent, with revoke mid-loop.
SDK reference
AltheiaSui, agentRefs, the builders, chain reads.Troubleshooting
No AgentCap, wrong network, denied vs. non-policy failure.