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
--selectprojections - Machine-readable command schema (
defi schema) - Execution commands (
plan,run,submit,status) for on-chain actions
Recommended request pattern
- Resolve all chain/asset inputs (
assets resolvewhere useful). - Execute command with
--json --results-onlyfor success payloads. - Handle non-zero exit codes using
error.codeanderror.type. - Persist canonical IDs and base-unit amounts.
- Use
planto dry-run and inspect steps before committing. - Use
actions list/actions show/actions estimateto inspect persisted actions. - Use
submit --action-idto broadcast a planned action (requires signer). - Use
--input-json/--input-filefor structured input onplanandsubmit.
Suggested defaults
Command allowlist mode
Use--enable-commands to constrain executable commands in agent sandboxes.
16 (command_blocked) is returned.
This is especially useful for restricting which execution commands an agent can call.
