# Policies & spending limits (/docs/swivy/policies)

<Callout type="warn" title="Preview: Swivy is not generally available">
Swivy is a **staging/testnet preview using software custody**, not a production custody service. All six public SDK packages are available at **1.0.1**. Use test assets only. [Set up the preview](/docs/swivy/preview-setup) or [request project access](/docs/swivy/request-access).
</Callout>

**In plain words:** the policy is the rulebook for one environment. It lives on the server, not in your app, so you can tighten a limit without shipping a new build. Set it in the console or from your backend.

```ts
// Server only: needs an organization admin credential
await swivy.updateEnvironmentPolicy('env_...', policy);
```

`PUT /v1/control/environments/{environmentId}/policy` **replaces** the whole policy, so send every section.

## Sections [#sections]

| Section | What it controls |
|---|---|
| `loginPolicy` | Enable customer email, SMS and passkey login independently. Hosted login also follows client auth settings. |
| `allowedChains` | Chain families the environment may use: `evm`, `solana`. |
| `walletPolicy` | Whether embedded and linked wallets are allowed, whether split custody is allowed, the default custody mode, whether wallets are auto-created at login and on which chains. |
| `signingPolicy` | Whether signing needs MFA, whether raw signing is allowed, and which signing kinds are allowed (`sign_message`, `sign_digest`, `sign_typed_data`, `sign_transaction`). |
| `executionPolicy` | Whether sending needs MFA, whether hosted execution is on, a per-transaction value cap (`maxTransactionValueUsd`) and [gas sponsorship](/docs/swivy/gas-sponsorship). |
| `exportPolicy` | Whether key export is allowed at all, and whether it needs MFA. |
| `sessionPolicy` | Whether [agent session grants](/docs/swivy/agent-session-grants) are allowed, whether creating one needs MFA, default and maximum expiry, allowed signing kinds, whether grants may execute transactions, allowed networks and a value cap. |
| `recoveryPolicy` | Which recovery routes are on: email, passkey, SMS. |
| `walletToolPolicy` | Limits for built-in wallet tools (swap quotes and prediction-market orders): on/off, maximum swap value, maximum slippage, allowed tokens. |
| `rpcProviderPolicy`, `blockchainDataPolicy`, `offlineSigningPolicy` | Advanced routing and offline-signing settings. {/* TODO(review): document these three once their shapes are stable. */} |

## Spending limits that matter most [#spending-limits-that-matter-most]

- **Per transaction:** `executionPolicy.maxTransactionValueUsd` caps any single transaction a user sends.
- **Per agent:** `sessionPolicy.maxTransactionValueUsd` caps what an agent can do with a grant, and each grant can set a lower `scope.maxTransactionValueUsd` and `maxUses`.
- **Sponsorship budget:** `executionPolicy.sponsorship.maxSpendPerUserUsd` and `maxSpendPerDayUsd` cap the gas you pay for.

## Good defaults [#good-defaults]

- Require MFA for execution and export.
- Keep raw signing and export **off** unless you have a specific need.
- Auto-create wallets only on the chains you actually use.
- Keep session grants short (a low `maxExpirySeconds`) and limited to the networks the agent needs.

## Delegated execution [#delegated-execution]

Standing EVM grants require an explicit execution gas cap. Schema 21 also supports an optional cumulative encoded-native-value and execution-gas profile. These limits are not total-wallet-loss or USD guarantees. Read the [scope, exclusions and reservation behavior](/docs/swivy/delegated-limits) before enabling them.
