Skip to content

Output Formats

clido supports three output formats, controlled by --output-format.

Human-readable output. Includes:

  • A line per tool call while the agent runs
  • The agent’s final response text
  • A cost/turn/time summary footer
Terminal window
clido "count lines in src/main.rs"
[Turn 1] Reading src/main.rs...
src/main.rs has 312 lines.
Cost: $0.0009 Turns: 1 Time: 2.1s

In --quiet mode, only the agent’s final response is printed; the tool lines and footer are suppressed.

A single JSON object emitted after the agent finishes. Suitable for scripting.

Terminal window
clido --output-format json "count lines in src/main.rs"
{
"session_id": "a1b2c3d4e5f6789abcdef0123456789abcdef01",
"result": "src/main.rs has 312 lines.",
"total_cost_usd": 0.0009,
"num_turns": 1,
"duration_ms": 2100,
"exit_status": "success",
"model": "claude-sonnet-4-5",
"provider": "anthropic"
}
FieldTypeDescription
session_idstringFull 40-character session ID
resultstringAgent’s final response text
total_cost_usdnumberAccumulated cost in USD
num_turnsintegerNumber of agent turns
duration_msintegerTotal wall time in milliseconds
exit_statusstringsuccess, max_turns, max_budget, error, interrupted
modelstringModel used
providerstringProvider used
ValueMeaning
successAgent completed the task
max_turnsTurn limit reached (exit code 3)
max_budgetBudget limit reached (exit code 3)
errorAgent or provider error (exit code 1)
interruptedUser interrupted with Ctrl+C (exit code 130)

Newline-delimited JSON events emitted in real time as the agent runs. Each line is a self-contained JSON object. Suitable for parent processes that want to observe progress.

Terminal window
clido --output-format stream-json "count lines in src/main.rs"
{"type":"tool_start","tool_name":"Read","input":{"file_path":"src/main.rs"},"turn":1}
{"type":"tool_done","tool_name":"Read","is_error":false,"duration_ms":8,"turn":1}
{"type":"assistant_text","text":"src/main.rs has 312 lines.","turn":1}
{"type":"result","session_id":"a1b2c3...","exit_status":"success","total_cost_usd":0.0009,"num_turns":1,"duration_ms":2100}

Emitted when a tool call begins.

{
"type": "tool_start",
"tool_name": "Bash",
"input": { "command": "cargo check" },
"tool_use_id": "toolu_01abc...",
"turn": 2
}
FieldTypeDescription
tool_namestringName of the tool
inputobjectTool input (tool-specific schema)
tool_use_idstringUnique ID for this call
turnintegerTurn number

Emitted when a tool call completes.

{
"type": "tool_done",
"tool_name": "Bash",
"is_error": false,
"duration_ms": 1243,
"tool_use_id": "toolu_01abc...",
"turn": 2
}
FieldTypeDescription
tool_namestringName of the tool
is_errorbooleanWhether the tool returned an error
duration_msintegerExecution time in milliseconds
tool_use_idstringMatches the corresponding tool_start
turnintegerTurn number

Emitted when the assistant emits text (may occur multiple times per turn for streaming models).

{
"type": "assistant_text",
"text": "The file has 312 lines.",
"turn": 1
}

The final event, emitted after the agent finishes.

{
"type": "result",
"session_id": "a1b2c3d4e5f6789abcdef0123456789abcdef01",
"exit_status": "success",
"total_cost_usd": 0.0009,
"num_turns": 1,
"duration_ms": 2100,
"model": "claude-sonnet-4-5",
"provider": "anthropic"
}

Example: consuming stream-json from another program

Section titled “Example: consuming stream-json from another program”
Terminal window
# Python example: print each tool call as it happens
clido --output-format stream-json "run all tests and fix any failures" |
python3 -c "
import sys, json
for line in sys.stdin:
ev = json.loads(line)
if ev['type'] == 'tool_start':
print(f'[{ev[\"tool_name\"]}] {ev[\"input\"]}')
elif ev['type'] == 'result':
print(f'Done: {ev[\"exit_status\"]} (${ev[\"total_cost_usd\"]:.4f})')
"