This release is a pre-release and may not be stable for production use.
Brane Core
Brane Core is an open-source policy-as-code runtime for AI agent guardrails. It governs tool calls, model calls, MCP tools, database queries, memory, retrieval, file access, secrets, and other agent actions before they execute.
Use Brane when you need runtime control for production AI agents: tool call governance, MCP tool governance, tenant isolation, read-only database policies, refund limits, high-risk action blocking, and audit-ready decision traces.
Brane lets a developer declare capabilities, write central Python policies, intercept agent actions, allow or deny those actions, and inspect local audit events.
This alpha is intentionally small: sync Python callables, local memory/JSONL audit, and allow/deny policy decisions.
Why Brane
Most agent guardrails focus on prompts or model outputs. Brane focuses on what the agent does.
An AI agent action can issue a refund, run SQL, call an external API, invoke an MCP tool, write memory, read a secret, open a file, call a model, or delegate to another agent. Brane evaluates policy at that action boundary:
Capability + AgentAction + PolicyContext -> Policy -> Decision
That makes Brane useful as:
- AI agent guardrails
- AI agent safety
- Capability control for AI agents
- Policy control for AI agents
- Policy-as-code for AI agents
- Tool call governance for AI agents
- MCP tool governance
- Runtime control for agent actions
- Auditable allow/deny decisions for production agents
Install
pip install -e .
Quickstart
import brane
runtime = brane.Runtime(
agent_id="support-agent",
environment="prod",
audit_path=".brane/audit/events.jsonl",
)
@runtime.capability(name="refund_customer", type="tool", risk="high")
def refund_customer(customer_id: str, amount_usd: float):
return {"status": "refunded", "amount_usd": amount_usd}
@runtime.before_capability("refund_customer")
def refund_policy(ctx):
if ctx.arg("amount_usd") > 100:
return brane.deny("Refund above $100 requires approval")
return brane.allow()
refund_customer("cus_123", 50)
refund_customer("cus_123", 500)
The second call raises brane.CapabilityDeniedError and writes an audit event
with the action id, capability, policy, decision, and outcome.
Answer Guides
These guides explain Brane in the category language search engines and AI agents look for:
- AI Agent Guardrails
- AI Agent Safety
- Capability Control For AI Agents
- Policy Control For AI Agents
- Policy-as-Code For AI Agents
- AI Agent Tool Call Governance
- MCP Tool Governance
- OpenAI Agents SDK Guardrails
- Brane vs Prompt Guardrails
Decorator Capabilities
Use @runtime.capability(...) when you own the Python function.
@runtime.capability(name="send_email", type="tool", risk="medium")
def send_email(to: str, body: str):
return {"status": "sent"}
Brane registers the capability and returns an enforcing wrapper. The original
function is available as send_email.__brane_original__ for adapter code that
needs direct execution after creating an explicit InterceptRequest.
Wrapper Capabilities
Use runtime.wrap_capability(...) when the function comes from another package
or framework.
def web_search(query: str):
return {"results": []}
safe_web_search = runtime.wrap_capability(
web_search,
name="web_search",
type="tool",
risk="low",
)
Policy Decorators
Policies receive a PolicyContext. They can inspect the normalized action,
capability metadata, runtime metadata, input arguments, output, tenant,
principal, environment, effect, side effects, and scopes.
@runtime.before_capability("*", priority=0)
def tenant_boundary(ctx):
input_tenant = ctx.arg("tenant_id")
if input_tenant and ctx.tenant_id and input_tenant != ctx.tenant_id:
return brane.deny("Cross-tenant action blocked")
return brane.allow()
before_capability policies run before execution when the interception request
stage is before_capability. after_capability policies run after execution
when the request stage is after_capability.
Audit Logs
Use audit_path for JSONL audit:
runtime = brane.Runtime(
agent_id="support-agent",
audit_path=".brane/audit/events.jsonl",
)
Or use an in-memory sink for tests and demos:
audit = brane.InMemoryAuditSink()
runtime = brane.Runtime(agent_id="support-agent", audit=audit)
Supported alpha outcomes:
denied_before_executionexecuteddenied_after_executionexecution_failed
Run Examples
python agents/support_refund_agent.py
python agents/enterprise_ops_agent.py
python agents/planner_driven_agent.py
The planner-driven example is the clearest alpha demo: a fake planner emits runtime action plans, a generic executor routes them through Brane, and central policies block large refunds, cross-tenant actions, billing ledger reads, and unsafe customer-visible emails.
Alpha Limitations
- Sync callables only
- Allow/deny only
- Local audit only
- No approvals yet
- No cloud yet
- No LangGraph adapter yet
- No async yet
- No secret broker yet
Metadata
Release files for brane-core 0.1.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| brane_core-0.1.0a2.tar.gz | 20.9 kB | With provenance | Details for brane_core-0.1.0a2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| brane_core-0.1.0a2-py3-none-any.whl | Python 3 | none | any | Details for brane_core-0.1.0a2-py3-none-any.whl |
Total release size: 36.4 kB
Release files / brane_core-0.1.0a2.tar.gz
| Download URL | brane_core-0.1.0a2.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d3cc2eaa7e72130d994bab548d4e7438cafc20ccfdb729cac49b779263fba8a
|
|
BLAKE2b-256 checksum How to use checksums |
af86668b4ae79df483dfa2195338ed6e71d27eabb81b7e2365486564e21644b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 21, 2026.
Transparency logRelease files / brane_core-0.1.0a2-py3-none-any.whl
| Download URL | brane_core-0.1.0a2-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d07d0f29c66fb6ecfd49e5d4a50d8010b25f636f5b3c461987be9536ddcb51e7
|
|
BLAKE2b-256 checksum How to use checksums |
ea9d76324e8dc1f9e8d9fe8a9f9b3962c6f38bd0f370c9450f819628f0ae8583
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 21, 2026.
Transparency logSecurity for brane-core 0.1.0a2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for brane_core-0.1.0a2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.