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.2.tar.gz (73.5 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.2-py3-none-any.whl (71.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pisama-0.5.2.tar.gz
  • Upload date:
  • Size: 73.5 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.2.tar.gz
Algorithm Hash digest
SHA256 598196b8e4f9c983db109c9d2930ba95f0928de1c5d004a1f9024d7a88738aee
MD5 13fe7cf01f7e19b295e6005efd59df70
BLAKE2b-256 ea5e1650692dd1f7b50538060b647d80dc0976e9d1372f42d5125ab772e01614

See more details on using hashes here.

Provenance

The following attestation bundles were made for pisama-0.5.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: pisama-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 71.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3b477fe3d6f1dc073908ae2dee39bf7075a46dd5a79e6a89993c46cb5bc574c7
MD5 5e746d16341d7e7cec6282c0a09f0925
BLAKE2b-256 f7fdf0693a5c06cc219398e3743a752d12012f7fa08696bddf8aa714efb4cbd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pisama-0.5.2-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