No built-in agent observability — power users hacking metrics with SubagentStop hooks
Problem
I run agent teams regularly — 3-7 agents per team for implementation tasks. To understand what's actually happening, I wrote a SubagentStop hook that logs to a JSON file: which agent finished, how long it ran, whether it completed its task or errored out, and idle time.
This is a hack. The data I can capture is limited to what the hook receives, and I'm parsing agent output to infer success/failure. There's no structured way to answer basic questions:
- Which of my custom agents fails most often?
- What's the average turn count per agent type?
- How much time do agents spend idle waiting for messages vs actively working?
- Are my agents actually completing assigned tasks or just going idle?
What I'd want
An agent metrics API or even just richer SubagentStop metadata:
{
"agent_name": "backend-impl",
"subagent_type": "general",
"team_name": "feature-build",
"turns": 14,
"tool_calls": 47,
"tokens_in": 82000,
"tokens_out": 12000,
"wall_time_seconds": 340,
"idle_time_seconds": 120,
"tasks_completed": ["task-3", "task-7"],
"exit_reason": "shutdown_request"
}
Even a simple claude agent-stats CLI command that shows historical agent performance would be useful. Right now I'm grepping my own log files to figure out if my agent configurations are actually working.
Who this helps
Anyone using teams or spawning more than a handful of agents. You can't optimize what you can't measure, and right now agent performance is a total black box unless you build your own telemetry.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗