Skip to main content

Contract testing and compliance validation for multi-agent AI systems

Project description

FailSafe

Contract testing and compliance validation for multi-agent AI systems.

Built by PhT Labs.

Install

pip install failsafe-ai

Quick Start

from failsafe import FailSafe

fs = FailSafe(mode="block")

# Register agents
fs.register_agent("research_agent")
fs.register_agent("writer_agent")

# Define a contract between them
fs.contract(
    name="research-to-writer",
    source="research_agent",
    target="writer_agent",
    allow=["query", "sources", "summary"],
    deny=["api_key", "internal_config"],
    require=["query", "sources"],
)

# Validate a handoff
result = await fs.handoff(
    source="research_agent",
    target="writer_agent",
    payload={
        "query": "AI safety",
        "sources": ["arxiv.org/1234"],
        "api_key": "sk-secret-123",  # blocked
    },
)

print(result.passed)       # False
print(result.violations)   # Denied fields found in payload: ['api_key']

Features

  • Validate in milliseconds — Deterministic contract rules execute without LLM calls.
  • Prevent data leakage — Allow/deny field lists and sensitive pattern detection block data from crossing agent boundaries.
  • Compliance policies — Pre-built policy packs for finance regulations and GDPR.
  • LLM-as-judge — Natural language rules evaluated by an LLM for nuanced validation.
  • Full audit trail — Every handoff logged to SQLite with violations, timestamps, and trace IDs.
  • Warn or block modes — Choose per-contract whether violations log warnings or actively block handoffs.

Integrations

pip install failsafe-ai[langchain]

Includes LangChain callback handler, LangGraph integration, and @validated_tool decorator.

Dashboard

failsafe dashboard

Real-time visualization of validation events via WebSocket.

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

failsafe_ai-0.1.1.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

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

failsafe_ai-0.1.1-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file failsafe_ai-0.1.1.tar.gz.

File metadata

  • Download URL: failsafe_ai-0.1.1.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for failsafe_ai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 50cace2b8f8872983632ff7e2300f779b862542e14b0c89cf7a001dd21d7da8a
MD5 c2ba358bb42b8bf42147819c12a13a88
BLAKE2b-256 42f86e0c2f4967b8db975ddc5289fa9a2587e28becf002849846d8cb62261561

See more details on using hashes here.

File details

Details for the file failsafe_ai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: failsafe_ai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for failsafe_ai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fc397cf5d7c00e0f725e3903c5a0e26a5fa7ca0d124a339dc624e015c63472bf
MD5 ac61fe96529f2e3c21f35ecf59e03abc
BLAKE2b-256 7b2b28dc3e3e84584affd49fc142ddca97ea5dcb67fc70fda8144e4938f54930

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