The policy author’s view of an AgentAction. The clean interface for writing real application policy.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.
Definition
PolicyContext is not the same thing as raw action data. It is what the policy author sees. The runtime has a large internal record: trace IDs, capability metadata, tenant metadata, workflow state, risk scores, and side effect metadata. The policy author should not have to navigate all of that directly. PolicyContext is the clean, stable interface that makes policy feel like natural application code.Raw Fields
action: the full AgentAction recordargs: bound input arguments for the calloutput: the function’s return value, only available inafter_capabilitypoliciesruntime_metadata: metadata passed from the runtime to the policy engine
Convenience Properties
| Property | Type | Description | |
|---|---|---|---|
capability | Capability | The capability being attempted. | |
tool | Capability | Alias for capability. | |
agent_id | `str | None` | Agent identity from the action. |
principal_id | `str | None` | Principal identity from the action. |
tenant_id | `str | None` | Tenant from the action. |
is_prod | bool | True if environment is prod. | |
is_high_risk | bool | True if capability risk is high or critical. | |
has_side_effects | bool | True if capability has any side effects. | |
disableable_side_effects | list[SideEffect] | Side effects that can be disabled via input transform. Planned. |
Methods
Common Policy Patterns
What PolicyContext Does Not Have
PolicyContext surfaces a curated interface. It does not expose the full runtime internals. This is intentional: policy authors should not need to know about framework-specific metadata, internal trace systems, or deployment details. If you need additional context for your policies, usecapability.metadata or action.metadata to pass custom data through.
Future versions will add principal_has_scope(), tenant_has_feature(), has_grant(), and require_metadata().