Add structured logging to agent CLI

t-338·WorkTask·
·
·
·Omni/Agent.hs
Created1 month ago·Updated1 month ago

Description

Edit

Summary

Add structured JSON logging for observability and debugging.

Usage

agent --log=debug ./workflow.md 2>debug.jsonl

Event Types

{"type": "start", "model": "claude-sonnet-4", "provider": "openrouter", "timestamp": "..."}
{"type": "thinking", "content": "Let me analyze this...", "iteration": 1}
{"type": "tool_call", "tool": "run_bash", "args": {...}, "iteration": 1}
{"type": "tool_result", "tool": "run_bash", "success": true, "output": "..."}
{"type": "complete", "iterations": 5, "cost_cents": 2.3, "tokens": 1500}
{"type": "error", "message": "..."}

Log Levels

  • --log=info - Start, complete, errors
  • --log=debug - + tool calls, thinking
  • --log=trace - + full API payloads

Benefits

  • Machine-parseable for tooling
  • Can pipe to observability systems
  • Useful for debugging agent behavior
  • Can reconstruct full conversation

Timeline (2)

🔄[human]Open → InProgress1 month ago
🔄[human]InProgress → Done1 month ago