JSON Output Format
Most commands support the--json flag, which outputs data in machine-readable formats:
- List commands: JSONL (JSON Lines) - one JSON object per line
- Show commands: Single JSON object
- Playbook execution: JSONL stream of events
Parsing JSONL Output
Using jq
Using Python
Using Node.js
Event Streaming
Playbook execution streams events in real-time:Common Scripting Patterns
Check Agent Status
Automated Playbook Execution
Monitor Playbook Progress
CI/CD Integration
GitHub Actions
GitLab CI
Error Handling
Best Practices
Always check exit codes
Always check exit codes
The CLI returns non-zero exit codes on failure. Always check
$? or use set -e in bash scripts.Stream large outputs
Stream large outputs
For long-running playbooks, process events as they arrive rather than buffering all output.
Use --json consistently
Use --json consistently
JSON output is stable and versioned. Human-readable output may change between versions.
Handle agent busy states
Handle agent busy states
Use
--wait flag to queue commands when agents are busy, or check agent state first.CLI Commands
Complete command reference
Automation
Automation patterns and examples