Skip to main content

The Active Reliability Layer for AI Agents

Project description

Steer Logo

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.

PyPI version

The Problem

When an agent fails in production (e.g., outputs bad JSON), logging the error isn't enough. You usually have to:

  1. Dig through logs to find the prompt.
  2. Edit your prompt template manually.
  3. 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:

Steer Dashboard

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):

  1. Run python 01_structure_guard.py. It will fail (Blocked).
  2. Go to http://localhost:8000. Click Teach. Select "Strict JSON".
  3. Run python 01_structure_guard.py again. It will succeed.

Cookbook

For complex, real-world implementations, explore the cookbook/ directory.

RAG Reliability

This example demonstrates how to enforce strict data schemas and grounding citations in a Retrieval-Augmented Generation (RAG) pipeline.

  • Pydantic Schema Enforcement: Ensuring the agent always returns a valid, typed data structure.
  • Citation Verification: Hard-locking the agent to cite its sources, preventing ungrounded claims.

View RAG Cookbook

Integration

Steer uses a decorator pattern to wrap your existing functions. To add Steer to your own existing agent, just add steer_rules to your function arguments.

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

  1. Capture: Run your agent with Steer. Fix issues in the Dashboard.
  2. Export: Run steer export to generate the dataset.
  3. Train: Upload steer_fine_tune.jsonl to OpenAI/Anthropic to fine-tune a model.
  4. 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

Star History Chart

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

steer_sdk-0.2.9.tar.gz (457.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

steer_sdk-0.2.9-py3-none-any.whl (475.3 kB view details)

Uploaded Python 3

File details

Details for the file steer_sdk-0.2.9.tar.gz.

File metadata

  • Download URL: steer_sdk-0.2.9.tar.gz
  • Upload date:
  • Size: 457.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.9 Darwin/24.6.0

File hashes

Hashes for steer_sdk-0.2.9.tar.gz
Algorithm Hash digest
SHA256 a7bd585a68936bde82cc11534b84d29a1012ff51e35cb98f623002fd07a35c75
MD5 efe2be3b55b19b150d23e828e321390d
BLAKE2b-256 9320b819be740139b4322c48a67199f6464854809cfc5a9b979a983335ebb55e

See more details on using hashes here.

File details

Details for the file steer_sdk-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: steer_sdk-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 475.3 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

Hashes for steer_sdk-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 d7381a0efecfa7fb6c8be684dcb6191c48df1186b4383e53c3a449096320ed4c
MD5 9dcbcb1e8803389637513d84d68610a0
BLAKE2b-256 b12d3983d426967cecb657be7789f7690ed5e0603184097bef55b49549632cf5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page