instrument

A command that adds Opik monitoring to an existing AI application by detecting supported frameworks and applying the matching integration. It first checks project dependency files and loads guidance about tracing and agent operations.

In plain words
What is it for?
Use it to add tracing to applications built with supported AI frameworks, after checking files such as requirements.txt, pyproject.toml, or package.json.
Why use it?
It helps avoid missing frameworks that use dynamic or delayed imports. The dependency check gives the command a fuller view of what the application needs to instrument.

Command

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.

agentmods
npx agentmods add commands/comet-ml/opik-claude-code-plugin/instrument
Clone the repo
git clone --depth 1 https://github.com/comet-ml/opik-claude-code-plugin
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,566 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00017 $0.02566
Opus 5 $0.00009 $0.01283
Sonnet 5 $0.00003 $0.00513
Haiku 4.5 $0.00002 $0.00257

Measured 2d ago against content hash 5d8087913660, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

instrument scanned grade A with 0 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 2d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/instrument.md · 134 lines

How it starts

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

Add Opik Observability

Add tracing to the user's code so their LLM application is observable in Opik.

User request: $ARGUMENTS

Step 1: Load the Skills

Use the Skill tool to load BOTH of these skills before doing anything else:

  1. opik — Opik SDK reference: all integrations, tracing patterns, span types, code snippets
  2. agent-ops — Agent architecture patterns, evaluation, what to trace and why

Load them both now. Do not proceed until both are loaded.

Step 2: Discover Frameworks from Dependencies (Do This FIRST)

Do NOT rely only on import statements. Code may use dynamic imports (__import__, importlib), factory patterns, or lazy loading that makes frameworks invisible to import scanning.

Instead, start by reading dependency manifests to build a checklist of frameworks that MUST be instrumented:

  1. Read dependency files — check requirements.txt, pyproject.toml, setup.py, setup.cfg, Pipfile, package.json (for TypeScript/Node)
  2. Build a framework checklist — for each dependency that has an Opik integration (OpenAI, Anthropic, LangChain, CrewAI, LlamaIndex, etc.), add it to your checklist
  3. Note ALL languages — if the project has both Python files AND TypeScript/JavaScript files (check for package.json, tsconfig.json, *.ts, *.js), you must instrument BOTH languages

This checklist is your source of truth. Every framework on it must be accounted for by the end.

Step 3: Trace the Agent Flow

Now read the code to understand how it actually works. Follow the execution flow, don't just scan files in isolation:

  1. Find entry points — look for if __name__ == "__main__", CLI commands, HTTP handlers, exported functions. There may be MULTIPLE entry points.
  2. Trace the call graph — from each entry point, follow function calls to understand the full execution path. Read every file that gets called.
  3. Find where each framework on your checklist is actually used — it may be behind factories, registries, decorators, proxies, or dynamic imports. Search for:
    • The framework's package name in strings (e.g., "openai", "anthropic", "crewai" as arguments to __import__() or importlib.import_module())
    • Class names from the framework (e.g., OpenAI, Anthropic, ChatOpenAI, Agent, Crew)
    • If you can't find where a dependency from the checklist is used, search the entire codebase for its package name as a string
  4. Identify existing tracing — check if there's already tracing code. Verify it actually sends to Opik (not a homegrown stub or different tracing system). If it's fake or non-Opik, replace it.

Read the full file on GitHub · 134 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. 2d ago First seen · 134 lines · 17 tokens per session scan A 5d8087913660

Subscribe to this mod's changes

instrument is a command published in the GitHub repository comet-ml/opik-claude-code-plugin (22 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 17 tokens to every session and 2,566 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.