Skip to main content

Sondera Harness SDK for Python - Agent governance and policy enforcement

Project description

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

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

sondera_harness-0.9.0.tar.gz (179.8 kB view details)

Uploaded Source

Built Distribution

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

sondera_harness-0.9.0-py3-none-any.whl (196.4 kB view details)

Uploaded Python 3

File details

Details for the file sondera_harness-0.9.0.tar.gz.

File metadata

  • Download URL: sondera_harness-0.9.0.tar.gz
  • Upload date:
  • Size: 179.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sondera_harness-0.9.0.tar.gz
Algorithm Hash digest
SHA256 2fdc8b4baa2aa5815e3e8cb8c91cc34d48cecfeda0b1e6d376eba4279acb9e65
MD5 97cec8c80f3df9c0f5a37d2e68c5933d
BLAKE2b-256 04b0ab31b6b98e6a072cfba32af38410c6b51f7e4b0f9fd6f54971d73f585f5e

See more details on using hashes here.

File details

Details for the file sondera_harness-0.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sondera_harness-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b392d7d249a78ae233c7cf40185ff7b6ac11ccc89b81efe34103b9b14ec9548b
MD5 990f5417afad966444ae72975fc6991a
BLAKE2b-256 849807e67c2a061637ff22079aa20ea121d9d2ad8fabbd0ff64f5a0dd4057ce2

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