Skip to content
Back to skills

Agent Observability

ASecurity

Use when the user asks about agent observability, tracing agent reasoning, debugging an agent loop, OpenTelemetry GenAI spans for LLM calls, LLM cost tracking per agent, agent audit logs or hallucination/eval monitoring in production. Produces instrumentation config, trace schema, dashboards, alerts and cost attribution. Not for generic service tracing without LLMs (use devops-opentelemetry).

  • 46 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 27, 2026
ai-agentspythongorailstestingdebuggingapibackenddevopsperformance

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned November 27, 2026

npx -y skills add j4flmao/agent-skills --skill agent-observability --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Agent Observability?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Agent Observability
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/j4flmao-agent-observability/badge)](https://www.skillsdirectory.com/skills/j4flmao-agent-observability)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: agent-observability
description: >
  Use when the user asks about agent observability, tracing agent reasoning, debugging an agent loop,
  OpenTelemetry GenAI spans for LLM calls, LLM cost tracking per agent, agent audit logs or hallucination/eval
  monitoring in production. Produces instrumentation config, trace schema, dashboards, alerts and cost
  attribution. Not for generic service tracing without LLMs (use devops-opentelemetry).
version: "2.0.0"
author: "j4flmao"
license: "MIT"
last_verified: "2026-11-11"
type: skill
compatibility:
  claude-code: true
  cursor: true
  codex: true
  windsurf: true
tags:
  - harness-engineering
  - observability
  - tracing
  - monitoring
  - opentelemetry
  - debugging
  - performance
  - cost-optimization
  - anomaly-detection
---

# Agent Observability

## Purpose

This skill provides the complete knowledge required to build production-grade
observability systems for AI agent deployments. Unlike traditional software where
execution paths are deterministic and debuggable with standard tools, agent systems
exhibit non-deterministic reasoning loops, branching decision trees, variable-length
tool call chains, and stochastic output variations that demand specialized observability
infrastructure.

The skill covers every dimension of agent observability: capturing and visualizing
reasoning traces that show *why* an agent made each decision, integrating OpenTelemetry
to instrument every LLM call and tool invocation, propagating distributed trace context
across multi-agent chains, maintaining tamper-evident decision audit logs, profiling
performance bottlenecks in agent pipelines, detecting anomalous behavior patterns that
indicate drift or failure, tracking costs across model providers and optimizing token
usage, and analyzing latency to identify and eliminate bottlenecks in the agent execution
critical path.

## Core Principles

1. **Trace Everything, Sample Intelligently**: Every LLM call, tool invocation, and
   decision point must be instrumentable. In production, use head-based and tail-based
   sampling to control volume while guaranteeing capture of errors and anomalies.

2. **Reasoning is the Primary Signal**: Traditional metrics (latency, throughput, errors)
   are necessary but insufficient. The agent's reasoning trace—the chain of observations,
   thoughts, and actions—is the primary debugging and auditing artifact.

3. **Correlation Across Boundaries**: A single user request may traverse multiple agents,
   tools, sandboxes, and external APIs. Trace context must propagate across all boundaries
   to enable end-to-end visibility.

4. **Cost is a First-Class Metric**: Token consumption, API call counts, and dollar costs
   must be tracked with the same rigor as latency and error rates. Cost anomalies often
   indicate reasoning loops or prompt inefficiencies.

5. **Detect Drift Before Failure**: Anomaly detection on agent behavior distributions
   (response length, tool call frequency, reasoning depth) catches degradation before
   it manifests as user-visible failures.

## Agent Protocol

### Triggers
- Agent system deployed to production requiring monitoring
- Debugging non-deterministic agent behavior or reasoning failures
- Cost overruns detected in agent API usage
- Compliance requirement for decision audit trails
- Performance degradation in agent response times
- New agent chain requiring end-to-end trace instrumentation

### Input Context Required
- Agent system architecture (single agent, chain, graph, swarm)
- Current instrumentation state (none, partial, full OpenTelemetry)
- Observability backend (Jaeger, Tempo, Datadog, Honeycomb, custom)
- Compliance requirements (audit retention period, tamper evidence)
- Cost tracking requirements (per-request, per-agent, per-model)
- Alert thresholds (latency P99, error rate, cost per request)

### Output Artifact
- Instrumentation configuration (OpenTelemetry SDK setup)
- Dashboard definitions (Grafana JSON, Datadog monitors)
- Alert rules (Prometheus alerting rules, PagerDuty integrations)
- Reasoning trace schema (structured JSON for trace storage)
- Cost attribution report (per-agent, per-model breakdown)

### Response Formats

```json
{
  "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
  "span_id": "00f067aa0ba902b7",
  "agent_id": "agent-planner-01",
  "request_id": "req-7f8a9b0c",
  "reasoning_trace": {
    "steps": [
      {
        "step_id": 1,
        "type": "observation",
        "content": "User requests weather forecast for Tokyo",
        "timestamp": "2026-06-04T09:00:00.123Z",
        "tokens_in": 47,
        "tokens_out": 0
      },
      {
        "step_id": 2,
        "type": "thought",
        "content": "Need to call weather API tool with location=Tokyo",
        "timestamp": "2026-06-04T09:00:00.456Z",
        "tokens_in": 0,
        "tokens_out": 32,
        "model": "claude-sonnet-4-20250514",
        "cost_usd": 0.00048
      },
      {
        "step_id": 3,
        "type": "action",
        "tool": "weather_api",
        "input": {"location": "Tokyo", "units": "metric"},
        "output": {"temp_c": 22, "condition": "partly_cloudy"},
        "latency_ms": 340,
        "timestamp": "2026-06-04T09:00:00.796Z"
      }
    ],
    "total_steps": 5,
    "total_tokens": 847,
    "total_cost_usd": 0.00127,
    "total_latency_ms": 2340
  },
  "metrics": {
    "llm_calls": 2,
    "tool_calls": 1,
    "retries": 0,
    "cache_hits": 1,
    "reasoning_depth": 5
  }
}
```

## Decision Matrix

```
START: Observability requirement identified
│
├─ What is the primary goal?
│  ├─ DEBUGGING → Focus on reasoning trace capture
│  │  ├─ Single agent? → Instrument with local span collection
│  │  └─ Multi-agent? → Deploy distributed tracing with context propagation
│  │
│  ├─ COMPLIANCE → Focus on decision audit logging
│  │  ├─ Tamper-evident required? → Use append-only log with Merkle tree
│  │  └─ Standard audit? → Structured JSON logs with retention policy
│  │
│  ├─ COST CONTROL → Focus on cost tracking & optimization
│  │  ├─ Per-request attribution? → Tag spans with cost metadata
│  │  └─ Aggregate trends? → Build cost dashboards with model breakdown
│  │
│  └─ PERFORMANCE → Focus on latency analysis
│     ├─ Identify bottleneck first → Capture critical path analysis
│     ├─ LLM latency dominant? → Optimize prompts, enable caching
│     └─ Tool latency dominant? → Parallelize tool calls, add timeouts
│
├─ What sampling strategy?
│  ├─ Development → 100% sampling (capture everything)
│  ├─ Staging → Head-based 10% + tail-based on errors
│  └─ Production → Head-based 1% + tail-based on errors/anomalies
│
└─ What alerting is needed?
   ├─ Latency P99 > threshold → PagerDuty critical alert
   ├─ Error rate > 5% over 5min → Slack warning + auto-investigation
   ├─ Cost per request > 2x baseline → Cost alert + reasoning review
   └─ Anomaly score > 3σ → Anomaly alert + full trace capture
```

## Detailed Architectural Overview

```
┌───────────────────────────────────────────────────────────────────┐
│                       AGENT RUNTIME                               │
│  ┌──────────────────────────────────────────────────────────────┐ │
│  │                 INSTRUMENTATION LAYER                         │ │
│  │  ┌────────────┐  ┌────────────┐  ┌────────────────────────┐  │ │
│  │  │ LLM Call   │  │ Tool Call  │  │ Reasoning Step         │  │ │
│  │  │ Interceptor│  │ Interceptor│  │ Recorder               │  │ │
│  │  └─────┬──────┘  └─────┬──────┘  └──────────┬─────────────┘  │ │
│  │        │               │                     │                │ │
│  │        ▼               ▼                     ▼                │ │
│  │  ┌──────────────────────────────────────────────────────────┐ │ │
│  │  │          OPENTELEMETRY SDK (Traces + Metrics)            │ │ │
│  │  │  ┌──────────┐  ┌───────────┐  ┌───────────────────────┐ │ │ │
│  │  │  │ Tracer   │  │ Meter     │  │ Context Propagator    │ │ │ │
│  │  │  │ Provider │  │ Provider  │  │ (W3C TraceContext)    │ │ │ │
│  │  │  └──────────┘  └───────────┘  └───────────────────────┘ │ │ │
│  │  └──────────────────────┬───────────────────────────────────┘ │ │
│  └─────────────────────────┼────────────────────────────────────┘ │
│                            │                                      │
└────────────────────────────┼──────────────────────────────────────┘
                             │
              ┌──────────────┼──────────────┐
              ▼              ▼              ▼
┌──────────────────┐ ┌─────────────┐ ┌──────────────────┐
│  TRACE BACKEND   │ │  METRICS    │ │  LOG AGGREGATOR  │
│  ┌────────────┐  │ │  BACKEND    │ │  ┌────────────┐  │
│  │ Jaeger /   │  │ │ ┌─────────┐│ │  │ Loki /     │  │
│  │ Tempo /    │  │ │ │Prometheus││ │  │ Elastic /  │  │
│  │ Honeycomb  │  │ │ │/ Mimir  ││ │  │ CloudWatch │  │
│  └────────────┘  │ │ └─────────┘│ │  └────────────┘  │
└──────────────────┘ └─────────────┘ └──────────────────┘
              │              │              │
              ▼              ▼              ▼
┌─────────────────────────────────────────────────────────┐
│                   ANALYSIS LAYER                         │
│  ┌─────────────┐  ┌──────────────┐  ┌────────────────┐ │
│  │ Reasoning   │  │ Anomaly      │  │ Cost           │ │
│  │ Trace       │  │ Detection    │  │ Attribution    │ │
│  │ Visualizer  │  │ Engine       │  │ Engine         │ │
│  └─────────────┘  └──────────────┘  └────────────────┘ │
│  ┌─────────────┐  ┌──────────────┐  ┌────────────────┐ │
│  │ Latency     │  │ Decision     │  │ Alert          │ │
│  │ Critical    │  │ Audit        │  │ Manager        │ │
│  │ Path        │  │ Explorer     │  │ (PagerDuty)    │ │
│  └─────────────┘  └──────────────┘  └────────────────┘ │
└─────────────────────────────────────────────────────────┘
```

### Observability Data Flow

```
  LLM Call ──► Span Created ──► Attributes Added ──► Span Exported
      │              │                │                    │
      ▼              ▼                ▼                    ▼
  Token Count    Trace Context   Model, Tokens,       OTLP Collector
  Recorded       Propagated     Cost Metadata          │
                                                       ├──► Traces → Jaeger
                                                       ├──► Metrics → Prometheus
                                                       └──► Logs → Loki
```

## Workflow Steps

### Phase 1: Instrumentation Setup
1. Install OpenTelemetry SDK and configure tracer/meter providers for the agent runtime.
2. Implement LLM call interceptors that capture model, tokens, latency, and cost per call.
3. Implement tool call interceptors that capture tool name, input/output, and latency.
4. Configure W3C TraceContext propagation for cross-agent and cross-service boundaries.

### Phase 2: Reasoning Trace Capture
1. Define the reasoning step schema (observation, thought, action, result) with unique step IDs.
2. Instrument the agent's reasoning loop to emit structured trace events at each step.
3. Attach reasoning metadata (confidence scores, alternative paths considered) to trace spans.
4. Configure trace sampling strategy appropriate to the deployment environment.

### Phase 3: Metrics & Dashboards
1. Define key metrics: LLM call latency (P50/P95/P99), tool call success rate, tokens per request, cost per request, reasoning depth distribution.
2. Configure metric exporters to the chosen backend (Prometheus, Datadog, CloudWatch).
3. Build dashboards showing real-time agent health, cost trends, and performance distributions.
4. Set up SLO-based monitoring with error budget tracking and burn-rate alerts.

### Phase 4: Decision Audit System
1. Design the audit log schema with request context, agent identity, decision rationale, and outcome.
2. Implement append-only audit log storage with cryptographic integrity verification.
3. Build an audit log query interface for compliance investigators and debugging workflows.
4. Configure retention policies aligned with regulatory requirements (30 days to 7 years).

### Phase 5: Anomaly Detection
1. Establish behavioral baselines for key agent metrics (response length, tool call frequency, reasoning depth, cost per request).
2. Deploy statistical anomaly detection (z-score, IQR, isolation forest) on rolling windows.
3. Configure anomaly-triggered actions: increase sampling rate, capture full traces, alert on-call.
4. Build feedback loops where confirmed anomalies update detection thresholds.

### Phase 6: Cost & Latency Optimization
1. Implement per-request cost attribution by tagging each LLM span with model pricing metadata.
2. Build cost breakdown reports by agent, model, tool, and customer/tenant.
3. Perform critical path analysis on latency traces to identify sequential bottlenecks.
4. Implement optimization recommendations: prompt caching, parallel tool calls, model downgrades.

## Extended Troubleshooting Guide

| Symptom | Primary Cause | Mitigation Action |
|---------|---------------|-------------------|
| Traces missing for some agent steps | Async context lost in callback chains | Use OpenTelemetry context propagation utilities; ensure async hooks are instrumented |
| High cardinality metric explosion | Unique trace/request IDs used as metric labels | Use bounded label sets; move unique IDs to trace attributes, not metric labels |
| Reasoning trace shows infinite loop | Agent re-evaluating same observation without progress | Add loop detection middleware; set max_reasoning_steps per request |
| Cost tracking shows $0 for all requests | Model pricing metadata not configured | Configure per-model token pricing in the cost attribution engine |
| Latency P99 10x higher than P50 | Tail latency from cold LLM inference or rate limiting | Implement request hedging; add LLM response caching; monitor rate limit headers |
| Audit log gaps during high traffic | Log buffer overflow dropping entries | Use durable queue (Kafka) between agent and audit log; increase buffer capacity |
| Anomaly detector fires too many false positives | Baselines computed during non-representative period | Retrain baselines on 7+ days of production data; implement adaptive thresholds |
| Distributed trace context not propagating | Missing W3C TraceContext headers in HTTP/gRPC calls | Verify auto-instrumentation covers all HTTP clients; add manual propagation for custom protocols |

## Complete Execution Scenario

```
User Request: "Summarize the Q3 financial report and compare to Q2"
│
▼
┌──────────────────────────────────────────────────────────────┐
│ 1. TRACE INITIATED                                            │
│    trace_id: 4bf92f3577b34da6                                 │
│    root_span: "user_request" (agent-planner-01)               │
│    Sampling decision: RECORD (matches 1% head-based sample)   │
└─────────────────────┬────────────────────────────────────────┘
                      ▼
┌──────────────────────────────────────────────────────────────┐
│ 2. REASONING TRACE CAPTURED                                   │
│    Step 1: [observation] Parse user intent → "compare Q3/Q2"  │
│    Step 2: [thought] Need to retrieve both reports first      │
│    Step 3: [action] tool=doc_retriever input={q: "Q3 report"} │
│    Step 4: [action] tool=doc_retriever input={q: "Q2 report"} │
│    Step 5: [thought] Both retrieved, now analyze differences  │
│    Step 6: [action] tool=llm_analyze input={docs: [q3, q2]}   │
│    Step 7: [result] Summary generated with comparison table   │
└─────────────────────┬────────────────────────────────────────┘
                      ▼
┌──────────────────────────────────────────────────────────────┐
│ 3. METRICS EMITTED                                            │
│    llm_call_count: 3 | tool_call_count: 2                     │
│    total_tokens: 12,847 | total_cost: $0.0193                 │
│    total_latency: 4,230ms | reasoning_depth: 7                │
│    Critical path: LLM analyze (2,100ms) → doc_retriever (890ms)│
└─────────────────────┬────────────────────────────────────────┘
                      ▼
┌──────────────────────────────────────────────────────────────┐
│ 4. AUDIT LOG ENTRY                                            │
│    request_id: req-7f8a9b0c | agent: agent-planner-01        │
│    decision: "Retrieved Q3+Q2 reports, performed comparative  │
│    analysis using claude-sonnet-4-20250514"                             │
│    outcome: SUCCESS | confidence: 0.92                        │
│    hash_chain: sha256(prev_entry + this_entry)                │
└─────────────────────┬────────────────────────────────────────┘
                      ▼
┌──────────────────────────────────────────────────────────────┐
│ 5. ANOMALY CHECK                                              │
│    Reasoning depth 7: within 1σ of baseline (μ=6.2, σ=2.1)  │
│    Cost $0.0193: within normal range                          │
│    Latency 4,230ms: slightly above P90 (3,800ms) → MONITOR   │
│    No anomaly alert triggered                                 │
└──────────────────────────────────────────────────────────────┘
```

## Rules and Guidelines

1. **Never log raw prompts or completions in metrics**: Prompts and completions contain
   sensitive data and have unbounded cardinality. Store them in traces only after
   redacting secrets and PII, behind access controls and a retention limit, never as
   metric labels.

2. **Propagate trace context through every boundary**: Every HTTP call, gRPC call, queue
   message, and sandbox invocation must carry W3C TraceContext headers. Broken trace
   context creates observability blind spots.

3. **Cost attribution must be near real-time**: Runaway loops burn budget in minutes, so
   compute cost at span-completion time from versioned pricing config and alert on
   per-run budgets rather than waiting for the provider invoice.

4. **Audit logs are append-only and immutable**: Once written, audit entries must never be
   modified or deleted within the retention period. Use hash chains plus signed or
   externally anchored checkpoints (or WORM storage) to detect tampering; an unkeyed hash
   chain alone can be recomputed by whoever can rewrite the log.

5. **Alert on absence, not just presence**: Missing traces, gaps in metric streams, and
   silent agents are often more dangerous than explicit errors. Monitor heartbeats and
   expected event rates.

## Reference Guides

- [Reasoning Trace Visualization](references/reasoning-trace-visualization.md) — Visualizing and exploring agent reasoning paths
- [OpenTelemetry Agent Integration](references/opentelemetry-agent-integration.md) — Full OpenTelemetry setup for agent systems
- [Distributed Tracing for Agents](references/distributed-tracing-agents.md) — Cross-agent and cross-service trace propagation
- [Decision Audit Logging](references/decision-audit-logging.md) — Tamper-evident audit log architecture
- [Performance Profiling](references/performance-profiling.md) — Profiling agent performance and identifying bottlenecks
- [Anomaly Detection for Agents](references/anomaly-detection-agents.md) — Statistical and ML-based anomaly detection
- [Cost Tracking & Optimization](references/cost-tracking-optimization.md) — Token cost tracking and optimization strategies
- [Latency Analysis & Optimization](references/latency-analysis-optimization.md) — Critical path analysis and latency reduction

## Handoff

- **sandbox-execution**: Sandbox telemetry is a key input to the observability pipeline
- **prompt-chain-of-thought**: Reasoning traces inform prompt optimization and debugging
- **ai-defense-mechanisms**: Anomaly detection feeds into guardrail monitoring

<!-- COMPRESSION: agent-observability | reasoning-traces + otel + distributed-tracing + audit-logs + anomaly-detection + cost-tracking | v2.0.0 -->

## Implementation Patterns

### Agent Trace Collector

```python
from __future__ import annotations

import secrets
from dataclasses import dataclass
from datetime import datetime, timezone
from typing import Any


def _now() -> str:
    return datetime.now(timezone.utc).isoformat()


class AgentTrace:
    """Minimal in-process span recorder. In production prefer the OpenTelemetry SDK;
    IDs here follow the W3C Trace Context sizes (16-byte trace id, 8-byte span id)."""

    def __init__(self, agent_id: str, session_id: str) -> None:
        self.trace_id = secrets.token_hex(16)  # 32 hex chars
        self.agent_id = agent_id
        self.session_id = session_id
        self.spans: dict[str, dict[str, Any]] = {}
        self.start_time = datetime.now(timezone.utc)

    def start_span(self, name: str, parent_span_id: str | None = None) -> str:
        span_id = secrets.token_hex(8)  # 16 hex chars
        self.spans[span_id] = {
            "span_id": span_id,
            "trace_id": self.trace_id,
            "parent_span_id": parent_span_id,
            "name": name,
            "start_time": _now(),
            "attributes": {},
            "events": [],
            "status": "unset",
        }
        return span_id

    def end_span(self, span_id: str, status: str = "ok", attributes: dict[str, Any] | None = None) -> None:
        span = self.spans.get(span_id)
        if span is None:
            raise KeyError(f"end_span: unknown span_id={span_id} in trace={self.trace_id}")
        span["end_time"] = _now()
        span["status"] = status
        span["attributes"].update(attributes or {})

    def add_event(self, span_id: str, name: str, attributes: dict[str, Any] | None = None) -> None:
        span = self.spans.get(span_id)
        if span is None:
            raise KeyError(f"add_event: unknown span_id={span_id} in trace={self.trace_id}")
        span["events"].append({"name": name, "timestamp": _now(), "attributes": attributes or {}})

    def to_dict(self) -> dict[str, Any]:
        elapsed = datetime.now(timezone.utc) - self.start_time
        return {
            "trace_id": self.trace_id,
            "agent_id": self.agent_id,
            "session_id": self.session_id,
            "duration_ms": elapsed.total_seconds() * 1000,
            "spans": list(self.spans.values()),
        }


@dataclass(frozen=True, slots=True)
class ModelPrice:
    input_per_mtok: float   # USD per 1M input tokens
    output_per_mtok: float  # USD per 1M output tokens


class CostTracker:
    """Prices change often: load them from config (env/JSON) that is versioned and
    reviewed, never hardcode them. Unknown models fail loudly instead of guessing."""

    def __init__(self, pricing: dict[str, ModelPrice]) -> None:
        self.pricing = pricing
        self.entries: list[dict[str, Any]] = []

    def track_call(self, model: str, input_tokens: int, output_tokens: int, agent_id: str) -> float:
        price = self.pricing.get(model)
        if price is None:
            raise KeyError(f"No price configured for model={model} (agent={agent_id}); update pricing config")
        cost = (input_tokens * price.input_per_mtok + output_tokens * price.output_per_mtok) / 1_000_000
        self.entries.append({
            "timestamp": _now(), "agent_id": agent_id, "model": model,
            "input_tokens": input_tokens, "output_tokens": output_tokens, "cost_usd": cost,
        })
        return cost

    def total(self, agent_id: str | None = None) -> float:
        return sum(e["cost_usd"] for e in self.entries if agent_id in (None, e["agent_id"]))

    def by_model(self) -> dict[str, float]:
        out: dict[str, float] = {}
        for e in self.entries:
            out[e["model"]] = out.get(e["model"], 0.0) + e["cost_usd"]
        return dict(sorted(out.items(), key=lambda kv: -kv[1]))
```

When exporting through OpenTelemetry, use the GenAI semantic conventions for span attributes
(`gen_ai.operation.name`, `gen_ai.request.model`, `gen_ai.usage.input_tokens`,
`gen_ai.usage.output_tokens`). They are still marked experimental, so pin the semconv
version you emit and check the spec before upgrading.

## Architecture Decision Trees

### Observability Signal Selection for Agents

```
What aspect of agent behavior to observe?
├── Reasoning path (what the agent thought)
│   └── Reasoning traces: span per reasoning step with input/output
│       ├── Debug incorrect decisions
│       ├── Validate safety constraints
│       └── Optimize prompt chains
│
├── Tool usage (what tools were called)
│   └── Tool call spans: arguments, results, duration
│       ├── Track tool success/failure rates
│       ├── Detect tool misuse patterns
│       └── Measure tool latency impact
│
├── Cost (how much each interaction costs)
│   └── Token tracking per model call
│       ├── Attribution to user/agent/session
│       ├── Budget enforcement
│       └── Cost optimization
│
└── Safety (did the agent violate policies)
    └── Audit events: policy checks, guardrail triggers, violations
        ├── Immutable audit log
        ├── Violation rate trending
        └── Root cause investigation
```

## Anti-Patterns

| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
| Not tracing agent reasoning | Can't debug why agent made wrong decision | Trace every LLM call with input/output |
| Cost tracking with stale pricing | Budget reports are inaccurate | Update pricing table on model/version change |
| No audit log immutability | Tampered logs can't be used for compliance | Cryptographic hash chain on audit entries |
| Alerting on absence without baseline | Too many false positives | Establish baseline metrics, alert on deviation |

## Performance Optimization

- **Sampled reasoning trace storage**: Store full reasoning traces for 1% of sessions. Store abbreviated traces (metadata only) for the rest. Reconstruct full trace on demand via log aggregation.
- **Async cost computation**: Compute cost asynchronously via message queue. Don't block the main agent loop for cost tracking. Batch cost entries for efficient storage.

## References

### Shared References
Additional reference material for this skill, stored outside its own `references/` folder.

- `../error-recovery/references/chaos-testing-agents.md` — Chaos Testing for Agent Harnesses
- `../error-recovery/references/checkpoint-recovery.md` — Checkpoint and Resume for Long-Running Agents
- `../error-recovery/references/dead-letter-processing.md` — Dead-Letter Processing for Agent Tasks
- `../error-recovery/references/error-budget-management.md` — Error Budget Management for Agent Services
- `../error-recovery/references/error-taxonomy-classification.md` — Error Taxonomy and Classification for Agent Systems
- `../error-recovery/references/fallback-chain-patterns.md` — Fallback Chain Patterns for Agents
- `../error-recovery/references/graceful-degradation.md` — Graceful Degradation for Agent Products
- `../error-recovery/references/retry-strategies.md` — Retry Strategies for Agent Harnesses
- `../evaluation-testing/references/eval-dataset-management.md` — Evaluation Dataset Management for LLM and Agent Systems
- `../evaluation-testing/references/hallucination-scoring.md` — Hallucination Scoring for LLM Outputs

Files in this skill

  • SKILL.md30.9 KB
  • references/anomaly-detection-agents.md6 KB
  • references/cost-tracking-optimization.md6.6 KB
  • references/decision-audit-logging.md6.2 KB
  • references/distributed-tracing-agents.md32.3 KB
  • references/latency-analysis-optimization.md5.8 KB
  • references/opentelemetry-agent-integration.md30.8 KB
  • references/performance-profiling.md5.7 KB
  • references/reasoning-trace-visualization.md32.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.