Skip to main content

Sondera Harness

Deterministic guardrails for AI agents.

Open-source. Works with LangGraph, ADK, Strands, or any custom agent.

Docs · Quickstart · Examples · Slack

PyPI version Python 3.12+ License: MIT


What is Sondera Harness?

Sondera Harness evaluates Cedar policies before your agent's actions execute. When a policy denies an action, the agent gets a reason why and can try a different approach. Same input, same verdict. Deterministic, not probabilistic.

Example policy:

forbid(principal, action, resource)
when { context has parameters_json && context.parameters_json like "*rm -rf*" };

This policy stops your agent from running rm -rf, every time.

Quickstart

Try it now: Open In Colab - no install required.

1. Install

uv add "sondera-harness[langgraph]"   # or: pip install "sondera-harness[langgraph]"

Works with LangChain/LangGraph, Google ADK, Strands, and custom agents.

2. Add to Your Agent (LangGraph)

from langchain.agents import create_agent
from sondera.harness import SonderaRemoteHarness
from sondera.langgraph import SonderaHarnessMiddleware, Strategy, create_agent_from_langchain_tools

# Analyze your tools and create agent metadata
sondera_agent = create_agent_from_langchain_tools(
    tools=my_tools,
    agent_id="langchain-agent",
    agent_name="My LangChain Agent",
    agent_description="An agent that helps with tasks",
)

# Create harness with agent
harness = SonderaRemoteHarness(agent=sondera_agent)

# Create middleware
middleware = SonderaHarnessMiddleware(
    harness=harness,
    strategy=Strategy.BLOCK,  # or Strategy.STEER
)

# Create agent with middleware
agent = create_agent(
    model=my_model,
    tools=my_tools,
    middleware=[middleware],
)

[!NOTE] This example uses Sondera Platform (free account), which also enables the TUI below. For local-only development, see CedarPolicyHarness.

3. See It in Action

Sondera TUI
uv run sondera   # or: sondera (if installed via pip)

Why Sondera Harness?

  • Steer, don't block: Denied actions include a reason. Return it to the model, and it tries something else.
  • Deterministic: Stop debugging prompts. Rules are predictable.
  • Drop-in integration: Native middleware for LangGraph, Google ADK, and Strands.
  • Full observability: Every action, every decision, every reason. Audit-ready.

Documentation

Community

License

MIT

Metadata

Release files for sondera-harness 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sondera-harness 0.10.0
File Size Uploaded
sondera_harness-0.10.0.tar.gz 192.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sondera-harness 0.10.0
File Interpreter ABI Platform
sondera_harness-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 400.2 kB

Release files / sondera_harness-0.10.0.tar.gz

Download URL sondera_harness-0.10.0.tar.gz
Size 192.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c78a028ebfb95305382a5384c41a48f7f5ca6018a8f41088a9860ae3b0dbfa3c
BLAKE2b-256 checksum
How to use checksums
a5a84805623398618b1e557482059dae0588cf68a4475b456817b093aef583c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / sondera_harness-0.10.0-py3-none-any.whl

Download URL sondera_harness-0.10.0-py3-none-any.whl
Size 208.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
235ba512ed6dbe2e893001648e941b6b54f402454799aa288b0707d61fdfd414
BLAKE2b-256 checksum
How to use checksums
09fabf8d924f8886030cd70479b3e8f91d4f833b587003e60b459920e736c968
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page