agent-observability

agent-observability is a skill for Claude Code, Codex from khalilbenaz/claude-skills-collection. It costs 115 tokens per session (2,539 once invoked), scanned B, original, MIT.

A technique for recording how an AI agent works, including its model calls, tool calls, logs, and performance measurements. It can use traces, spans, custom metrics, and dashboards to connect events across an agent or agent pipeline.

In plain words
What is it for?
Use it to instrument Python or TypeScript agents with OpenTelemetry, record structured inputs and outputs, measure steps such as retrieval and model calls, and monitor connected agent workflows.
Why use it?
It makes delays, errors, delegation, retrieval quality, and other runtime behavior easier to inspect. The approach varies depending on whether the system is autonomous, multi-agent, retrieval-based, or sequential.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit Use it to instrument Python or TypeScript agents with OpenTelemetry, record structured inputs and outputs, measure steps such as retrieval and model calls, and monitor connected agent workflows.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/khalilbenaz/claude-skills-collection/agent-observability
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add khalilbenaz/claude-skills-collection --skill agent-observability
Clone the repo
git clone --depth 1 https://github.com/khalilbenaz/claude-skills-collection

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agent-observability

README.md
[![agentmods](https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/agent-observability/github.svg)](https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/agent-observability)
Your own site
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/agent-observability"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/agent-observability/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for agent-observability

Your own site · 80×15
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/agent-observability"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/agent-observability.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 115 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,539 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00115 $0.02539
Opus 5 $0.00057 $0.01269
Sonnet 5 $0.00023 $0.00508
Haiku 4.5 $0.00012 $0.00254

Measured 12d ago against content hash 9ebd1fb82ae2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade B, and why

agent-observability scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

requests.post("http://sub-agent/run", json=payload, headers=headers)

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

requests.post("http://sub-agent/run", json=payload, headers=headers)
agent-skills/agent-observability/SKILL.md · 263 lines

How it starts

The opening of the file, as written. The whole thing — 263 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent Observability

Workflow

1. Choisir la stratégie d'instrumentation

Identifie les trois piliers à couvrir selon le type d'agent :

Type d'agent Traces Métriques prioritaires Logs
Agent autonome (ReAct) Chaque itération reason→act tokens/iter, nb iterations prompt + tool calls
Orchestrateur multi-agents Spans parent→enfant par sous-agent latence inter-agents, taux délégation handoff payloads
Agent RAG Retrieval + LLM call séparés recall@k, rerank score, latence retrieval query + docs retenus
Pipeline séquentiel Un span par étape du pipeline throughput, erreurs par étape inputs/outputs chaque step

Critère de décision : si tu as plus de 2 agents en chaîne → distributed tracing obligatoire. Agent isolé → métriques + logs structurés suffisent pour commencer.


2. Instrumenter avec OpenTelemetry

Installer le SDK Python ou TypeScript selon le runtime :

# Python
pip install opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation-httpx

# TypeScript / Node
npm install @opentelemetry/sdk-node @opentelemetry/exporter-otlp-http @opentelemetry/instrumentation-http

Initialiser le tracer en entrée de l'agent (une seule fois) :

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import BatchSpanProcessor

provider = TracerProvider(resource=Resource({"service.name": "my-agent", "agent.version": "1.0"}))
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter(endpoint="http://otel-collector:4318")))
trace.set_tracer_provider(provider)
tracer = trace.get_tracer(__name__)

Wrapper minimal autour des appels LLM :

def call_llm(prompt: str, model: str = "claude-sonnet-4-6") -> str:
    with tracer.start_as_current_span("llm.call") as span:
        span.set_attributes({
            "llm.model": model,
            "llm.prompt_tokens": count_tokens(prompt),
            "llm.prompt_hash": sha256(prompt)[:8],  # pas le texte en clair
        })
        response = client.messages.create(model=model, messages=[{"role": "user", "content": prompt}])
        span.set_attributes({
            "llm.completion_tokens": response.usage.output_tokens,
            "llm.cost_usd": estimate_cost(response.usage),
        })
        return response.content[0].text

Read the full file on GitHub · 263 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 263 lines · 115 tokens per session scan B 9ebd1fb82ae2

Subscribe to this mod's changes

agent-observability is a skill published in the GitHub repository khalilbenaz/claude-skills-collection (22 stars, last pushed 18d ago), licensed MIT. It adds 115 tokens to every session and 2,539 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it B with 2 findings (sends data to an external url, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.