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
Metadata
Release files for failsafe-ai 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| failsafe_ai-0.1.1.tar.gz | 24.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| failsafe_ai-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.9 kB
Release files / failsafe_ai-0.1.1.tar.gz
| Download URL | failsafe_ai-0.1.1.tar.gz |
|---|---|
| Size | 24.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50cace2b8f8872983632ff7e2300f779b862542e14b0c89cf7a001dd21d7da8a
|
|
BLAKE2b-256 checksum How to use checksums |
42f86e0c2f4967b8db975ddc5289fa9a2587e28becf002849846d8cb62261561
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Release files / failsafe_ai-0.1.1-py3-none-any.whl
| Download URL | failsafe_ai-0.1.1-py3-none-any.whl |
|---|---|
| Size | 24.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc397cf5d7c00e0f725e3903c5a0e26a5fa7ca0d124a339dc624e015c63472bf
|
|
BLAKE2b-256 checksum How to use checksums |
7b2b28dc3e3e84584affd49fc142ddca97ea5dcb67fc70fda8144e4938f54930
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|