> ## Documentation Index
> Fetch the complete documentation index at: https://docs.altheia.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Vault and AgentCap

> Where agent funds live, and the non-transferable capability that binds an agent to one vault and one policy.

Two objects pair with the [Policy](/concepts/policy-object): a `Vault` that holds the agent's funds, and an `AgentCap` that authorizes the agent to act against them.

## Vault

The `Vault` is a shared object that holds the agent's coins. It is multi-asset: balances live in dynamic fields keyed by coin type. The operator funds it with a budget asset at provision time; assets the agent acquires through permitted swaps settle back into it.

Funds leave the vault only through a gated path. `vault::withdraw_with_receipt<T>` calls `policy::check_and_consume<T>` before releasing any `Coin<T>`, so every outflow is policy-checked. The owner holds an `OwnerCap`, which authorizes lifecycle operations: pause, unpause, revoke, set caps, and the kill-and-drain that sweeps the vault back to the owner.

Read live balances with `vaultBalances(client, vaultId)`.

## AgentCap

The `AgentCap` is the agent's capability. It is non-transferable: declared `key`-only with no `store`, so once minted to the agent's address it cannot be given away or sold.

```move theme={null}
public struct AgentCap has key {
    id: UID,
    agent_id: vector<u8>,
    vault_id: ID,    // the vault this agent may act against
    policy_id: ID,   // the policy that governs it
}
```

The cap binds the agent to exactly one vault and one policy. `vault::withdraw_with_receipt` checks `vault_id`; `policy::check_and_consume` checks `policy_id`. A cap pointing at the wrong policy aborts `wrong_policy`.

This is why an agent needs only its private key. The key owns the `AgentCap`; `agentRefs(client, address)` reads the cap and derives the vault and policy ids from it. See the [SDK reference](/sdk/altheia#agentrefs).

## How they fit together

```
Owner wallet ──owns──> OwnerCap ──authorizes──> pause / revoke / set caps / drain
                          │
Operator provisions ──> Vault (shared, multi-asset)
                          │
                        Policy (shared) ── caps, actions, scope, expiry, state
                          │
Agent key ──owns──> AgentCap ──bound to──> (vault_id, policy_id)
                          │
                  agent action ──> check_and_consume ──> coin leaves vault, or aborts
```

<Card title="Next: on-chain enforcement" icon="arrow-right" href="/concepts/enforcement" horizontal>
  How check\_and\_consume aborts, and what each abort code means.
</Card>
