Agent observability

Caveman vs AgentOps: agent replays plus token compression

AgentOps records and replays agent sessions and tracks cost. Caveman Middleware shrinks tool output before each model call. How they fit and what a span shows.

By CavemanReviewed 7 min readRead Markdown ↗
Where Caveman fits
  1. 01Find the heavy agent in AgentOps
  2. 02Wrap that agent's model with Caveman
  3. 03Run the crew twice, tagged
  4. 04Compare sessions and results

Keep AgentOps. Caveman works with it. AgentOps tells you which agent in your crew made which calls, what they cost, and where a run went sideways. Caveman Middleware makes the big inputs in those calls smaller: a researcher's 20,000-token search dump or a full log file gets sent to the model as a short copy, with the original a tool call away. One records the run, the other trims what the run sends, and AgentOps is a good way to see whether the trimming changed anything that matters.

What is AgentOps?

AgentOps is an observability and debugging platform for AI agents. You add two lines, import agentops and agentops.init(), and the SDK instruments supported providers and frameworks it finds installed. Each run becomes a session you can replay step by step: LLM calls shown as chat history, tool calls, multi-agent handoffs, errors, timings and a cost breakdown. The homepage pitch is "rewind and replay agent runs with point in time precision", and that session replay is what most people install it for.

It fits multi-agent Python stacks especially well. There is built-in instrumentation for CrewAI, AG2 and AutoGen, the OpenAI Agents SDK, LangChain and LangGraph, Agno, Google ADK, smolagents, Haystack and CamelAI, plus providers like OpenAI, Anthropic, Google GenAI and LiteLLM. Under the hood the SDK is built on OpenTelemetry. A TypeScript SDK exists and is marked alpha.

The Python SDK and the dashboard app are both MIT licensed on GitHub (about 5.9k stars when we checked), and the repo ships a Docker Compose setup for running the app yourself. The hosted plans on the homepage: Basic is free up to 5,000 events, Pro is $40 a month with unlimited events and log retention, and Enterprise is custom with self-hosting on AWS, GCP or Azure.

Does Caveman work with AgentOps?

Yes, with no adapter in between. AgentOps instruments your code from the outside, and Caveman Middleware wraps the framework or model client inside it. You keep agentops.init() where it is and change the line that builds the agent or client.

Before each model call, the middleware finds eligible tool results in the outbound request (file reads, API responses, command output, extracted documents) and swaps them for a shorter copy made by a local Caveman runtime. Your application keeps its original history. The model gets a caveman_retrieve tool to pull the full original back when it needs detail. User messages, system prompts, reasoning, errors, and image or PDF bytes are not touched.

Several of the frameworks AgentOps traces have native Caveman adapters in the Python package caveman-middleware: CrewAI, AutoGen, LangChain and LangGraph, Agno, LiteLLM, plus the OpenAI, Anthropic and Google Gen AI clients. The package is alpha.

Which copy does an AgentOps span record?

It depends on where Caveman sits relative to AgentOps's hook, and we checked both codebases.

Direct OpenAI or Anthropic clients: the text is the original, the tokens are the smaller request. AgentOps wraps chat.completions.create and messages.create and records the messages your code passed in. Caveman's adapters rewrite the request below that point. The span's prompt text therefore shows the full tool output, while its token usage comes from the provider response, which counts what was actually sent. Don't be surprised when a span shows 20,000 tokens of JSON next to a much smaller input count.

CrewAI: check your replay. Caveman's CrewAI adapter wraps the agent's LLM and hands the shortened view down to the model it wraps. AgentOps hooks CrewAI's LLM.call, which is the LiteLLM-backed class. CrewAI 1.x sends names like gpt-4.1-mini to its native provider classes instead, and while CrewAI is instrumented AgentOps skips its own provider hooks. So whether a model span appears, and which copy it holds, depends on how your crew builds its LLM. The tool usage span shows what your tool really returned either way.

A shortened result begins with [caveman: shortened; exact original via caveman_retrieve handle=cmw_…]. Search a replay for caveman: shortened to confirm which copy your setup records.

AgentOps vs Caveman: feature comparison

What you needAgentOpsCaveman Middleware
Session replay of an agent runYes, core featureNo
Multi-agent handoffs and tool callsYesNo, one decision report per call
Cost tracking per sessionYesNo, local counts are inferred
Error and loop debuggingYesNo
Shrink a 20k-token tool resultNoYes, original recoverable
Keep the agent's history unchangedNot its concernYes, only the outbound copy changes
Works with CrewAI and AutoGenYesYes, native adapters
Self hostDocker Compose, MIT; Enterprise optionRuntime runs next to your app
StatusReleased; TypeScript SDK alphaAlpha

How do you check Caveman did not hurt the crew?

Run the same crew on the same inputs twice and let AgentOps record both. Tag them so they're easy to pull apart: agentops.start_trace("triage", tags=["caveman-record"]) for the baseline and tags=["caveman-compress"] for the candidate. Start the runtime in compress mode and flip the middleware client between record and compress, so nothing else differs.

Then judge the final deliverable with the acceptance check you already use, whether that is a test suite, a rubric or a human reading both reports. AgentOps shows you why a run differed; your check says whether the result is still right. Look at three things in the replays:

  1. Did any agent call caveman_retrieve? Each recovery is a round trip carrying the original back. Count it.
  2. Did the crew take extra turns, retries or delegations? A shorter view that makes the writer ask twice isn't a saving.
  3. What did total provider-reported tokens do across every agent in the session?

Caveman's published numbers can't answer this for you. The docs show a 400-line worker log going from 8,399 tokens to between 177 and 187 over sixteen runs, counted with o200k_base and labelled inferred. The middleware page reports 13 synthetic samples, also inferred, and states that task quality was not measured. Your two AgentOps sessions are the real test.

When should you use AgentOps alone?

Use AgentOps alone when you can't yet say which agent is expensive. Compression aimed at the wrong step is wasted effort, and a crew of five gives you five places to guess wrong.

Use it alone when the problem is a crash, a loop or a delegation that never ends. That is a workflow bug. Smaller messages just make each lap cheaper.

Use it alone when your agents pass short messages. If no tool returns more than a few hundred tokens, Caveman has nothing worth shortening.

When does adding Caveman make sense?

Add Caveman when an AgentOps replay shows one large payload riding through many calls: a researcher's search results pasted into three later prompts, or a log file an analyst agent keeps in context for ten turns. That repeated tool output is exactly what the middleware shortens.

If agents run on different hosts, every agent that might call caveman_retrieve needs to reach the same runtime. The deployment docs cover a shared runtime over TLS with a token. For terminal coding agents, use Caveman Proxy instead.

How to add Caveman to an AgentOps-traced crew

Start the runtime, wrap one agent with with_caveman_agent, keep agentops.init() as is, and run the tagged pair. The full walkthrough with code and a rollback is in add Caveman to AgentOps.

FAQ

Is Caveman an AgentOps alternative? No. AgentOps records and replays agent runs. Caveman reduces the input tokens those runs send. They stack.

Will AgentOps cost numbers drop with Caveman? Where tool output is large and AgentOps records the model call, yes: it reads token usage from the provider response, which counts the shortened request.

Does AgentOps see my original tool output? Tool spans do. Model spans depend on the integration, as described above.

Does Caveman have its own dashboard? Caveman Cloud, a hosted workspace, is open for sign-up with a Free plan. For replays today, use AgentOps.

Sources

Try it on work you know

Keep your stack. Add the adapter.

Wrap the client or framework you already call, run one agent task you can check, and compare the tokens sent.

Open the middleware docs Explore comparisons ↗