agent-ops
Agent Operations
Agent Lifecycle
- Instrument —
@opik.track+entrypoint=True+opik.AgentConfig - Configure — Externalize config into
AgentConfig. Opik manages Blueprints with env tags (dev/prod) - Connect —
opik connect --pair <CODE> <startup_cmd>to pair with Opik UI - Evaluate — Evaluation Suites with assertions and execution policies
- Monitor — Dashboards, online evaluation, alerts, guardrails
- Optimize — MaskIDs for config A/B testing, promote winning Blueprints
Config + Retrieval
class AgentConfig(opik.AgentConfig):
model: Annotated[str, "LLM model"]
temperature: Annotated[float, "Sampling temperature"]
client = opik.Opik()
client.create_agent_config_version(
AgentConfig(model="gpt-4o", temperature=0.7), project_name="my-agent",
)
@opik.track(entrypoint=True, project_name="my-agent")
def run_agent(question: str) -> str:
cfg = client.get_agent_config(
fallback=AgentConfig(model="gpt-4o", temperature=0.7),
project_name="my-agent",
latest=True, # or env="prod" or version="v1"
)
return llm_call(model=cfg.model, temperature=cfg.temperature)
Promote: cfg.deploy_to("prod"). Retrieve prod: env="prod".
Local Runner
opik connect --pair ABC123 python3 app.py # Python
opik connect --pair ABC123 npx tsx app.ts # TypeScript
Python: @track(entrypoint=True) + type-hinted parameters.
TypeScript: track({ entrypoint: true, params: [{name, type}] }, fn).
Evaluation Suites
suite = client.get_or_create_evaluation_suite(
name="my-suite",
assertions=["Response is accurate", "Response is professional"],
execution_policy={"runs_per_item": 3, "pass_threshold": 2},
)
results = suite.run(task=lambda item: {"output": agent(item["input"])}, model="gpt-4o")
assert results.all_passed
Threads (Conversations)
@opik.track(entrypoint=True)
def handle_message(session_id: str, message: str) -> str:
opik.update_current_trace(thread_id=session_id)
return generate_response(session_id, message)
Anti-Patterns
| Anti-Pattern | Fix |
|---|---|
| Hardcoded config | Use AgentConfig + get_agent_config() |
| Missing entrypoint | Add entrypoint=True for Local Runner |
| No thread_id on conversational agent | Wire thread_id from session ID |
get_agent_config() outside @track |
Must be inside decorated function |
TS missing params |
Add explicit params array |
References
references/agent-patterns.md— architecture, reliability, securityreferences/evaluation.md— suites, 41 built-in metricsreferences/production.md— dashboards, alerts, guardrails
More from comet-ml/opik-skills
opik
Opik observability for LLM agents — Agent Configuration, Local Runner (opik connect), Test Suites, threads, integrations. Use for "configure my agent", "connect my agent", "evaluate my agent" or "integrate with Opik".
151instrument
Add Opik tracing to an existing codebase. Detects language (Python/TypeScript), identifies LLM frameworks, adds appropriate decorators and integrations, marks entrypoints, and wires up environment config. Use for "instrument my code", "add opik tracing", "add observability", or "trace my agent".
135agent-config
Opik Agent Configuration — Blueprints, get_agent_config() with selectors, environment tags, Prompt/ChatPrompt fields, deploy_to(), MaskIDs, and config lifecycle.
5opik-connect
Opik Connect (Local Runner) — pair your local agent with the Opik browser UI for Python and TypeScript.
5instrument-typescript
Adding Opik observability to TypeScript/JS LLM apps — track() with entrypoint and explicit params for Local Runner, framework integrations.
5evaluation-suites
Opik Evaluation Suites — assertions, execution policies, CI integration. Replaces old Datasets API.
5