Skip to main content

Multi-agent failure detection for production AI systems

Project description

Pisama

Find and fix failures in AI agent systems. No LLM calls required.

PyPI License: MIT Python 3.10+

Pisama ships 32 core heuristic detectors plus framework-specific detectors for n8n, LangGraph, Dify, and OpenClaw, running locally with zero LLM cost on the heuristic tier. On the TRAIL benchmark, Pisama's purpose-built detectors reach 59.9% joint accuracy (span and category) vs. about 11% for general-purpose LLMs doing open-ended failure analysis. Precision is 100% on the categories they flag (zero false positives), and micro-recall is about 60%, so the heuristic tier alone still misses roughly 40% of failures; the tiered pipeline escalates to LLM judges for better coverage on the rest.

Install

pip install pisama

Usage

from pisama import analyze

result = analyze("trace.json")  # also accepts dicts and JSON strings

for issue in result.issues:
    print(f"[{issue.type}] {issue.summary} (severity: {issue.severity})")
    print(f"  Fix: {issue.recommendation}")

CLI

pisama analyze trace.json          # Analyze a trace
pisama watch python my_agent.py    # Watch a live agent (pip install pisama[auto])
pisama replay <trace-id>           # Re-run detection on stored traces
pisama smoke-test --last 50        # Batch test recent traces
pisama detectors                   # List all 32 core detectors
pisama mcp-server                  # Start MCP server (pip install pisama[mcp])

MCP Server

Works in Cursor, Claude Desktop, Windsurf — no API key needed:

{
  "mcpServers": {
    "pisama": { "command": "pisama", "args": ["mcp-server"] }
  }
}

Detectors

32 core detectors plus framework-specific detectors for n8n, LangGraph, Dify, and OpenClaw. A representative selection:

Detector What It Catches
loop Infinite loops, retry storms, stuck patterns
coordination Deadlocked handoffs, message storms
hallucination Factual errors, fabricated tool results
injection Prompt injection, jailbreak attempts
corruption State corruption, type drift
persona_drift Persona drift, role confusion
derailment Task deviation, goal drift
context Context neglect, ignored instructions
specification Output vs. requirement mismatch
communication Inter-agent message breakdown
decomposition Poor task breakdown, circular dependencies
workflow Unreachable nodes, missing error handling
completion Premature completion, unfinished work
withholding Suppressed findings, hidden errors
convergence Metric plateau, regression, thrashing
overflow Context window exhaustion
delegation Delegation quality and task handoff failures
grounding Claims not supported by source documents
retrieval_quality Poor retrieval relevance or coverage
compaction_quality Information loss during context compaction

Benchmark Results

TRAIL (trace-level failure detection, 148 traces):

Method Joint Accuracy
GPT-5.4 11.9%
Gemini 3.1 Pro 6.8%
Pisama 60.2%

Who&When (ICML 2025, multi-agent attribution, 58 hand-crafted cases):

Method Agent Accuracy Step Accuracy
GPT-5.4 Mini 60.3% 22.4%
Pisama + Sonnet 4 60.3% 24.1%

Links

License

MIT

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

pisama-0.5.1.tar.gz (73.2 kB view details)

Uploaded Source

Built Distribution

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

pisama-0.5.1-py3-none-any.whl (70.9 kB view details)

Uploaded Python 3

File details

Details for the file pisama-0.5.1.tar.gz.

File metadata

  • Download URL: pisama-0.5.1.tar.gz
  • Upload date:
  • Size: 73.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pisama-0.5.1.tar.gz
Algorithm Hash digest
SHA256 2decca643feea7ea6fed2337542f5fea9d9b9d79f9e5beb82ac8400ac9183f0f
MD5 8dc47784304c34739db915eae15c0eca
BLAKE2b-256 32a81d2b8a3cfd525e26e038c98fa22a8abac1f52f247cbce68323e56407fc0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pisama-0.5.1.tar.gz:

Publisher: publish.yml on Pisama-AI/pisama

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pisama-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: pisama-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 70.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pisama-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9376b2ebbc148cde6d5c85fba2f37b082f99ac23441bbbf32d607b1fe1bc52aa
MD5 4d9e3ec2e72018ea8459ac26de51d46d
BLAKE2b-256 dad65f6402be3cbd4c9c8e48084766f688b14cd6e034b712e9e2deab4178f409

See more details on using hashes here.

Provenance

The following attestation bundles were made for pisama-0.5.1-py3-none-any.whl:

Publisher: publish.yml on Pisama-AI/pisama

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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