Runtime tool-output scanning for Cohere agents. Detects and blocks prompt injection attacks in tool results.
Project description
safehere
Runtime tool-output scanning for Cohere agents.
Every existing MCP/agent security tool scans the input side: tool descriptions, metadata, call permissions. But CyberArk proved that the most dangerous attacks come through tool outputs — the tool's description and code are clean, but it returns poisoned responses containing hidden instructions that the model follows.
safehere is a Python middleware that sits between when a tool returns its result and when that result gets passed back to Cohere's model. It scans every tool output for injected instructions, schema anomalies, and behavioral drift, then blocks or sanitizes suspicious results before they ever reach the model's context window.
Features
- Pattern Detection: Catches known injection signatures, encoded payloads, and instruction-like language in data fields
- Schema Drift Detection: Detects when tools suddenly return different-shaped data than expected
- Anomaly Detection: Identifies output size/entropy deviations from tool baselines
- Configurable Policies: Per-tool policies for log, warn, block, or halt decisions
- Audit Trail: Full structured logging of all scan decisions
Installation
pip install safehere
Usage
from cohere import Client
from safehere import ToolGuard
client = Client(api_key="...")
guard = ToolGuard(client=client, tools=[...])
# Use in your tool-use loop
response = guard.run_with_protection(model="command-r", ...)
Documentation
Full documentation coming soon.
License
MIT
Project details
Release history Release notifications | RSS feed
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 safehere-0.0.1.tar.gz.
File metadata
- Download URL: safehere-0.0.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e23d1aa65967f7fb6b050f2452813824dcab06dc03989d0c8ceac71692848cb
|
|
| MD5 |
78cb2539e494f7be27a8304de376b851
|
|
| BLAKE2b-256 |
5b639ed775181265ca9db06dc9657f6a7fc054abc34ac685dd28e9bf71de9ef4
|
File details
Details for the file safehere-0.0.1-py3-none-any.whl.
File metadata
- Download URL: safehere-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24a7808aa30ed440668ef70a71443974949371cc9f9619be61bcb81b53e06139
|
|
| MD5 |
8baa844b889100f3ffd7029ee64895c8
|
|
| BLAKE2b-256 |
a15aacefeb03b88a552d55cb18477f4c77de4a795f8b4fb557a393742a10d2dd
|