Skip to main content

When your agent fails, this tells you exactly why.

Project description

AgentAutopsy

When your agent fails, this tells you exactly why.

Why this exists

Every time an AI agent fails, you get a useless stack trace. No context. No reason. No fix. AgentAutopsy gives you the exact failure step, root cause, and a verified fix — automatically.

demo

Python License Zero Config Works with

CLI

agentautopsy runs # see all agent runs agentautopsy replay # replay any failure agentautopsy stats # fix cache stats

Install

pip install agentautopsy

Examples

# Basic usage
import agentautopsy
agentautopsy.watch()

# LangChain
from agentautopsy import get_callback_handler
handler = get_callback_handler()
agent.run(input, config={"callbacks": [handler]})

# LangGraph
from agentautopsy import get_langgraph_handler
handler = get_langgraph_handler()
graph.invoke(input, config={"callbacks": [handler]})

# CrewAI
from agentautopsy import get_crewai_handler
handler = get_crewai_handler()
crew = Crew(agents=[...], callbacks=[handler])
# Slack alerts
export AGENTAUTOPSY_SLACK_WEBHOOK=https://hooks.slack.com/...

# Web UI
agentautopsy ui

# CLI
agentautopsy runs
agentautopsy replay <run_id>
agentautopsy stats

LangGraph

import agentautopsy
from agentautopsy import get_langgraph_handler

agentautopsy.watch()
handler = get_langgraph_handler()

# Pass the handler into LangGraph invoke config
result = graph.invoke(
    {"messages": [("user", "research competitors")]},
    config={"callbacks": [handler]},
)

The handler records node start/end, edge traversals, state updates between nodes, tool and LLM activity, and any graph errors in agentautopsy.db.

CrewAI

import agentautopsy
from agentautopsy import get_crewai_handler
from crewai import Crew

agentautopsy.watch()
handler = get_crewai_handler()

crew = Crew(agents=[researcher, writer], tasks=[...], callbacks=[handler])
crew.kickoff()

# Or use step_callback on Crew / Agent (supported by current CrewAI releases)
crew = Crew(agents=[...], step_callback=handler.step_callback)

The handler records task start/end, tool usage, agent handoffs, final crew output, and errors.

Usage

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

AgentAutopsy automatically intercepts every LLM call, detects failures, finds root cause, outputs a verified fix, and caches it for next time.

Why AgentAutopsy vs LangSmith / Helicone?

Feature AgentAutopsy LangSmith Helicone
Works offline
Zero config
Replay failed runs partial
AI debug assistant
Prompt diffing partial
Divergence detection
Free and open source partial
No cloud required

Setup

Windows: set ANTHROPIC_API_KEY=your-key-here Mac/Linux: export ANTHROPIC_API_KEY=your-key-here Get your free key at console.anthropic.com

Set AGENTAUTOPSY_SLACK_WEBHOOK=your-webhook-url and AgentAutopsy will automatically alert your Slack channel when any agent fails.

Quick start

Create test_agent.py and paste this:

import agentautopsy
agentautopsy.watch()

Run: python test_agent.py

Works with

OpenAI, Anthropic, LangChain, LangGraph, CrewAI, any framework using openai or anthropic

Requirements

Python 3.11+, ANTHROPIC_API_KEY

License

Apache 2.0

Roadmap

  • VS Code extension
  • GitHub Actions integration
  • Multi-agent tracing
  • Auto-fix applier
  • LangChain support
  • LangGraph support
  • CrewAI support
  • Slack alerts
  • Web UI
  • Prompt diffing
  • Divergence detection

Project details


Download files

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

Source Distribution

agentautopsy-1.5.0.tar.gz (6.4 MB view details)

Uploaded Source

Built Distribution

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

agentautopsy-1.5.0-py3-none-any.whl (46.9 kB view details)

Uploaded Python 3

File details

Details for the file agentautopsy-1.5.0.tar.gz.

File metadata

  • Download URL: agentautopsy-1.5.0.tar.gz
  • Upload date:
  • Size: 6.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agentautopsy-1.5.0.tar.gz
Algorithm Hash digest
SHA256 f351c25cf8faecfb3b210cb5302ff891525e8b56df1826f0efd14f95450a57bc
MD5 7a37576ff5d483d59b8a4fb04f1cc7ae
BLAKE2b-256 715add68fe2f4da9c80720b207a799bb4df548738af3bc37b9f4c2c404a3b798

See more details on using hashes here.

File details

Details for the file agentautopsy-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: agentautopsy-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 46.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agentautopsy-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34df71dcbbbd0d127d3bb8c2e68aedea6bf8d369bee170563152e73ef3b2338d
MD5 2a8afb0814ffb8087d3749a7a8c1ab52
BLAKE2b-256 4310c89ff284e2e1b6e2da7cf5983fc784067ac5c458ebc41c8f6a168675b2a6

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 Pingdom Monitoring Sentry Error logging StatusPage Status page