Skip to main content

komodor-agentops

Python SDK for AgentOps observability, including the worker runtime, with optional extras for framework integrations (LangChain, Claude Agent SDK, ADK, Agno).

Install

pip install komodor-agentops

# With framework adapters
pip install komodor-agentops[langchain]
pip install komodor-agentops[claude-code]
pip install komodor-agentops[adk]
pip install komodor-agentops[agno]
pip install komodor-agentops[all]           # Everything

Quick Start

@observe() decorator

Wrap functions to emit span events automatically:

from komodor_agentops import observe

@observe(name="summarize", as_type="llm")
async def summarize(text: str) -> str:
    ...

AgentOps client (lightweight event buffer)

from komodor_agentops import AgentOps

client = AgentOps(agent_id="my-agent", endpoint="http://localhost:8000")
await client.log("Processing started", run_id="run_1")
await client.flush()

TransportClient (full controlplane client)

For direct controlplane interaction (heartbeat, run lifecycle, event ingest):

from komodor_agentops import TransportClient, AgentSpec

agent = AgentSpec(agent_id="my-agent", agent_card={"name": "My Agent"})
async with TransportClient(endpoint="http://localhost:8000", worker_id="wrk_1", agent=agent) as ops:
    await ops.heartbeat()
    run = await ops.start_run_direct("run_1", input_payload={"prompt": "hello"})
    await ops.emit_span_start(run_id="run_1", span_id="s1", name="tool", span_kind="tool")
    await ops.emit_span_end(run_id="run_1", span_id="s1", name="tool", span_kind="tool")
    await ops.complete_run("run_1", output={"result": "done"})

AgentOpsWorker (unified server)

Run a worker with A2A protocol + AgentOps streaming:

from pathlib import Path

from komodor_agentops import AgentOpsWorker, AgentSpec, A2AMessage, A2ATask

spec = AgentSpec.from_dir(
    Path(__file__).parent,
    agent_card={"skills": [{"id": "search", "name": "search"}]},
)

async def handler(message: A2AMessage) -> A2ATask:
    return A2ATask(id=message.task_id, status={"state": "completed"})

worker = AgentOpsWorker(agent=spec, handler=handler)
await worker.serve(host="0.0.0.0", port=8010)

The standard AgentOps agent layout is:

my_agent/
  agent-spec.yaml
  agent.md
  worker.py
  skills/
    triage.md
    rca/SKILL.md

AgentSpec.from_dir(Path(__file__).parent, ...) requires agent-spec.yaml, then loads agent.md and skills/ automatically. The worker registers loaded skills during heartbeat, and SDK-owned LLM adapters can prepend the agent context at invocation time.

schema_version: 1
agent_id: my-agent
name: My Agent
description: Does useful work.
owner: AgentOps
repo: https://github.com/komodorio/agentops
source_path: packages/workers/my_agent
labels:
  category: example

To make a worker available in the AgentOps Chat UI, advertise chat capability on its agent card:

spec = AgentSpec(
    agent_id="my-chat-agent",
    agent_card={
        "name": "My Chat Agent",
        "capabilities": {"chat": True, "ask": True, "streaming": True},
    },
)

Control plane chat sessions invoke the selected worker over A2A with input data that includes messages (conversation history), model, and prompt (latest user text). A2A message parts use the proto-style shape accepted by AgentOpsWorker, such as {"text": "..."} and {"data": {...}}.

Framework Adapters

LangChain

from komodor_agentops.langchain import KomodorCallbackHandler

handler = KomodorCallbackHandler(ops=transport_client, controlplane_run_id="run_1")
chain.invoke(input, config={"callbacks": [handler]})

Claude Code

Install hooks that forward Claude Code events to the controlplane:

install-cc-hooks --endpoint http://localhost:8000

SDK hooks for claude-agent-sdk:

from komodor_agentops.claude_code.sdk_hooks import agent_ops_hooks_for_run

hooks = agent_ops_hooks_for_run("run_1")

Architecture

komodor-agentops
  agentops-rpc, agentops-otel (wire types + OTel bootstrap)
  fastapi, uvicorn, a2a-sdk (worker/server runtime)
  httpx, pydantic, pydantic-settings, croniter, pyyaml, python-frontmatter
    |
    +-- [langchain]   -> langchain-core
    +-- [claude-code] -> claude-agent-sdk
    +-- [adk]         -> google-adk
    +-- [agno]        -> agno, anthropic
    +-- [server]      -> no-op alias (kept so existing [server] refs resolve)

Package Structure

src/komodor_agentops/
  __init__.py       # Public API
  _client.py        # Event buffer + flush
  _transport.py     # Full controlplane HTTP client
  _context.py       # TraceContext + ContextVar
  _events.py        # AgentOpsEvent dataclass
  _flush.py         # Async event batching
  _observe.py       # @observe() decorator
  _rpc.py           # JSON-RPC helpers
  _types.py         # Internal SDK types (AgentSpec, RunJob, etc.)
  worker.py         # AgentOpsWorker facade
  py.typed          # PEP 561 marker
  a2a/              # A2A protocol bridge
  stream/           # SSE/JSON-RPC streaming
  hooks/            # Reporter + heartbeat
  langchain/        # LangChain callback handler
  claude_code/      # Claude Code integration

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

komodor_agentops-0.1.0.tar.gz (164.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

komodor_agentops-0.1.0-py3-none-any.whl (134.1 kB view details)

Uploaded Python 3

File details

Details for the file komodor_agentops-0.1.0.tar.gz.

File metadata

  • Download URL: komodor_agentops-0.1.0.tar.gz
  • Upload date:
  • Size: 164.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for komodor_agentops-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cab5e4faaff8aab62aebc23420d72a9e62dfdb6c36274dd2b02bdc337299e61b
MD5 77707e4f045ae0d602bd8d30ffec910f
BLAKE2b-256 e243be777b5932adce984600895f70374d3f0363ad631fdf4b0d695db2b21c51

See more details on using hashes here.

File details

Details for the file komodor_agentops-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: komodor_agentops-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 134.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for komodor_agentops-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c93c1eb28ce4bd3cb6d88ab9acf218b22b89341dfffc8af6e6bc93d5c9136277
MD5 add74c2168d68d92425587bf58feb6c4
BLAKE2b-256 60aa51db4adbb0412d59ba3b7c2911bcf93a6fe797ba163991e99770a3dc7dae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page