> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brane.membranelabs.org/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Agents SDK Guardrails

> Use Brane as a runtime policy layer for OpenAI Agents SDK function tools and agent actions.

Brane can be used as a runtime policy layer for OpenAI Agents SDK function tools by wrapping tool functions as Brane capabilities. The Brane policy runs before the tool function executes and can allow or deny the attempted action.

This gives OpenAI Agents SDK applications a policy-as-code layer for production tool use.

## How Brane Fits

The OpenAI Agents SDK helps define and run agents. Brane governs what those agents are allowed to do when they attempt actions.

```text theme={null}
OpenAI agent chooses function tool -> Brane intercepts tool function -> policy decides -> tool runs or is blocked
```

## Example Pattern

```python theme={null}
from brane import Decision, Runtime

runtime = Runtime(agent_id="openai-support-agent", environment="prod")

@runtime.capability(name="refund_customer", type="tool", risk="high")
def refund_customer(customer_id: str, amount_usd: float):
    return {"refunded": True, "amount": amount_usd}

@runtime.before_capability("refund_customer")
def refund_limit(ctx):
    if ctx.arg("amount_usd", 0) > 100:
        return Decision(type="deny", reason="Refund exceeds $100 limit")
    return Decision(type="allow")
```

Expose `refund_customer` as the function tool in your agent framework. Brane remains responsible for runtime policy enforcement.

## What This Protects

* Destructive tools
* Financial actions
* Cross-tenant access
* Production-only workflows
* Database queries
* External API calls
* Actions requiring approval

## Current Status

The framework-independent Python runtime works today. A dedicated OpenAI Agents SDK adapter is planned.

## Related Pages

* [Runtime](/sdk/runtime)
* [Writing Policies](/policy/writing-policies)
* [Refund Limit Recipe](/recipes/refund-limit)
* [Roadmap](/roadmap)
