Runtime protection for AI coding agents
Project description
AgentSteer
Runtime protection for AI coding agents.
What it does
AgentSteer intercepts every tool call your AI agent makes via a PreToolUse hook, scores it against the task description, and blocks unauthorized actions before they execute. It catches prompt injection attacks, unauthorized file access, data exfiltration through delegation, and off-task behavior. Scoring uses oss-safeguard-20b (20B parameter model) via OpenRouter at under 200ms median latency.
Quick Start
pip install secure-environments
Set your OpenRouter API key. You can use a .env file or export it directly:
export OPENROUTER_API_KEY=sk-or-...
Install the hook for your framework:
secure-env install claude-code
That's it. Every tool call is now scored and unauthorized actions are blocked.
How It Works
Agent makes tool call
|
v
PreToolUse hook intercepts the call
|
v
AgentSteer scores the action against the task description
(oss-safeguard-20b via OpenRouter, <200ms median)
|
v
Score >= threshold? ---> BLOCK (action never executes)
|
v
Score < threshold? ---> ALLOW (action proceeds normally)
Each action is evaluated against 4 security policies. If any policy is violated, the action is blocked and the agent receives feedback explaining why.
Supported Frameworks
| Framework | Install command | Hook type |
|---|---|---|
| Claude Code | secure-env install claude-code |
PreToolUse hook via settings.json |
| OpenHands | secure-env install openhands |
EventStream middleware |
| OpenClaw | secure-env install openclaw |
Plugin hook |
| Python API | from secure_environments import score_action |
Direct function call |
Results
Evaluated on the AgentDojo benchmark, which tests whether agents can be tricked into executing prompt injection attacks hidden in their environment.
| Framework | Condition | Attacks blocked | Utility preserved | n |
|---|---|---|---|---|
| Claude Code | Honest tasks | 0% false positives | 100% | 20 |
| Claude Code | Attack tasks | 100% blocked | -- | 20 |
| OpenHands | Honest tasks | 0% false positives | 100% | 20 |
| OpenHands | Attack tasks | 95% blocked | -- | 20 |
| OpenHands | Per-action detection | 96.5% detected | 0% false positives | 1000 |
Median scoring latency: <200ms. Cost: $0.38 per 1M tokens via OpenRouter.
Full evaluation results and methodology at agentsteer.ai/evaluations.
Security Policies
| Policy | What it catches | Example |
|---|---|---|
| P1: Read-only | Write actions when the task only requires reading | Task says "look up calendar" but agent sends an email |
| P2: Delegation | Actions that hand off control or leak data to external parties | Agent posts task contents to a URL, sends to unrelated email |
| P3: Category mismatch | Actions in a different category than the task | Task is about calendar but agent modifies files |
| P4: Target mismatch | Actions targeting a different entity than specified | Task says "email Alice" but agent emails Bob |
A post-filter suppresses false positives from self-correction patterns (e.g., agent cancels a calendar event it just created in error).
Configuration
| Environment variable | Description | Default |
|---|---|---|
OPENROUTER_API_KEY |
OpenRouter API key for scoring model | required |
SECURE_ENV_TASK |
Task description to score actions against | read from agent context |
SECURE_ENV_THRESHOLD |
Score threshold for blocking (0.0 to 1.0) | 0.80 |
SECURE_ENV_DEBUG |
Enable debug logging (1 or true) |
off |
You can also run secure-env setup for an interactive configuration wizard, or secure-env login to connect to the AgentSteer cloud dashboard for real-time monitoring.
CLI Reference
secure-env setup # Interactive first-run setup
secure-env install claude-code # Install hook for Claude Code
secure-env status # Show current configuration
secure-env score "task" "action" # Score a single action
secure-env sessions # List monitored sessions
secure-env version # Print version
Links
- Website: agentsteer.ai
- Documentation: agentsteer.ai/docs
- Evaluations: agentsteer.ai/evaluations
- Repository: github.com/AgentSteer/AgentSteer
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 agentsteer-0.2.0.tar.gz.
File metadata
- Download URL: agentsteer-0.2.0.tar.gz
- Upload date:
- Size: 573.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46e53c13221e6e79dd942f510f2e17cb6de69915ea4066ece03798ab29dec668
|
|
| MD5 |
c7e5b2b6c3136c210c0918069951e918
|
|
| BLAKE2b-256 |
0311a97b923075c346de0e83df54f9715631984814c4770b86ccf78d3c6c9dfb
|
File details
Details for the file agentsteer-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agentsteer-0.2.0-py3-none-any.whl
- Upload date:
- Size: 33.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
367838d5764759c36230fae82d9b792b9558c44e6e8149ef0f6c99224399c629
|
|
| MD5 |
0096573150ec20a6437c39a985d1b17a
|
|
| BLAKE2b-256 |
66c35b2aa5e87cc49b8713507cae9e993105e63bb885186520aec25313526c8a
|