Catalog PyPI
PACKAGE EXPLORERView in registry

agentautopsy

PyPI

Post-mortem debugger for AI agents

ai-agentsdebuggingllmobservability
Versions collected1
Direct dependencies6From release 2.4.0
Last observed20 Oct, 21:31 UTC

README

Version 2.4.0 documentation

AgentAutopsy

PyPI version Downloads GitHub stars License: MIT Python 3.8+

The post-mortem debugger for AI agents. When your agent fails silently — AgentAutopsy tells you exactly why.

Lifecycle

Install  →  Watch  →  Fail  →  Trace  →  Replay  →  Fix
   │          │        │         │          │        │
 pip      watch()   silent   SQLite     rewind    auto-fix
install              failure   log      + fork    + cache
StageWhat happens
Installpip install agentautopsy — no cloud account, no config file
Watchagentautopsy.watch() intercepts LLM, HTTP, MCP, and tool calls
FailAgent errors or returns bad output; run is marked in local SQLite
TraceFull event timeline: prompts, tools, schemas, tokens, timestamps
ReplayRewind to any step, fork with new input, diff original vs replay
FixRoot-cause report, AI chat on trace, verified fix cached for next run

Commands

What you're doingCommandKey principle
Zero config setupagentautopsy.watch()One import catches everything
View trace UIagentautopsy uiVisual timeline of every step
Replay a failureagentautopsy replay --run-id <id> --from-step <n>Rewind to exact failure point
Detect schema driftSchemaDriftDetector().watch()Catch API changes before production
Trace MCP serversMCPAutopsy().watch_mcp_server()Every MCP call recorded
Fork and fixDVRReplay().fork(run_id, at_step=3)Branch from any step
Generate tests from failuresagentautopsy generate-evalsNever fix the same bug twice
Detect runaway loopsagentautopsy loopsNever get a surprise $400 bill again
Monitor context usageagentautopsy context --run-id <id>See exactly which step is eating your context

Quick Start

pip install agentautopsy
import agentautopsy

agentautopsy.watch()
# your existing agent code — nothing else changes

Features

FeatureWhat It DoesUse When
MCP Post-Mortem TracingTraces every MCP server call, shows bad data sourceUsing Claude Code, Cursor, any MCP client
Schema Drift DetectorDetects renamed/removed/added fields automaticallyAfter any API or tool upgrade
DVR Fork and ReplayRewind, replay, fork from any stepDebugging production failures
Swarm TracingCausality tracing across 50+ agentsMulti-agent workflows
AI Chat on TraceAsk questions about your failureWhen root cause is unclear
Prompt DiffingCompare runs side by sideOptimizing agent behavior
Contract CheckpointingEnforces Pydantic schemas and checkpoints valid statesPreventing late-stage failures caused by early bad data
Automatic Eval GenerationGenerates pytest test cases from every failure automaticallyWhen you want to make sure the same failure never happens again
Runaway Loop DetectorDetects repeated tool calls and kills agent when cost exceeds thresholdWhen you want to prevent $400 bills from runaway agents
Context Window MonitorTracks context usage per step, warns at 70% and 90%, detects silent truncationWhen your agent starts giving garbage answers near context limit

Framework Support

Works with: LangChain, LangGraph, CrewAI, AutoGen, LlamaIndex, OpenAI, Anthropic, MCP

Module Quick Start

Basic

import agentautopsy

agentautopsy.watch()

MCP

from agentautopsy import MCPAutopsy

MCPAutopsy().watch_mcp_server("my-mcp-server")

Schema Drift

from agentautopsy import SchemaDriftDetector

SchemaDriftDetector().watch()

DVR Replay

from agentautopsy import DVRReplay

dvr = DVRReplay()
dvr.replay(run_id, from_step=3)
dvr.fork(run_id, at_step=3, new_input={"query": "fixed prompt"})

Auto Eval Generation

from agentautopsy import EvalGenerator

gen = EvalGenerator()
gen.generate_all()  # generates tests from all recorded failures

Loop Detector

from agentautopsy import LoopDetector

detector = LoopDetector(max_cost_usd=1.00, max_iterations=20)
detector.watch()

Context Monitor

from agentautopsy import ContextMonitor

monitor = ContextMonitor()
monitor.watch()

Contract Checkpointing

from agentautopsy import ContractCheckpointer
from pydantic import BaseModel

class OutputSchema(BaseModel):
    __rules_version__ = "1.0"  # Optional: bump to force cache invalidation on external dependency drift
    summary: str

checkpointer = ContractCheckpointer(run_id)
# Fails immediately if invalid, otherwise saves state to SQLite for resuming.
# Automatically normalizes and hashes the AST (Abstract Syntax Tree) of the validator, global constants, and helper functions to detect logic drift without false positives!
validated = checkpointer.enforce("step_1", raw_output, OutputSchema)

Contributing

Fork the repo, open a PR with tests. See CONTRIBUTING.md for setup and CI commands.

License

MIT — see LICENSE.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
2.4.018 Jun 20266

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
abhisekhpatel/agentautopsy

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:31 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:7e08c4f834468d1f91e8305543e22620e54eea066697ab881c2b58fb72a765dc