crewai-relayshield
A pre-execution gate for CrewAI. Before an agent connects to an MCP server or installs a tool it found on its own, RelayShield is asked about the target, and the call is refused if the answer is bad.
pip install crewai-relayshield
from crewai_relayshield import install
install() # registers a before_tool_call hook with CrewAI
That is the whole integration. The hook fires only for tools that connect or
install something (DEFAULT_PROTECTED_TOOLS); pass tools=[...] to name your
own.
What it does
install() registers a before_tool_call hook. When a protected tool is about
to run, the gate pulls the target out of the tool's arguments, calls
RelayShield's mcp-registry-risk check, and maps the answer to one of four
actions:
| Check said | Action | Tool call |
|---|---|---|
| a finding | DENY |
blocked |
| nothing known against it | ALLOW |
proceeds |
| unknown, or only partly checkable | REVIEW |
blocked |
| the check itself failed | DEFER |
blocked (see below) |
Returning False from a CrewAI before-hook aborts the call, which is what
blocking means here.
Fail-closed by default, and why
Only ALLOW proceeds. A gate that lets the call through when the check fails is
not a gate: anyone who can cause a timeout or a 429 has removed it, and those
are cheap to cause.
That does couple your agent's availability to ours, which is a real cost and your decision rather than ours:
install(fail_open=True)
fail_open releases DEFER only, meaning a check that could not be
completed. A completed check that said REVIEW still blocks, and a
FINDING always blocks. There is no setting that lets a known-bad target
through.
Without CrewAI
The decision path has no framework import, so you can use it behind any pre-execution chokepoint, or test it on its own:
from crewai_relayshield import decide
allowed, decision = decide({"server_url": "https://example.invalid/mcp"})
print(allowed, decision.action, decision.reason_codes)
What it never claims
The check reports what is known against a target. "No known finding" is an absence of evidence, not proof that something is safe, and this package does not upgrade one into the other anywhere in its output.
Configuration
| Env var | Meaning |
|---|---|
RELAYSHIELD_API_KEY |
subscription key; without it the API answers 402 and the gate defers |
RELAYSHIELD_API_URL |
override the API base (defaults to https://api.relayshield.net) |
Get a key, including a free tier: https://api.relayshield.net/developers?source=pypi
Licence
MIT.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crewai_relayshield-0.1.0.tar.gz.
File metadata
- Download URL: crewai_relayshield-0.1.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98ebc29bfb83fa3977c8b2134970faa8c12897c38c5a653ba30387c99848e938
|
|
| MD5 |
daea5075f43553cede85ad0bc9f4055a
|
|
| BLAKE2b-256 |
e1ffdd764281e0b087e635e042689fee03e4408afeff69f94852d20f07daf3a7
|
File details
Details for the file crewai_relayshield-0.1.0-py3-none-any.whl.
File metadata
- Download URL: crewai_relayshield-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ecd76cf54f532aeea29f9ac696e7aa3440e531f80087a5c04dbbdf3b556129a
|
|
| MD5 |
23361d772c407ea2910e6547235ffe12
|
|
| BLAKE2b-256 |
91279e09ef0843fb55ee7d32bfa137b67548cf2ded56d4370e07ee308da27568
|