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. They apply across frameworks including n8n, LangGraph, Dify and OpenClaw, with per-platform gating (for example coordination runs only on multi-agent platforms). They run locally with zero LLM cost on the heuristic tier. An archived, in-distribution run on the TRAIL benchmark reports 59.9% joint accuracy (span and category). It is not a held-out result: 144 of the 148 traces appeared in calibration material, and the published archive does not contain the prediction-level data needed to recompute joint accuracy. The public confusion counts do reproduce the reported macro-F1 (0.7535) and micro-F1 (0.7463). See the benchmark evidence and its reproducibility boundary.

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, and Windsurf. No API key is needed:

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

Detectors

32 core detectors, gated per platform (n8n, LangGraph, Dify, OpenClaw and others). 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
propagation Silent error propagation across steps
citation Fabricated citations and source misattribution
routing Inputs misrouted to the wrong specialist agent
mcp_protocol MCP tool-communication failures

Benchmark Results

TRAIL (trace-level failure detection, 148 traces). Archived April 2026 run, in-distribution and not held out: 144 of 148 traces appeared in calibration material.

Method Joint Accuracy
Pisama archived run 59.9%

Reproducible from the archive: macro-F1 0.7535, micro-F1 0.7463 (benchmarks/verify_report.py). Joint accuracy is not recomputable from the public archive, which lacks prediction-level data. LLM-judge baselines are omitted here because trail_llm_baselines.json carries confusion counts but "result": null for every model, so no comparable joint-accuracy figure exists in the artifact. See the reproducibility boundary.

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

Source boundary

This repository is the public source for the MIT-licensed pisama Python package. It does not contain the Pisama Cloud backend, dashboard, calibration data, managed detection tiers, or paid automation.

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.6.tar.gz (77.8 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.6-py3-none-any.whl (71.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pisama-0.5.6.tar.gz
Algorithm Hash digest
SHA256 e55657581235d5a7b015441097aaf4b47a66b5346a896820689a75cc475a9135
MD5 1b880074430dcc4fb7ffdc3115028b8e
BLAKE2b-256 0e743496ffcb886b0026c5b0c2c553386da4f6a50e7b25d361e0979bd1e81325

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on Pisama-AI/pisama-python

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.6-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pisama-0.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a24056f3bd56fef318ea2940fd2f6c8b7756300e1286954b2a49580afecc2138
MD5 1b2b94718e5c5d841c475b55f13d18d5
BLAKE2b-256 27451d08e1caaa3a263211deb43c783c081db43c29adc83e6de2d21ec6d3ec92

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on Pisama-AI/pisama-python

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