Skip to main content

Trust-based circuit breaking for multi-agent AI systems

Project description

fulcrum-trust

Trust-based circuit breaking for multi-agent AI systems.

CI PyPI Python 3.9+ Apache 2.0

What is this?

fulcrum-trust implements a Beta distribution trust model for agent-to-agent relationships. When an agent pair's trust score drops below a configurable threshold, the circuit breaks — terminating the interaction before runaway loops occur.

The math: every interaction updates a Beta(α, β) distribution. Trust score = α / (α + β). Starting at (1.0, 1.0) gives an uninformative prior of 0.5. Scores decay exponentially toward 0.5 over time (stale relationships revert to uncertainty).

Quick Start

from fulcrum_trust import TrustManager, TrustOutcome

# Default: in-memory store, threshold=0.3, 24-hour decay half-life
tm = TrustManager()

# Record interaction outcomes
tm.evaluate("orchestrator", "code-agent", TrustOutcome.SUCCESS)
tm.evaluate("orchestrator", "code-agent", TrustOutcome.SUCCESS)
tm.evaluate("orchestrator", "code-agent", TrustOutcome.FAILURE)

# Check trust
print(tm.get_trust_score("orchestrator", "code-agent"))  # 0.6

# Circuit break check — use this in your agent loop
if tm.should_terminate("orchestrator", "code-agent"):
    raise RuntimeError("Circuit open — trust degraded below threshold")

Persist across sessions with FileStore:

from fulcrum_trust import TrustManager, TrustOutcome, TrustConfig
from fulcrum_trust.stores import FileStore

tm = TrustManager(
    store=FileStore("trust_state.json"),
    config=TrustConfig(threshold=0.3, half_life_seconds=3600),  # 1-hour decay
)

Send trust events to Fulcrum backend with FulcrumStore:

from fulcrum_trust import FulcrumStore, TrustManager, TrustOutcome

tm = TrustManager(
    store=FulcrumStore(
        api_key="your-fulcrum-api-key",
        base_url="https://api.fulcrumlayer.io",  # or local dashboard URL
    )
)

tm.evaluate("orchestrator", "code-agent", TrustOutcome.SUCCESS)

FulcrumStore writes locally first and then best-effort ships events to POST /api/trust/events using X-API-Key. If the network call fails, the agent keeps running and local trust state remains available.

Install

pip install fulcrum-trust

# Optional numpy fast path for decay math:
pip install "fulcrum-trust[numpy]"

Documentation

Development

git clone https://github.com/Fulcrum-Governance/fulcrum-trust
cd fulcrum-trust
pip install -e ".[dev]"
pytest              # Run tests (requires >=95% coverage)
mypy fulcrum_trust/ # Type check (strict mode)
ruff check .        # Lint
ruff format .       # Format

Architecture

fulcrum_trust/
├── types.py        — TrustOutcome enum, TrustState, TrustConfig dataclasses
├── evaluator.py    — TrustEvaluator: Beta(α,β) scoring, pair_id generation
├── decay.py        — Exponential decay toward uninformative prior
├── manager.py      — TrustManager: orchestrates evaluator + store + decay
└── stores/
    ├── base.py     — TrustStore Protocol (structural subtyping)
    ├── memory.py   — MemoryStore (default, in-process)
    ├── file.py     — FileStore (JSON-backed, cross-session)
    └── fulcrum.py  — FulcrumStore (local-first + backend event shipping)

License

Apache 2.0. See LICENSE.

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

fulcrum_trust-0.1.0.tar.gz (492.4 kB view details)

Uploaded Source

Built Distribution

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

fulcrum_trust-0.1.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file fulcrum_trust-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for fulcrum_trust-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51102243d56a961746dbe8d27daa48b8f320e58a16d7c8b05a131b94ea3db490
MD5 fcf9d91fe7265e146f49ca321d36d13c
BLAKE2b-256 72aab8cbd2eadc249ffd00c7d9dc298b00efda520385c9e80fab7c5544601743

See more details on using hashes here.

Provenance

The following attestation bundles were made for fulcrum_trust-0.1.0.tar.gz:

Publisher: publish.yml on Fulcrum-Governance/fulcrum-trust

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

File details

Details for the file fulcrum_trust-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for fulcrum_trust-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9191a541f3b65e86c0b4830e82988e9e5b48ab4379e8222af5684c98f28a3dfa
MD5 980d40bdc1b551bd6b553ec01529a2f7
BLAKE2b-256 0781b71bdeebd7b22013ea2d0c435bb488297df45d08db1352f6b46a6abaf374

See more details on using hashes here.

Provenance

The following attestation bundles were made for fulcrum_trust-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Fulcrum-Governance/fulcrum-trust

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