Claw Mart
← All issuesClaw Mart Daily
Issue #107June 19, 2026

Your agent needs observability — here's the monitoring stack that catches problems before they cascade

Your agent worked perfectly in testing. Then it hit production and started making weird decisions, burning through your API budget, and occasionally just... stopping. You have no idea why because you can't see what it's thinking.

This is the observability problem. Your agent is a black box making hundreds of decisions per hour, and you're flying blind.

Here's the monitoring stack I use to actually see what's happening:

The Three-Layer Stack:
• Decision logging (what it chose and why)
• Resource monitoring (tokens, API calls, memory usage)
• Health checks (is it still responsive and making progress?)

Layer 1: Decision Logging

Every significant decision gets logged with context. Not just "called search API" but "searched for 'kubernetes deployment yaml' because user mentioned container issues in previous message."

# Add this to your agent's decision points
log_decision({
  "action": "search_web",
  "reasoning": reasoning_text,
  "context": current_task_context,
  "confidence": confidence_score,
  "timestamp": datetime.now()
})

This creates a decision trail you can follow when things go wrong. "Oh, it searched for the wrong thing because it misunderstood the context from three messages ago."

Layer 2: Resource Monitoring

Track the expensive stuff in real-time:

# Token usage tracking
class TokenTracker:
    def __init__(self):
        self.session_tokens = 0
        self.daily_tokens = 0
        self.cost_estimate = 0
    
    def log_api_call(self, input_tokens, output_tokens, model):
        total = input_tokens + output_tokens
        self.session_tokens += total
        cost = self.calculate_cost(total, model)
        
        if cost > self.daily_budget * 0.8:
            self.alert("Approaching daily budget limit")

Set alerts at 50%, 80%, and 95% of your daily budget. Nothing worse than waking up to a $200 API bill because your agent got stuck in a loop.

Layer 3: Health Checks

Is your agent still alive and making progress? Check every 5 minutes:

# Simple health check
def health_check():
    checks = {
        "last_activity": time.time() - last_action_time < 300,  # 5 min
        "memory_usage": psutil.virtual_memory().percent < 85,
        "api_responsive": test_api_call_under_5_seconds(),
        "making_progress": task_progress_changed_recently()
    }
    
    if not all(checks.values()):
        send_alert(f"Health check failed: {checks}")

The Dashboard That Actually Helps

Don't build a NASA mission control center. Build something you'll actually look at:

  • Current status: What is it doing right now?
  • Token burn rate: How fast is it spending money?
  • Recent decisions: Last 10 choices with reasoning
  • Error rate: API failures, retries, timeouts
  • Progress indicators: Tasks completed, stuck, or abandoned

I use a simple web dashboard that refreshes every 30 seconds. Nothing fancy — just the numbers that matter.

The Alert That Saves You: If your agent hasn't made a decision in 10 minutes OR token usage spikes 3x above baseline OR error rate hits 20% — something's wrong. Stop it, check the logs, fix it.

Observability isn't about collecting data. It's about catching problems before they cascade into disasters. Your agent needs to be transparent about its decisions, resource usage, and health status.

The alternative is debugging in the dark while your API budget burns.

Paste into your agent's workspace

Claw Mart Daily

Get tips like this every morning

One actionable AI agent tip, delivered free to your inbox every day.