2026-04-12 · 7 min read · observability · ai · agents · llm

AI Agent Observability: Logs, Traces, and Costs in One Dashboard

The black box problem\n\nYour agent loop calls an LLM 50 times to finish a task. One of those calls is the one that made the agent hallucinate. Which one? Without observability, you'll never know.\n\n## The minimum stack\n\nThree layers:\n\n1. Per-call log — every LLM call with inputs, outputs, model, tokens, cost, latency, parent call id\n2. Trace view — tree visualization of all calls within a task, with cost rolled up\n3. Budget + anomaly alerts — fire Telegram/Slack when a single task exceeds a threshold\n\n## Quick implementation\n\n``ts\nimport { traceCall } from '@lazymac/sdk';\n\nasync function agentTurn(prompt) {\n return traceCall({ task: 'user-question', parent: null }, async (t) => {\n const plan = await t.llm('planner', { prompt, model: 'claude-haiku-4-5' });\n const result = await t.llm('executor', { prompt: plan, model: 'claude-sonnet-4-6' });\n return result;\n });\n}\n`\n\nEach t.llm(...) auto-logs to AI Spend Tracker and emits a trace node.\n\n## What you'll see in week 1\n\n- Cost spikes — usually one retry loop hitting Opus 50 times when it should have hit Sonnet 5 times\n- Wrong-model selections — classifiers using GPT-5 when GPT-5 Mini was enough\n- Bloated context — prompts growing 10x over a conversation, 90% useless\n- Token-inefficient outputs — verbose models where terse ones suffice\n\n## The free tier\n\nAI Spend Tracker — 100 logs/day free. Pro $29/mo unlimited with budgets, alerts, forecast, and per-task traces.\n\nOr the unified MCP server:\n\n`bash\nnpx -y @lazymac/mcp\n> Show me the cost breakdown for my last agent run\n``


📬 MCP Security Weekly

One email per week — new CVEs, scanner improvements, MCPWatch grade drops on popular servers. Free. Unsubscribe anytime.

Support the work: MCP Pro $29/mo · MCPWatch Pro Report $49 · more posts