Skip to main content

Envelope format

When stdout is not a TTY (and always with --json), every command emits a structured JSON envelope that unifies success and failure:
On failure, the same top-level shape is used with "ok": false and additional fields:

Field reference

Error codes and exit codes

  • error is always a stable machine code (e.g. confirmation_required, human_review_required, engine_not_available). Freeform messages go in message, not error.
  • Commands that fail with "ok": false return a non-zero exit code.
  • When a command succeeds, the exit code is zero.

Agent stop-gates

Agents must stop when error is either confirmation_required or human_review_required, show the message to a human, and only rerun a next_actions[].cmd after explicit approval. Do not add confirmation flags (e.g. --confirm-rights, --yes, --attest) without human input.

Enabling JSON output

Global options

Auth

Primary commands

Noun-first agent surface

The agent contract uses stable resource nouns that match API resources and the /v1/resources catalog. Legacy ergonomic verbs (e.g. upload, read, chat, extract, parse, audit, redact, render) remain compatible, but the preferred agent surface is:
  • resources
  • documents
  • files
  • jobs
  • agents
  • workflows
  • collections
Run okra resources list to discover every API noun and verb, and okra <noun> --help for a resource’s subcommands.

Grounded context commands

Before (or instead of) a full parse, the context commands navigate a source and retrieve bounded, cited context:

Environment variables