The Active Reliability Layer for AI Agents
Project description
Steer SDK
Active Reliability Layer for AI Agents.
Steer is an open-source Python library that intercepts agent failures (hallucinations, bad JSON, PII leaks) and allows you to inject fixes via a local dashboard without changing your code.
The Problem
When an agent fails in production (e.g., outputs bad JSON), logging the error isn't enough. You usually have to:
- Dig through logs to find the prompt.
- Edit your prompt template manually.
- Redeploy the application.
The Solution
Steer wraps your agent function. When it detects a failure, it blocks the output and logs it to a local dashboard. You click "Teach" to provide a correction (e.g., "Use Strict JSON"), and Steer injects that rule into the agent's context for future runs.
Visual Workflow:
Installation
pip install steer-sdk
Quickstart
Generate the example scripts to see the workflow in action:
steer init
# Generates 01_structure_guard.py, 02_safety_guard.py, etc.
steer ui
# Starts the local dashboard at http://localhost:8000
Run a demo (Split-screen recommended):
- Run
python 01_structure_guard.py. It will fail (Blocked). - Go to
http://localhost:8000. Click Teach. Select "Strict JSON". - Run
python 01_structure_guard.pyagain. It will succeed.
Usage
Steer uses a decorator pattern to wrap your existing functions.
from steer import capture
from steer.verifiers import JsonVerifier
# 1. Define Verifiers
json_check = JsonVerifier(name="Strict JSON")
# 2. Decorate your Agent Function
@capture(verifiers=[json_check])
def my_agent(user_input, steer_rules=""):
# 3. Pass 'steer_rules' to your system prompt.
# Steer populates this argument automatically based on your teaching.
system_prompt = f"You are a helpful assistant.\n{steer_rules}"
# ... Your LLM call ...
return llm.call(system_prompt, user_input)
Data Engine: From Guardrails to Fine-Tuning
Steer does not just catch errors; it creates the dataset needed to fix them permanently.
Every time a rule is applied or an agent succeeds, Steer logs the interaction. You can export these logs into a standard fine-tuning format (JSONL) compatible with OpenAI and other providers.
Export Training Data
Run this command to convert your local logs into a dataset:
steer export
Output: steer_fine_tune.jsonl
Format:
{"messages": [{"role": "system", "content": "..."}, {"role": "user", "content": "..."}, {"role": "assistant", "content": "{\"valid\": \"json\"}"}]}
The Fine-Tuning Workflow
- Capture: Run your agent with Steer. Fix issues in the Dashboard.
- Export: Run
steer exportto generate the dataset. - Train: Upload
steer_fine_tune.jsonlto OpenAI/Anthropic to fine-tune a model. - Remove: Once the model is trained, you can often remove the strict guardrails, reducing latency.
Configuration
The Quickstart demos use a Mock LLM and require no API keys.
To use advanced LLM-based verifiers in production, set your environment variables:
export GEMINI_API_KEY=...
# OR
export OPENAI_API_KEY=...
What is the "Confident Idiot" Problem?
The Confident Idiot is a failure mode where an LLM generates a factually incorrect or structurally broken response with high probability (confidence).
Unlike traditional software that crashes when it fails, LLMs fail silently and plausibly.
- Example: User asks "Weather in Springfield". The agent confidently guesses "Springfield, IL" (ignoring the fact that there are 33 other Springfields in the USA).
- The Fix: Steer prevents this by enforcing Reality Locks (deterministic checks) that run after generation but before the user sees the response.
Read the viral discussion on Hacker News.
Star History
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 steer_sdk-0.2.7.tar.gz.
File metadata
- Download URL: steer_sdk-0.2.7.tar.gz
- Upload date:
- Size: 456.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.9 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff5bc5fe44908b37a114b85c9137aa4868281245401e1be2ed131f6ae9845a1d
|
|
| MD5 |
751b67964a494eed1fc71b4e20095168
|
|
| BLAKE2b-256 |
8a723ddd60c72e1867f2e92aa63a89adda445d8296a7e035f4b7113af6d35d8e
|
File details
Details for the file steer_sdk-0.2.7-py3-none-any.whl.
File metadata
- Download URL: steer_sdk-0.2.7-py3-none-any.whl
- Upload date:
- Size: 474.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.9 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d92908300af3292438de3b47c62c5baf3f306938e90421340adbd731fb7d5d6f
|
|
| MD5 |
e57cf199bf31b11eea222cc185aecf23
|
|
| BLAKE2b-256 |
f28d12aec755da9392abe1bc631d368c25ad173a3be8c16c78e3aa2b5ebc019a
|