You've shipped your first AI agent to production. The dashboard shows it running. But you have no real idea what it costs per request, or whether it's quietly failing in ways your error logs would never catch.
This is the gap most builders find out about the hard way: deployment isn't observability. An agent can return HTTP 200, log success, and produce zero useful output — all without a single error anywhere in the chain.
Why standard monitoring misses AI agents
Typical app observability — latency, error rates, uptime — was built for request/response workflows. It catches crashes, timeouts, explicit errors. AI agents fail differently. They fail silently.
Three ways this shows up in practice:
- HTTP 200, logs show success, zero output tokens generated. The agent ran, the API call succeeded, the response came back empty. No error. Just nothing.
- A hundred requests, ninety blank outputs. Your logs say 90% success. Your users see broken functionality.
- Cost per request 10x what it was last week — the agent's looping, retrying tool calls, burning tokens, and the logs still say "success."
None of these are crashes. Nothing you're currently watching will flag them.
What you actually need to see
Four signals, once the agent's live:
- Tokens per execution (input + output). Your canary — zero output tokens on a "successful" run means something's broken.
- Cost per request, computed from tokens × model pricing. Aggregates hide loops; per-execution cost reveals them.
- Did it actually produce output — separate from whether the HTTP call succeeded.
- Latency and retry patterns — a 2-second call suddenly taking 30 usually means it's looping on a tool call.
Three ways to wire it in
SDK instrumentation
The easiest path if you're on OpenAI, Anthropic, or an OpenAI-compatible provider:
from opsveritas import opsveritas
opsveritas.init(secret="<your OpsVeritas SDK key>") # from your OpsVeritas org, not OpenAI/Anthropic
opsveritas.wrap(client)
Three lines, and every call gets tracked — tokens, cost, output status, latency, model — without your API keys ever leaving your process.
Webhook
For frameworks without SDK support, or when you want full control over what gets sent. The x-agents-key here is a key OpsVeritas issues to your org specifically — it's separate from your OpenAI/Anthropic credentials, which never touch OpsVeritas in this flow:
curl -X POST https://ai-agents-control-tower.onrender.com/webhooks/agent-execution \
-H "x-agents-key: <your OpsVeritas webhook key>" \
-H "Content-Type: application/json" \
-d '{
"agent_name": "customer-support-bot",
"status": "success",
"input_tokens": 245,
"output_tokens": 0,
"cost_usd": 0.0042,
"duration_ms": 1240,
"executed_at": "2026-08-04T14:22:15Z"
}'
Just log it locally
If you're not ready for a platform yet — capture tokens, cost, and whether there was output on every run, print it as structured JSON, and grep for output_tokens: 0 in your own logs. Fifteen minutes, no external dependency.
Set the thresholds
- Cost per request under 2x your baseline — above that, something's looping.
- Output tokens should never be zero on a run marked successful.
- Latency spikes usually mean retries.
Most teams skip this because it feels like overhead — right up until an agent burns a day's budget in an hour, or fails silently for your highest-value customer. Start with one agent, capture tokens and cost, watch for zeros. That's most of the observability you actually need, and it's a few minutes of work.
Top comments (0)