moltrust-crewai
Add trust verification to CrewAI in one line.
moltrust-crewai checks the calling agent's MolTrust trust score before
every tool call in a CrewAI crew. Agents
below your minimum score are blocked (or warned/logged). It hooks into CrewAI's
native hook system — no changes to your agents or tasks.
Install
pip install moltrust-crewai
Usage (one line)
from moltrust_crewai import MolTrustGuardrail
# register the guardrail globally, then run your crew as usual
MolTrustGuardrail(min_score=60).install()
from crewai import Crew
crew = Crew(agents=[...], tasks=[...])
crew.kickoff()
That's it — the guardrail fires automatically on every tool call via
crewai.hooks. No API key required to get started (see tiers below).
Usage Tiers
Tier 1 — No account required
pip install moltrust-crewai
guard = MolTrustGuardrail(min_score=60)
guard.install()
# Reads trust scores without an API key. Rate-limited.
Tier 2 — Free account
guard = MolTrustGuardrail(min_score=60, api_key="mt_...")
# Higher rate limits + interaction feedback (score improvement over time)
The API key (arg or MOLTRUST_API_KEY env) is sent as the X-API-Key header
only when present.
Note on the API: CrewAI 1.x wires middleware through its hook system (
crewai.hooks), not aCrew(callbacks=[...])argument.install()registers thebefore_tool_call/before_llm_callhooks for you. Callguard.uninstall()(or use it as a context manager) to remove them.
Options
MolTrustGuardrail(
min_score=60, # min trust score, 0-100 scale (see below)
action="block", # "block" | "warn" | "log" | "raise"
agent_did_map={ # map a CrewAI agent role → its MolTrust DID
"Researcher": "did:moltrust:0123456789abcdef",
},
did_key="did", # or read the DID from tool_input["did"]
pass_without_did=True, # allow calls with no resolvable DID
)
What it does
Before every tool call, MolTrustGuardrail resolves the calling agent's
MolTrust DID (via agent_did_map or a did in the tool input) and reads its
trust score from GET /skill/trust-score/{did}. min_score is on the
MolTrust trust score scale (0–100, behavioral trust) — not the 0–5
reputation/rating scale. The CrewAI hook contract is simple: the hook returns
False to block the tool call, or None/True to allow it.
Trust scores are recomputable — you never have to take MolTrust's word for a number. Verify the on-chain solvency component of any agent independently:
https://api.moltrust.ch/credits/solvency/{did}
Difference from Microsoft AGT
Microsoft's Agent Governance Toolkit enforces policies — what an agent may do (scope, sandboxing, zero-trust identity). MolTrust verifies behavioral trust — is this agent trustworthy, based on verifiable history. They are complementary, not competing: use AGT to bound authority, use MolTrust to decide who has earned it.
Honest limitations (0.1.0)
- CrewAI agents have no MolTrust DID by default — you map them explicitly via
agent_did_map, or carry adidin the tool input. There is no magic auto-binding yet. min_scoreis on the 0–100 MolTrust trust score (trust_scorefrom/skill/trust-score/{did}), the phase-2 behavioral score — not the 0–5 reputation/rating average.- A withheld score (registered agent with too few endorsements → API
returns
trust_score: null, withheld: true) is treated like an unregistered agent: fail-closed inblock, fail-open inwarn/log. - On a registry/transport error the guardrail fails open (allows the call, logs a warning) so a MolTrust hiccup never breaks your crew.
before_llm_callis a no-op placeholder (a hook point for injecting trust context into prompts); extend it as needed.
License
MIT © CryptoKRI GmbH — see LICENSE.
Metadata
Release files for moltrust-crewai 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| moltrust_crewai-0.1.2.tar.gz | 10.1 kB | Without provenance | Details for moltrust_crewai-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| moltrust_crewai-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for moltrust_crewai-0.1.2-py3-none-any.whl |
Total release size: 18.7 kB
Release files / moltrust_crewai-0.1.2.tar.gz
| Download URL | moltrust_crewai-0.1.2.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9309c86e7e9b80dfb6896ca9efc8a682ac428a19ed957baf9de9a45d80f90598
|
|
BLAKE2b-256 checksum How to use checksums |
d5fb2a5d08c9f0b50f9fb757b9c21b2df04907420a65fe570bfb378d3212816e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / moltrust_crewai-0.1.2-py3-none-any.whl
| Download URL | moltrust_crewai-0.1.2-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c917b5a77d288597c51df6ba568c9c1a99fb74882058b22a2492776978ddf5b5
|
|
BLAKE2b-256 checksum How to use checksums |
1422fedc0894bcaa1471ea5d6a6eea54c7455d7c174197199b7092d87c5e95a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for moltrust-crewai 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.