> ## Documentation Index
> Fetch the complete documentation index at: https://defi-cli.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Overview

> Build robust agent workflows on top of deterministic CLI contracts.

## Why agents like defi-cli

* Stable envelope schema (`version`, `success`, `error`, `meta`)
* Stable exit code mapping (including execution-specific codes `20`-`24`)
* Canonical chain and asset IDs
* Provider-scoped retrieval IDs on lend/yield rows (`provider_native_id`, `provider_native_id_kind`)
* Deterministic `--select` projections
* Machine-readable command schema (`defi schema`)
* Execution commands (`plan`, `run`, `submit`, `status`) for on-chain actions

## Recommended request pattern

1. Resolve all chain/asset inputs (`assets resolve` where useful).
2. Execute command with `--json --results-only` for success payloads.
3. Handle non-zero exit codes using `error.code` and `error.type`.
4. Persist canonical IDs and base-unit amounts.

For execution workflows:

1. Use `plan` to dry-run and inspect steps before committing.
2. Use `actions list` / `actions show` / `actions estimate` to inspect persisted actions.
3. Use `submit --action-id` to broadcast a planned action (requires signer).
4. Use `--input-json` / `--input-file` for structured input on `plan` and `submit`.

## Suggested defaults

```bash theme={null}
--timeout 12s --retries 2 --max-stale 5m
```

For strict workflows:

```bash theme={null}
--strict --no-stale
```

## Command allowlist mode

Use `--enable-commands` to constrain executable commands in agent sandboxes.

```bash theme={null}
defi --enable-commands "providers list,yield opportunities,swap plan" providers list --results-only
```

If a command is blocked, exit code `16` (`command_blocked`) is returned.

This is especially useful for restricting which execution commands an agent can call.
