Get structured JSON output for parsing
print mode & automation
// what it does
--output-format json emits a single JSON object once the run finishes: type/subtype, is_error, duration_ms, the full text in result, plus session_id and an optional request_id. It only applies with --print. Read the result field for the answer and session_id to resume the same thread later.
// shell
$ cursor-agent -p "review auth.ts for security issues" --output-format json// gotcha
On failure the process exits non-zero and writes the error to stderr with no JSON at all — always check the exit code before piping stdout into jq, or you will parse an empty stream.