One formula covers every capability, every policy, every integration.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.
The Formula
The Lifecycle
- Capability is invoked: a function call, tool use, or API call
- Brane intercepts the invocation before the function executes
- Brane creates an AgentAction record capturing who, what, where, and with what
- Brane builds a PolicyContext, the clean developer-facing view of the action
- Matching
before_capabilitypolicies evaluate the context in priority order - Policy returns a Decision: allow or deny, with more types planned
- If denied, Brane raises
CapabilityDeniedError; the function never executes - If allowed, the original function executes and returns output
- Brane creates an after-action record with the output included
- Matching
after_capabilitypolicies evaluate; they can inspect the output - If an after policy denies, Brane raises
CapabilityDeniedErrorafter execution - If after policy allows, Brane returns the output to the caller
Developer Example
refund_customer("cust_456", 250.00) call, Brane:
- Intercepts before the function runs
- Creates an
AgentActionforsupport-agentinprodusingrefund_customerwithamount_usd=250 - Builds a
PolicyContextwrapping that action - Finds
limit_refund_amount, which matchesrefund_customer - Calls the policy;
ctx.arg("amount_usd")returns250, which is over the limit - Returns
Decision(type="deny") - Raises
CapabilityDeniedError. The actual refund function never runs.
Security Team Example
ctx.is_prod checks the runtime environment. ctx.is_high_risk checks the capability’s risk field. Neither requires knowing which specific capability was called; the policy works across the entire governed surface.
Why This Is The Right Boundary
The control boundary for agent systems is not the text they produce. It is the capabilities they use. Policy on prompts and outputs leaves a gap: the agent can still call a tool, write a file, or query a database before the output is inspected. Policy on capability use catches the action at the right moment, before the consequence occurs. The formula works the same regardless of the agent framework. LangGraph tools, CrewAI tools, OpenAI Agents SDK function tools, and MCP tool calls all reduce to the sameAgentAction against the same capability. One policy runtime governs all of them.