Skip to main content

Reliability layer for AI agents - monitors workflow adherence and intervenes when agents deviate

Project description

Open Bias — Open Source Reliability Harness

PyPI PyPI Downloads Python License GitHub Stars

English · 简体中文 · 日本語 · 한국어

Make your agents follow rules.

Open Source Reliability Harness. Zero config. Zero latency. Works with any LLM provider.

Open Bias is a reliability harness that sits between your app and your LLM provider and enforces rules defined in RULES.md at runtime. Point your app at the proxy, and intervene on off-policy behavior before it reaches your users, your tools, or your production systems.

Open Bias terminal playground showing runtime policy enforcement in a terminal


Quickstart

pip install openbias
export ANTHROPIC_API_KEY=sk-ant-...    # or OPENAI_API_KEY, GEMINI_API_KEY
openbias serve

Point your existing client at http://localhost:4000/v1:

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:4000/v1",          # only change
    api_key="sk-ant-..."
)

response = client.chat.completions.create(
    model="anthropic/claude-sonnet-4-5",
    messages=[{"role": "user", "content": "Hello!"}]
)

Open Bias ships with a starter RULES.md and synthesizes a default evaluator -- no config file needed. Edit RULES.md to add your own rules. Add openbias.yaml when you want to customize engines, tracing, or enforcement behavior.


What It Looks Like

Your RULES.md:

- Maximum discount is 15%.
- Never reveal internal pricing, cost basis, or margin data.

Without Open Bias:

User:   I'll switch to your competitor unless you cut me a deal.
Agent:  I'd hate to lose you! Here's 40% off for 12 months.
        Just between us, our cost is only $2/seat so this still works.

With Open Bias:

User:   I'll switch to your competitor unless you cut me a deal.
Agent:  I can offer you 15% off your next renewal. Want me to apply it?

If Open Bias is useful, consider starring the repo -- it helps others find it.


Why Teams Use It

  • System prompts and AGENTS.md files stop working at scale. The more rules you add to a prompt, the less reliably the model follows any of them. Complex policies, multi-step workflows, and cross-agent constraints need enforcement that does not depend on the model choosing to comply.
  • Evals and observability tell you what went wrong. Open Bias prevents it. Evals run after the fact. Dashboards show you the failure. Open Bias evaluates live traffic and can intervene, block, or shadow in real time -- before the bad behavior reaches your users.
  • RULES.md is a control surface your whole team can own. Plain Markdown that lives in your repo. Review it in a PR, diff it across deploys, version it alongside your code. No vendor dashboard, no policy DSL, no separate system to maintain.
  • Plug in different engines for different concerns. Workflow enforcement, domain-specific rules, and content safety do not all need the same evaluator. Open Bias lets you run multiple engines side by side -- use a small specialized model for fast classification, a judge LLM for nuanced policy, or Nvidia's NeMo for content safety. You are not locked into burning tokens on your primary provider for every check.
  • Zero latency by default. Non-critical violations evaluate async and apply on the next turn. Critical violations are blocked and fixed immediately. The proxy never becomes the bottleneck.

Why This Exists

You told the agent not to do something. It did it anyway.

Every developer building on LLMs hits this. You write more rules, add more guardrails to the prompt -- and the model follows them less reliably the longer the list gets.

  • You say "never delete user data" and the agent calls DROP TABLE users on the next turn.
  • You say "do not share internal pricing" and the agent includes it in a customer-facing response.
  • You say "verify identity before account actions" and the agent skips straight to the action.
  • You add ten more rules to the system prompt and the model starts ignoring the first five.

This is not a skill issue or a prompting problem. Models treat instructions as context, not constraints. No amount of prompt engineering turns a suggestion into a guarantee.

Guardrails filter content. Observability shows you what happened. Open Bias enforces behavior at runtime -- it evaluates live traffic against your policy and acts on violations before they reach users.


How It Works

Open Bias sits between your app and your LLM provider, evaluating every request and response against your RULES.md:

┌──────────┐       ┌─────────────────────────────────────────────────────────────┐       ┌──────────────┐
│          │──────▶│                         OPEN BIAS                           │──────▶│              │
│ Your App │       │                                                             │       │ LLM Provider │
│          │◀──────│  ┌───────────────────────────────────────────────────────┐  │◀──────│              │
└──────────┘       │  │                        Proxy                          │  │       └──────────────┘
                   │  │                                                       │  │
                   │  │  ┌─────────────────┐         ┌─────────────────────┐  |  │
                   │  │  │  PRE_CALL Hook  │         │   POST_CALL Hook    │  │  │
                   │  │  │                 │         │                     │  │  │
                   │  │  │ • apply pending │         │ • run sync engines  │  │  │
                   │  │  │   async results │         │ • start async       │  │  │
                   │  │  │ • run pre sync  │         │   engines (applied  │  │  │
                   │  │  │   engines       │         │   next request)     │  │  │
                   │  │  └───────┬─────────┘         └──────────-┬─────────┘  │  │
                   │  └──────────┼───────────────────────────────┼────────────┘  │
                   │             │                               │               │
                   │             ▼                               ▼               │
                   │  ┌───────────────────────────────────────────────────────┐  │
                   │  │                    Interceptor                        │  │
                   │  │  Maps EvaluationResult → enforcement action           │  │
                   │  │                                                       │  │
                   │  │  ┌──────────-─┐  ┌────────────-─┐  ┌─────────────┐    │  │
                   │  │  │  BLOCK     │  │  INTERVENE   │  │  SHADOW     │    │  │
                   │  │  │  stop req  │  │  modify next │  │  log & pass │    │  │
                   │  │  │  return    │  │  turn or     │  │  through    │    │  │
                   │  │  │  error     │  │  replay resp │  │             │    │  │
                   │  │  └───────────-┘  └─────────────-┘  └─────────────┘    │  │
                   │  └───────────────────────────────────────────────────────┘  │
                   │             │                                               │
                   │             ▼                                               │
                   │  ┌───────────────────────────────────────────────────────┐  │
                   │  │                  Policy Engines                       │  │
                   │  │  ┌────────┐  ┌────────┐  ┌────────┐  ┌────────┐       │  │
                   │  │  │ Judge  │  │  NeMo  │  │  FSM   │  │  LLM   │       │  │
                   │  │  │        │  │        │  │ (exp.) │  │ (exp.) │       │  │
                   │  │  └────────┘  └────────┘  └────────┘  └────────┘       │  │
                   │  └───────────────────────────────────────────────────────┘  │
                   │             │                                               │
                   │  ┌──────────┴────────────────────────────────────────────┐  │
                   │  │ RULES.md → Compiler → engine config  │ OTel Tracing   │  │
                   │  └───────────────────────────────────────────────────────┘  │
                   └─────────────────────────────────────────────────────────────┘

Three hooks fire on every request: pre-call applies pending interventions (microseconds), LLM call forwards to the provider unmodified, post-call evaluates the response. Critical violations can be caught and blocked synchronously. Non-critical violations evaluate async and queue corrections for the next turn, preserving latency.

All hooks are fail-open with configurable timeout -- the proxy never becomes the bottleneck.

Trace view:

Open Bias concept graphic showing a request, evaluator verdict, and enforcement decision

Policy intervention illustration:

Open Bias deviation line GIF showing drift crossing the policy boundary, triggering intervention, and returning to a compliant path

Turn-by-turn deviation trace:

  • Turns 1-2: normal path.
  • Turn 3: drift starts.
  • Turns 4-5: intervention is applied.
  • Turns 6-7: flow returns to policy.

Engines

Engine Mechanism Critical-path latency
judge Sidecar LLM evaluates compiled rules one at a time 0ms (async, deferred intervention)
nemo NVIDIA NeMo Guardrails for content safety and dialog rails 200-800ms
fsm State machine with LTL-lite temporal constraints experimental
llm LLM-based state classification and drift detection experimental

Full engine documentation: docs/engines.md


Roadmap

v0.4.1 -- beta. The proxy layer, multi-evaluator pipeline, judge and NeMo engines, rules compiler, replay/improve tooling, JSONL traces, and OpenTelemetry tracing all work. Two additional engines (FSM, LLM) are experimental. Zero-config startup plus optional YAML is in place.


Documentation


Contributing

We'd love your help making Open Bias better — open an issue, submit a PR, or share how you're using it.


License

Apache 2.0

If this project helps your team, a star on GitHub helps us reach more developers.

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

openbias-0.4.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

openbias-0.4.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file openbias-0.4.1.tar.gz.

File metadata

  • Download URL: openbias-0.4.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for openbias-0.4.1.tar.gz
Algorithm Hash digest
SHA256 372ae1d6e104200b13928628048905995fa470f5f1691c9aa5f21134262a5192
MD5 3f37d85bb0d6c64f9bde211f55afbf6a
BLAKE2b-256 e992a583310d7b2fda24242773666e6ea239b6a6b13494592d0dc10aeeb408bd

See more details on using hashes here.

File details

Details for the file openbias-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: openbias-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for openbias-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c7e22f7755f4bab1f6653d6f43ab766a0d4c2221ae19be5f305eb84a361db5d
MD5 5b1ba5aae9d59b69fc92086b85d6c8cb
BLAKE2b-256 f4f1dfbc09d70203363d92249e2855401e729f4698eff60f1c1ee50958caa6ad

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