--format stream-json — structured JSONL output
Use --format stream-json when a program needs to consume progress without scraping terminal output. It requires -q / --query (or --query-file), implies quiet non-interactive CLI mode, and rejects an explicit --tui request. Every stdout line is one JSON object; diagnostics and the session_id: line stay on stderr.
Every event carries timestamp (Unix epoch milliseconds).
Once a conversation starts, its terminal record is always result — including exit_code: 130 when it is interrupted with Ctrl-C. Treat that record as the completion signal; the process exit code matches its exit_code.
When chat answers and exits (-Q, chat --oneshot, or a query with non-TTY stdio) the process exit code reports the turn's outcome, on both the quiet and the non-quiet path: 0 the turn completed; 1 it failed, stopped partway (partial), hit the iteration budget, or never ran (credentials / agent init failed); 130 it was interrupted. A Kanban dispatcher-spawned worker (HERMES_KANBAN_TASK set) whose turn failed only because the provider was rate-limited, overloaded, returning 5xx, timing out, or the account hit a billing/quota wall, exits 75 (EX_TEMPFAIL) so the dispatcher requeues the task without counting a failure. With --format stream-json the terminal result record carries the same exit_code.
From the official Hermes Agent CLI reference.