OPA policies reference

Complete reference for OPA policy configuration in the Agent Gateway: the Policy canvas element, policy scopes, and the full input object available to Rego rules.

Agent Gateway evaluates Open Policy Agent (OPA) policies, written in Rego, selected on a gateway, in the slots a surface’s Policy elements fill, and on every gateway or surface at once when a policy is enforced appliance-wide. Its parts are:

If you are new to OPA policies on the Agent Gateway, read the OPA policies concept overview first.

Policy element

The Policy element runs an OPA (Rego) policy against the request or response and denies it when the policy returns false. Multiple Policy elements can coexist on a surface, one per slot.

The slot the element fills is determined by the edge you drop it on.

Drop positionSlotWhen it evaluates
Access Point → Managed Agent (request)Target policyBefore the request is forwarded to the Managed Agent. One Policy element per slot.
Access Point → Managed Agent (response)Response policyOn the response before it is forwarded back to the caller.
Managed Agent → Transit Point (request)Transit Point policyPer hop, before dispatch to that destination.
Managed Agent → Transit Point (response)Transit Point response policyOn the response from that destination, before it returns to the Managed Agent.

A surface saved with an inbound policy shows it as a second Policy element on the Access Point → Managed Agent edge, evaluated before the target policy. New surfaces can’t add one in the dashboard.

Fields

FieldRequiredDefaultDescription
Policy DefinitionYes—The Agent Surface policy to evaluate, chosen by name from the policies on the Policies page. A request slot evaluates it against the gateway and surface policy input, and a response slot against the response policy input.
Enrich policy input with agent contextNoOffWhen on, the pipeline fetches the target’s agent card and queries the trust registry before evaluation, populating input.agent in the OPA input. Adds latency. Enable only when the policy uses input.agent. Not available for response policies.

Policy editor

The policy editor creates and edits one policy definition. It opens from Define Gateway Policy or Define Agent Surface Policy on the Policies page, with the header Create Gateway Policy or Create Agent Surface Policy, or from a policy’s row, with the header Edit Policy: and the policy’s name. The Define button sets the new policy’s Type.

Start from

A new policy shows only the Start from gallery until you choose how to begin. Select a card to show its Template details beside the form, then select Use this template, or select Create custom policy under the cards. The Details and Policy sections appear after that choice.

  • A new policy starts as deny by default, with no card selected.
  • Use this template fills the Rego and the Description. It replaces the Description only when the Description is empty or still holds the text the previous template filled in, and it leaves the Name unchanged.
  • Create custom policy starts an allow-all policy and empties the Name and Description.
  • Change reopens the gallery, and Cancel closes it again. When the policy already has added rules or your own edits, Use this template and Create custom policy ask before they replace them.
  • Using a template or starting a custom policy shows a notice with Undo.

The gallery lists 20 templates for an Agent Surface policy and 6 for a Gateway policy. Six cards show at first, and Show all (20) lists the rest of the Agent Surface templates. For each template’s settings and behaviour, see Policy templates.

Template details itemWhat it shows
SettingsThe template’s own fields. A deployment-specific setting starts empty with a sample value as its placeholder, and shows “Required before the template can be used.” until you fill it. Use this template stays disabled until then.
Show RegoThe Rego the template writes with the current settings. With an empty setting, the preview uses the sample value and says so.
How it decidesEach example request, with Show input for its input and an ALLOW or DENY badge for the decision the template gives it.
Docs linkThe docs section the template follows.

Details

FieldWhat it doesDefault
NameRequired. The label shown in the policy list and on Audit Log entries when the policy decides.Empty
DescriptionShown in the policy list and version history.Empty, or the template’s description after Use this template
TypeGateway or Agent Surfaces. Hidden on a new policy opened from a Define button. Shown read-only otherwise, with “Set by the Define button that opens this page. It can’t be changed here.” on a new policy and “A policy’s type is fixed once created.” on a saved one.Set by the Define button
StatusThe Enabled switch. While off, the policy is never evaluated. A policy enforced appliance-wide that is turned off makes every request in that plane fail closed, unless the assignment is Monitor only.On
Policy IDSaved policies only. The ID that surfaces, gateways and the Audit Log refer to, with a copy button. It can’t be changed.—
SHASaved policies only. The content hash of the enforced revision, with a copy button. See Content hash and version fields.—

Policy section

The Policy section shows the policy in one of two views, chosen with the Rules and Rego buttons. It opens on Rules. Above the views, a status line shows the rule count, the policy’s default decision as Default DENY or Default ALLOW, and Valid or Invalid for the compiled Rego. Add rules from a template opens the panel that adds a template’s rules to the end of the policy.

The Rules view lists the policy’s rules in groups:

  • From template: and the template’s name, for the rules Add to policy added. Remove group removes them.
  • Your rules, for every other rule, with the template the policy started from while its Rego still matches it.

Each rule shows its Kind, Rule and Line. Select the line number to show the rule in the Rego, or the trash icon to remove it. A rule or group that another rule still reads can’t be removed, and the view names the rule that reads it. A line above the groups says what the policy decides, or that the Rules view can’t summarise it and to read the Rego.

KindMeaning
AllowsAllows the request when its conditions match.
Sets allowSets allow in a way the Rules view can’t read. Read the Rego, and remove such a rule in the Rego view.
Deny reasonGives the reason a request was denied, and does not decide it.
Used by allowA helper rule that allow reads, directly or through other rules.
Not used by allowA helper rule that allow doesn’t read, so it doesn’t change whether a request is allowed.

Warnings in the Rules view:

  • When every request is allowed by default, the view says the allow rules change nothing, and Deny by default changes the default to deny.
  • A group shows “No effect while the default is ALLOW.” for the same reason.
  • A group added from a template written for the other Type blocks Create until you remove it.

The Rego view holds Rego reference and Policy Content (Rego), the Rego with line numbers. A compile error shows below the editor. A package that doesn’t match the policy’s Type shows a Package mismatch banner with Fix it, which sets the expected package, and blocks saving.

Rego reference is a collapsed card with the package the policy uses, the allow rule structure, the main input fields of gateway and surface policies, the separate input of policies bound to MCP tools, and short examples. Its links open Gateway and surface policy input and MCP tool policy input on this page.

Template examples

On a saved policy, after Add to policy adds a template’s rules, a Template examples card appears below the editor. It runs that template’s examples through the dry run against the draft, saved or not.

ColumnWhat it shows
ExampleThe example request, with a short explanation when the decision differs.
ExpectedThe decision the template gives the example.
This policyThe decision the whole draft gives it.
ResultMatches or Differs. Left empty when you changed a template setting from its default, since a different decision is then expected.

Load in Test copies the example’s input into Sample input JSON of the Test (dry-run) panel, with an Undo notice. A row differs when another rule in the policy allows or denies that request, because any rule that allows lets the request through.

Read-only editor

A user without permission to edit policies sees the policy read-only, with the note “You can view this policy but not change it.” The Rego and Details can’t be changed, and the page has no Create or Save button, no Fix it, no Add rules from a template, and no Test (dry-run) panel.

Policy definitions: versions, dry-run testing, and deletion

Every policy definition is stored as an append-only sequence of versions, not a single mutable record. Saving a change to the Rego body appends a new version and keeps every earlier one. Saving only the name, description, or enabled state updates the current version in place without creating a new one.

Content hash and version fields

The policy editor and list both show read-only fields that identify the exact Rego enforced, so a decision or an audit entry can be traced back to specific bytes even after the policy has since changed.

FieldWhat it doesDefault
SHAThe content hash (sha256:<hex>) of the Rego currently enforced. Shown on the policy editor, in the policy list, and against every row of the version history. Binds the policy’s scope to its body, so identical Rego under Gateway and Agent Surface scope hashes differently.—
Version historyAn append-only, newest-first list of every revision the policy has had: version number, content hash, creation time, author, and the name/description as they stood at the time. Selecting an older version compares it line-by-line against the current one.—
AuthorThe username of whoever saved the revision, resolved from the authenticated account. Falls back to the raw account identifier when the account can no longer be resolved, for example a deleted user.—

Dry-run testing (Test panel)

The Test (dry-run) panel appears below the Rego editor once the policy definition has been saved at least once.

FieldWhat it doesDefault
Sample input JSONThe input document the dry run evaluates the policy against. Saved with the policy definition, so the last input you tested with is still there next time you open it.A caller authenticated by JWT Bearer, in source_auth with method jwt_bearer, a subject and claims, plus an HTTP method and path and an inbound direction. Gateway and surface policies read the caller from input.source_auth, as this sample does.
Run against the draft aboveEvaluates the Rego currently in the editor, including unsaved changes, against the sample input. Disabled while the policy does not compile or the sample input is not valid JSON. Nothing here reaches the live policy engine or in-flight traffic.—
Auto-runRe-runs the dry run automatically, a short pause after every change to the policy or the sample input.Off

The result shows an ALLOW or DENY badge, a reason when the policy defines one, and the query, draft, and the content hash the dry run evaluated. A dry run always evaluates the Rego in the editor, saved or not.

The draft Rego and sample input each have a size limit, and a run has a time limit. An oversized draft returns “Draft policy is too large to simulate”, and an oversized sample input returns “Sample input is too large to simulate”.

To test against the input of a real request, copy one from the surface’s Policy Input card, described below, and paste it into Sample input JSON.

Policy input capture

From version 1.0.10, policy input capture shows the input of a surface’s policies live, so you can write and test a policy against real requests. It is on the Policy Input card of the surface’s Capture view, opened from its Monitoring tab. The card says “For developing and testing policies only”.

For a walkthrough from dry run to the Audit page, see Test your policy in action.

Policy input capture is off until an administrator turns on its feature flag under Settings › Admin › Feature Flags. While it is off, the card says so and names that setting. Listening needs permission to edit both surfaces and policies. Without it, the card shows “Needs permission to edit surfaces and policies”.

  • Listen to policy input starts listening, and the card shows “Listening”. Stop listening stops it. Leaving the view or reloading the page also stops it. The Capture view’s Pause holds payload capture only.
  • While you listen, each request and response policy evaluation on the surface adds a row: Access Point, Target, Transit Point and response policies, and gateway and appliance-wide policies that apply to it. MCP tool policies are not shown.
  • A surface with no policy of its own has no surface evaluation to show. Add a request policy to see each request’s input. One that allows everything is enough.
  • The card keeps the last 50 evaluations. One request can add several rows.
  • Credentials in the input are masked. Only the dashboard users listening to this surface at the time receive the input. The captured input isn’t written to the Audit Log or kept on the gateway. It still holds request data such as messages, tool arguments and claims.
  • Starting and stopping a capture are audit events, Policy Input Capture Started and Policy Input Capture Stopped, recorded when the gateway’s audit settings select them. See Audit log.
  • Clear in the Capture view’s toolbar empties the captured payloads and policy inputs.
ColumnWhat it shows
TimestampWhen the policy decided.
PolicyThe policy slot that ran, such as inbound, target, transit <alias>, response or gateway, the surface variant when there is one, and the name and version of each policy the slot evaluated.
DecisionAllow, Deny or Error, with the deny reason or evaluation error.
ActionsShow input or Hide input for the evaluation’s input, and a button that copies it.

All policy slots above the table filters the rows to one slot. To test a captured input, copy it and paste it into Sample input JSON of the Test (dry-run) panel.

Delete confirmation and affected references

Selecting the delete icon on a policy row opens a confirmation instead of deleting immediately.

  • The confirmation states how many gateways (for a Gateway policy) or surfaces (for an Agent Surface policy) currently reference the policy, so you can judge the impact before committing to a delete that cannot be undone.
  • This count only covers direct references within the policy’s own scope: gateways with it selected on their Global Policy tab, or surfaces with a Policy element bound to it. It does not include appliance-wide (global) enforcement. Check the policy’s Global column before deleting. Removing a globally-enforced policy fails its entire plane closed, not only the objects the count includes. See Appliance-wide (global) policy enforcement.
  • A referencing gateway or surface does not fall back to allowing traffic once its policy disappears. It fails closed: every request that policy used to evaluate is denied until a replacement is attached or the reference is removed.

Appliance-wide (global) policy enforcement

Any Gateway-type or Agent Surface-type policy definition can also be enforced across every gateway or every surface on the appliance, from the Policies list, in addition to or instead of being attached to individual objects. This is a reach setting on an existing definition, not a separate Rego scope: an appliance-wide Gateway policy still uses package gateway.policy and query path data.gateway.policy.allow, and an appliance-wide Agent Surface policy still uses package surface.policy and query path data.surface.policy.allow, exactly as described in Policy scopes and input structs.

FieldWhat it doesDefault
Global (toggle, per policy row on the Gateway or Agent Surfaces tab)Enforces this policy definition on every gateway or every surface on the appliance, on top of that object’s own policy. Switching it on shows a confirmation stating how many gateways or surfaces will enforce it.Off
Monitor (checkbox, shown once Global is on)Evaluates and records the decision without blocking a request the policy would have denied.Off (enforcing)
  • Appliance-wide policies evaluate deny-overrides, ahead of that plane’s own per-object policy. On an inbound direct request the order is: appliance-wide gateway policy, the gateway’s own Global Policy tab policy, appliance-wide surface policy, then the surface’s own Policy element. A deny at any stage is final.
  • A Monitor assignment is evaluated and its would-be decision recorded, but it never blocks a request, so it is a way to observe a new appliance-wide rule before enforcing it.

Policy input reference

The gateway serialises request context into a structured input object before evaluating any Rego policy. Policy rules read fields from input to make access decisions. Use this reference when writing Rego rules to understand which fields are available, how authentication data appears in input.source_auth, and which fields are populated at each evaluation point.

The input carries no request time. A policy that decides by time of day reads the clock itself. See Time-based decisions.

Policy scopes and input structs

Three input shapes exist. Use the package declaration and field paths of the slot you are writing for.

ScopePackage declarationQuery pathInput
Gatewaypackage gateway.policydata.gateway.policy.allowGateway and surface policy input
Surface request (Access Point, Target, Transit Point)package surface.policydata.surface.policy.allowGateway and surface policy input
Surface response (Target and Transit Point response policies)package surface.policydata.surface.policy.allowResponse policy input
MCP toolpackage surface.policydata.surface.policy.allowMCP tool policy input

Gateway and surface request policies share the same input and field names. Response policies and MCP tool policies each get a different input with its own fields, so a rule written for a request policy reads absent fields there and denies.

Gateway and surface policy input (PolicyInput)

Full example

A fully-populated input for an inbound MCP request with JWT authentication and trust registry data:

{
  "http": {
    "method": "POST",
    "path": "/my-surface/mcp",
    "headers": {
      "content-type": "application/json",
      "x-request-id": "req-abc123"
    }
  },
  "gateway": {
    "direction": "inbound"
  },
  "channel": {
    "config_id": "surface-abc123",
    "name": "my-surface"
  },
  "source_auth": {
    "method": "jwt_bearer",
    "subject": "user@example.com",
    "claims": {
      "role": "admin",
      "org": "acme-corp",
      "aud": "https://gateway.example.com"
    }
  },
  "mcp": {
    "method": "tools/call",
    "tool_name": "search",
    "params": { "query": "hello" }
  },
  "agent": {
    "did": "did:web:example.com:agent-1",
    "did_verified": true,
    "trust_verification": true,
    "agent_dna": {
      "uai": "urn:uai:example.com:agent-1:v1",
      "birthEvent": { "scid": "...", "timestamp": "..." },
      "genesis": { "codeHash": "...", "genesisHash": "..." },
      "behavioral": { "behavioralHash": "..." },
      "operational": {},
      "attestations": {}
    }
  }
}

Not all fields are present on every request. See Input availability by evaluation path for when each field is populated.

input.http

Always present. Sensitive headers are stripped before policy evaluation, on inbound and outbound requests alike. Policies cannot read credential values from headers.

FieldTypeDescription
methodstringHTTP method: "POST", "GET", etc.
pathstringThe whole request path, which starts with the surface’s Access Point route: /my-surface/public/docs for a route /my-surface. On a Transit Point, the path of the request the managed agent sends, which starts with /outbound, the route and the Transit Point’s alias (/outbound/my-surface/partner-a/...), or with the Transit Point’s own listen path.
headersobjectNon-sensitive request headers as a flat string-to-string map. On an outbound Transit Point request, these are the headers from the original inbound request.

input.gateway

Always present. Describes the traffic direction and the identity participants.

FieldTypeDescription
directionstring"inbound" when a request arrives at the Access Point, directly or over Fabric. "outbound" when the managed agent sends a request through a Transit Point. Also "outbound" for the request a surface with a fabric:// Target sends to the peer gateway, which the Target’s request policy evaluates.
source_idstringOn a Transit Point request, the resolved DID of the managed agent acting as the protected caller. On a request received over Fabric, the DID that sent it. Absent on the request a fabric:// Target sends and on a direct inbound request.
target_idstringOn a Transit Point request, the Transit Point’s configured endpoint, the same for every request through it, such as https://api.example.com/mcp, or fabric://<gateway id>/<surface id> on a Fabric route. On the request a fabric:// Target sends, the peer gateway’s DID. Absent on inbound requests.

Both a Transit Point request and the request a fabric:// Target sends have direction "outbound". Only a Transit Point evaluation carries input.transit, so a rule that must decide on Transit Point calls only tests input.transit first.

input.channel

Always present. Identifies the surface handling the request.

FieldTypeDescription
config_idstringThe surface ID. It stays the same when the surface is renamed.
namestringThe surface name as configured in the dashboard. Other surfaces may share it.
variant_aliasstringThe surface variant the request selects, on a request received over Fabric and on a Transit Point. Absent on a direct request and for the default variant.

input.source_auth

On inbound evaluations, present whenever the surface has a Caller Context element and the request reaches policy. A caller whose credential failed reaches policy only on some Access Points. See Failed. On outbound evaluations, present when the Transit Point’s own Caller authentication verified the caller, with the same shape as on the inbound side.

The method field names the Caller Context method that verified the caller and determines the shape of the object. When a Caller Context element holds several methods, the gateway verifies each request with the method whose credential it carries, so method tells a policy which kind of credential the caller used. See How the gateway selects a method.

This rule admits every JWT caller, and only those API key callers verified against one secret:

package surface.policy

default allow := false

allow if input.source_auth.method == "jwt_bearer"

allow if {
  input.source_auth.method == "api_key"
  input.source_auth.key_name == "partner-keys"
}
JWT bearer

Callers authenticated with a validated JWT.

{
  "method": "jwt_bearer",
  "subject": "user@example.com",
  "claims": {
    "role": "admin",
    "org": "acme-corp"
  }
}
FieldDescription
subjectThe value of the JWT verification strategy’s Caller identity claim, sub by default.
claimsAll claims from the token payload as a JSON object. Access individual claims as input.source_auth.claims.<claim_name>.
API key

Callers verified by an API Key (secret store) or API Key (provider) method. Both report method as api_key, so a policy tells them apart by key_name.

{
  "method": "api_key",
  "key_name": "my-client-id"
}
FieldDescription
key_nameFor API Key (secret store), the method’s Secret ID. For API Key (provider), the Key ID of the key the caller presented, as shown on the API keys page.
DID auth

Callers authenticated with a DID-based credential.

{
  "method": "did_auth",
  "did": "did:web:example.com:caller"
}
FieldDescription
didThe caller’s DID.
Failed

Callers whose credential was missing or invalid, or who sent credentials for more than one Caller Context method, on an Access Point that hands the failure to policy. Whether a failed caller reaches policy depends on the Access Point’s state:

  • Closed (the default for surfaces created from version 1.0.4) or legacy (stored before version 1.0.4 with Public access unset): the gateway refuses the caller with 401 and Caller credential missing or invalid before any policy runs, so policy sees no failed result. A legacy Access Point refuses such callers from version 1.0.9.
  • Public access on: the request reaches policy with method set to failed, and the surface forwards it with no asserted caller identity unless a policy denies it.

On a surface with authorization server discovery for MCP clients, a failed caller gets a 401 instead in every state. See Access Point readiness for each state.

{
  "method": "failed",
  "attempted_method": "jwt_bearer",
  "reason": "Invalid credential: Token has expired"
}
FieldDescription
attempted_methodThe Caller Context method selected for the request: the method whose credential the request carried, or the primary (first) method when it carried none or credentials for more than one. One of jwt_bearer, api_key, api_key_provider or did_auth. Unlike method, the two API key methods report different values here.
reasonA human-readable description of why authentication failed. A request carrying credentials for more than one method gives “Ambiguous credentials: the request carries credentials for more than one source authentication method”.

input.mcp

Present on MCP requests: at the Access Point, on a request received over Fabric, and through an MCP Transit Point. On the request a fabric:// Target sends, present only for a 2026-07-28 MCP request. Absent on other protocols, and for a JSON-RPC message without an id.

FieldTypeDescription
methodstringThe MCP JSON-RPC method, for example "tools/call", "tools/list", "resources/read".
tool_namestringThe name in the request’s params. For a 2026-07-28 request, set on tools/call only. For an earlier request, set for any method whose params has a name, such as prompts/get, so check method as well.
resource_uristringResource URI from a resources/read request, for a 2026-07-28 request only. For an earlier request, read params.uri.
prompt_namestringPrompt name from a prompts/get request, for a 2026-07-28 request only. For an earlier request, read params.name.
paramsobjectFull parsed params from the JSON-RPC request body. Absent when the request has none.
protocol_version, client_capabilities, client_infostring, object, objectThe MCP protocol version and the client’s declared capabilities and information. Set for a 2026-07-28 MCP request only.

input.a2a

Present on A2A protocol requests. It is built from the original request body before the gateway attaches a signed identity VP, and reflects what the caller actually sent.

FieldTypeDescription
methodstringThe A2A JSON-RPC method exactly as the caller sent it, for example "message/send".
method_canonicalstringThe method in its A2A v0.3 slash form, such as message/send, when the gateway recognises it. Absent otherwise.
messageobjectThe A2A message object (params.message or top-level message). Contains role, parts, metadata, and messageId when present.

input.agent

Present when Enrich policy input with agent context is on in the Policy element and data was retrieved. Also present with did populated after the caller DID is resolved. Absent when neither condition applies.

FieldTypeDescription
didstringThe agent’s effective DID.
did_verifiedbooleantrue when something in this request proves did. Always present.
did_verificationstringHow did was established, with the same values as input.extension_identity.verification.
trust_verificationbooleantrue when all configured trust registry recognition queries pass. false when any query returns untrusted. Absent when no queries ran.
agent_dnaobjectAgent DNA fingerprint from the agent card. Contains uai and nested fingerprint objects. Absent when the agent card does not include an agentDNA field.
trust_registry_didstringThe trust registry DID from the agent’s trust-registry extension.
provider_didstringThe provider DID from the agent’s trust-registry extension.
authority_didstringThe authority DID from the trust-registry extension.
identity_issuer_didstringThe issuer DID of the agent identity credential in the caller’s identity presentation. Set only when the gateway verified that presentation, and absent otherwise.

input.extension_identity

Present when the gateway resolved a caller identity from the request’s identity extension. Absent otherwise. Check verified before a policy trusts the DID.

FieldTypeDescription
didstringThe agent DID from the Verifiable Presentation (VP) holder or subject. Absent when none was resolved.
identity_hashstringA hash of the identity payload for correlation. Absent when none was computed.
verifiedbooleantrue when something in this request proves the DID: verification is vp, vp_unanchored or source_auth.
verificationstringHow the DID was established: vp (a verified identity presentation whose issuer is a trust anchor), vp_unanchored (a verified presentation whose issuer no trust anchor vouches for), source_auth (bound to the credential the gateway authenticated on this request), or unverified (nothing in the request proves it, for example an identity configured on the surface).

input.identity_binding

Present when a verifiable presentation (VP) from an upstream gateway was processed and its signature verified. Absent when the request carries no binding VP, and when the VP is invalid, for example when its signature fails to verify. An invalid VP never appears as verified set to false.

FieldTypeDescription
verifiedbooleantrue when the VP signature verified, its holder matches the credential subject, and its issuer is one of the sending connection’s issuers. false when the signature verified but no trust anchor vouches for issuer_gateway. Check it before relying on agent.did.
agent.didstringThe managed agent’s DID on the sending gateway.
agent.identity_fieldsobjectAgent identity fields from the VP credential subject.
caller.fieldsobjectAllowlisted caller claims, keyed by field name. Absent when the sending gateway bound no caller context.
caller.user_hashstringOne-way hash of the caller’s identity on the sending gateway. It depends on how that gateway identified the caller: the authentication method, the credential’s issuer and the principal.
caller.assurancestring"gateway_attested" or "caller_credential_chained".
caller.identity_sourcestringHow the sending gateway sourced caller context: "transit_token" or "jwt_bearer".
delegatedbooleantrue when the sending gateway was acting for a caller.
issuer_gatewaystringThe DID of the gateway that issued the VP.
targetstringThe endpoint the request was forwarded to. Absent when not recorded.
intentobjectStructured intent object from the VP. Absent when not present.

input.trust_check_results

Present when at least one Trust Check ran on the request, on either leg. Absent when none ran.

{
  "trust_check_results": {
    "caller": [
      {
        "id": "tc-caller-1",
        "trust_registry_id": "tr-main",
        "query_type": "recognition",
        "ok": true,
        "error": null,
        "name": "Verify caller department",
        "authority_id": "did:web:authority.example.com",
        "entity_id": "did:web:caller.example.com",
        "action": "is",
        "resource": "ownedAgent",
        "query_resolved": true
      }
    ],
    "target": []
  }
}
FieldTypeDescription
callerarrayResults for the caller leg. An empty array when no caller-leg checks ran.
targetarrayResults for the target leg. On a request through a Transit Point, only that Transit Point’s results for its destination. A Transit Point without Trust Checks leaves input.trust_check_results absent, so a policy that requires Trust Checks also checks that count(input.trust_check_results.target) > 0.
managed_agentarrayFrom version 1.0.10, on a request through a Transit Point, the results of that Transit Point’s queries that check This surface’s managed agent: whether the trust registry still recognises the DID the managed agent calls out under. Absent when the Transit Point has no such query, and on a discovery read. Available to the gateway, surface and Transit Point policies on that request.

From version 1.0.10, a Trust Check query can list several Authorities. It gives one result per Authority, in list order, and every one carries the query’s id with its own authority_id. A rule that matches one result by id therefore matches every Authority of that query. To accept an entity that any one Authority recognises, iterate the results, as in Accept any one Authority:

allow if {
    some r in input.trust_check_results.caller
    r.id == "authority-recognised"
    r.ok
}

A rule over every result, such as every r in input.trust_check_results.target { r.ok }, requires every Authority of every query. To require every query, each passing when any of its Authorities recognises the entity, group the results by id, as the All trust checks pass and At least N trust checks pass templates do:

check_ids contains r.id if {
    some r in input.trust_check_results.target
}

passed_ids contains r.id if {
    some r in input.trust_check_results.target
    r.ok == true
}

allow if {
    count(check_ids) > 0
    count(check_ids - passed_ids) == 0
}

To refuse a managed agent the trust registry no longer recognises, while still serving discovery reads where managed_agent is absent, group the results by query id, so that each query passes when any one of its Authorities recognises the agent:

package surface.policy

default allow := false

managed_agent_checks contains r.id if {
    some r in input.trust_check_results.managed_agent
}

managed_agent_checks_passed contains r.id if {
    some r in input.trust_check_results.managed_agent
    r.ok
}

allow if {
    count(managed_agent_checks - managed_agent_checks_passed) == 0
}

The rule allows every call while the Transit Point has no managed-agent queries, so pair this policy with them. See Require the managed agent to be recognised.

Each result in the array shares the same shape as the Trust Check result fields. For the complete list of error.code values and their categories, see Trust Check error codes.

input.transit

Present on every evaluation of a Transit Point call: the gateway, surface, per-Transit-Point and response policies, and MCP Tool Gating conditions on a Transit Point. Absent on inbound evaluations. It names two principals, each in its own field, because one call can carry both:

  • input.transit.caller: the end user the transit token names, as the Access Point authenticated them. Without a valid transit token it is anonymous.
  • input.transit.client: the caller the Transit Point’s own Caller authentication verified on this request. Absent when the Transit Point authenticated none.
{
  "transit": {
    "caller": {
      "verified": true,
      "verification": "transit_token",
      "identity_source": "gateway-computed",
      "user_identity_hash": "42628a381c35947c51d560b24315c5590c6f3c217701fcabd95f9fd9697bcd3f",
      "did": "did:web:caller.example.com"
    },
    "client": {
      "verification": "source_auth",
      "method": "jwt_bearer",
      "user_identity_hash": "2155543194a07922605d5396881518ffe9bc6a2dfdc434e250ea1363324f297f",
      "subject": "crm-agent"
    }
  }
}
FieldTypeDescription
caller.verifiedbooleantrue when verification is transit_token, or fabric_peer with a caller the receiving surface verified. It covers user_identity_hash and fields, not did. Test it before reading any other caller field.
caller.verificationstringtransit_token: the call carries a valid transit token whose caller the Access Point authenticated. unverified: a valid token names a caller DID that nothing verified. fabric_peer: the token was issued for a request a paired gateway sent over Fabric. anonymous: the call carries no valid transit token, as on a Transit Point that doesn’t require one and receives none, or on a discovery read.
caller.identity_sourcestringHow the caller DID was established. Absent when the token names no DID.
caller.user_identity_hashstringThe caller’s identity hash. It depends on how the caller authenticated, who issued the credential and the principal, so the same name authenticated another way has another hash. Present only when verified.
caller.didstringThe caller DID the transit token carries. Always asserted, even when verified is true. Absent for a fabric_peer caller and when the token names none.
caller.fieldsobjectCaller claims this Transit Point’s Workload Binding allowlists, from the caller’s verified token. Absent unless verified.
caller.fabricobjectPresent for a fabric_peer caller: peer_gateway_id, peer_issuer_did, hops, and caller_did, the DID the peer named. The gateway verifies the peer gateway itself. caller_did is the DID the peer states for its caller.
client.verificationstringsource_auth when the Transit Point’s Caller authentication verified the caller.
client.methodstringjwt_bearer, or api_key for both API key methods.
client.user_identity_hashstringThe client’s identity hash. Absent for a credential that names no subject, such as a JWT without its strategy’s caller identity claim.
client.subjectstringThe verified principal: the value of the JWT’s caller identity claim (sub by default), the Key ID for API key (provider), or the Secret ID for API key (secret store). Absent with the hash.

On a Transit Point that requires the transit token, caller is the end user. On a Transit Point that authenticates its own callers, client is the agent or service that called it. A Transit Point that does both fills both. A rule about the end user reads caller, and a rule about the calling agent reads client.

To allow only calls whose end user the Access Point verified, test verified and verification:

package surface.policy

default allow := false

allow if {
    input.transit.caller.verified
    input.transit.caller.verification == "transit_token"
}

To allow only named callers on a Transit Point that authenticates its own callers, check that the Transit Point verified the caller before you match its name:

package surface.policy

default allow := false

named_callers := {"crm-agent", "billing-agent"}

allow if {
    input.transit.client.verification == "source_auth"
    named_callers[input.transit.client.subject]
}

A transit token issued for a partner’s request over Fabric reaches the agent with caller.fabric set. Check caller.fabric only as an extra rule on Transit Points that require the transit token: on one that doesn’t, an agent that sends no token leaves the rule unmatched. Which partners reach a surface is set on the Publishing tab of each remote gateway record. See Gateways.

Input availability by evaluation path

Use this table when a policy condition behaves unexpectedly. The field you are checking may simply not be populated on that evaluation path.

The four columns correspond to these evaluation paths:

  • Inbound direct: a caller connects to an Access Point on this gateway.
  • Sent on to a fabric:// Target: a request arrives at the Access Point of a surface whose Target is fabric://, and the Target’s request policy evaluates the request this gateway sends on to the peer gateway.
  • Inbound from a connected gateway: this gateway receives, over Fabric, a request a connected gateway forwarded.
  • Outbound: the Managed Agent sends a request through a Transit Point to an upstream target.

Condition shorthand used in this table:

  • If Caller Context configured: the surface has a Caller Context element, whether or not the request’s credentials validated.
  • If enrichment on: Enrich policy input with agent context is on in the Policy element.
  • If Trust Checks configured: at least one Trust Check element is configured for this leg.
  • If VP present: a verified Verifiable Presentation (VP) was included in the request body.
  • If binding VP present: a verified VP from an upstream gateway was processed at the connection point.

✓ = always present on this path. — = never present on this path.

FieldInbound directSent on to a fabric:// TargetInbound from a connected gatewayOutbound
input.http✓✓✓✓
input.http.headersFilteredFilteredFilteredFiltered, from the original inbound request
input.gateway✓✓✓✓
input.gateway.direction"inbound""outbound""inbound""outbound"
input.gateway.source_idAbsentAbsentSending DIDManaged agent DID
input.gateway.target_idAbsentRemote gateway DIDAbsentTransit Point endpoint
input.channel✓✓✓✓
input.source_authIf Caller Context configuredIf Caller Context configuredIf Caller Context configuredIf the Transit Point authenticated the caller
input.mcpIf MCPIf 2026-07-28 MCPIf MCPIf MCP Transit Point
input.a2aIf A2AIf A2AIf A2AIf A2A Transit Point
input.agentIf enrichment onIf enrichment onIf enrichment onIf enrichment on
input.extension_identityIf VP present—If VP present—
input.identity_binding——If binding VP present—
input.trust_check_resultsIf Trust Checks configuredIf Trust Checks configuredIf Trust Checks configuredIf Trust Checks configured
input.transit———✓

Response policy input

A Target response policy and a Transit Point response policy evaluate the response, not the request, so they get their own input. It has no input.http, input.channel, input.gateway or input.trust_check_results. A rule written for a request policy reads absent fields here, evaluates to undefined, and denies every response.

{
  "response": {
    "status_code": 200,
    "body": { "jsonrpc": "2.0", "id": 1, "result": { "content": [] } },
    "content_type": "application/json",
    "is_error": false
  },
  "caller": {
    "did": "did:web:example.com:agent-1"
  },
  "surface": {
    "id": "surface-abc123",
    "name": "my-surface",
    "protocol": "mcp"
  }
}
FieldTypeDescription
input.response.status_codenumberThe HTTP status code of the response.
input.response.bodyobjectThe response body as JSON. Absent when the body isn’t JSON.
input.response.content_typestringThe response’s Content-Type. Absent when it has none.
input.response.is_errorbooleantrue when the status code is 4xx or 5xx. Always false on a response from an MCP proxy Target, so check status_code there.
input.caller.didstringOn a Target response policy, the caller’s agent DID when the gateway resolved one. On a Transit Point response policy, the managed agent’s DID. Absent otherwise.
input.caller.identity_sourcestringHow the caller’s identity was established, when known. Absent otherwise.
input.caller.dna_uaistringThe caller’s Agent DNA identifier, when its agent card carries one. Absent otherwise.
input.surface.idstringThe surface ID.
input.surface.namestringThe surface name.
input.surface.protocolstringThe surface protocol, such as mcp or a2a.
input.transitobjectOn a Transit Point response policy only: the same input.transit its request policies get. A rule about who receives the response reads input.transit.caller.
input.source_authobjectOn a Transit Point response policy only, when the Transit Point’s Caller authentication verified a caller: the same input.source_auth its request policies get.

Time-based decisions

A policy can allow or deny a request by the time it is evaluated, for example only during business hours. Rego’s time.now_ns() returns the current time, and time.clock and time.weekday turn it into the hour, minute and day in a time zone you name. The Business-hours access window template writes such a policy from a time window, a list of days and a time zone.

package surface.policy

default allow := false

# Minutes since midnight in the policy's time zone.
access_minute := (hour * 60) + minute if {
  [hour, minute, _] := time.clock([time.now_ns(), "Europe/Berlin"])
}

access_day if time.weekday([time.now_ns(), "Europe/Berlin"]) in {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}

# 09:00 (540) until 17:00 (1020), Monday to Friday.
allow if {
  access_day
  access_minute >= 540
  access_minute < 1020
}
  • Time zone: name it as an IANA time zone, such as Europe/Berlin, Asia/Singapore or UTC. The day is the request’s date in that time zone, not in UTC.
  • Day names: time.weekday returns English day names, such as Monday.
  • End of the window: a request at the end time is outside the window, so 17:00 allows requests until 16:59.
  • Windows that cross midnight: a window such as 22:00 to 06:00 has two parts, from 22:00 to midnight and from midnight to 06:00, and each part counts on its own date. With Monday to Friday listed, Monday 01:00 is inside the window and Saturday 01:00 is outside it.
  • Unreadable time: when the policy can’t read the time in its time zone, access_minute is undefined, so no allow rule matches and the request is denied.

The template’s Inside the window setting chooses Allow requests, which allows requests only inside the window, or Deny requests, which denies requests inside it and allows the rest. A request whose time the policy can’t read is denied either way. See Policy templates.

MCP tool policy input

MCP tool policies share the same package declaration (package surface.policy) and query path (data.surface.policy.allow) as surface policies, but get a different input with different field paths.

Full example

{
  "mcp": {
    "method": "tools/call",
    "params": { "name": "search", "arguments": { "query": "hello" } },
    "protocol": "json-rpc-2.0"
  },
  "jwt": {
    "role": "admin",
    "org": "acme-corp",
    "sub": "user@example.com"
  },
  "channel": {
    "name": "my-mcp-surface",
    "id": "surface-abc123",
    "protocol": "mcp"
  },
  "request": {
    "source_ip": "203.0.113.42",
    "method": "POST",
    "path": "/my-mcp-surface/mcp"
  }
}

Fields

FieldTypeDescription
input.mcp.methodstringAlways "tools/call": tool policies run only for tool calls.
input.mcp.paramsobjectFull parsed params from the tools/call body. Absent when the call has none. The tool name is input.mcp.params.name, and its arguments are input.mcp.params.arguments.
input.mcp.protocolstringAlways "json-rpc-2.0".
input.mcp.protocol_version, input.mcp.client_capabilities, input.mcp.client_infostring, object, objectSet for a 2026-07-28 MCP request only.
input.jwtobjectFlat claims map decoded from the request’s Authorization: Bearer token, without checking its signature. Rely on it only when the surface’s Access Point is closed and its Caller Context methods are all JWT Bearer, which verify the token first. Absent from the input entirely when the caller used a different authentication method. Referencing input.jwt.* without JWT auth evaluates to undefined and silently denies. Access claims directly: input.jwt.role, input.jwt.sub.
input.channel.namestringSurface name.
input.channel.idstringSurface ID.
input.channel.protocolstringAlways "mcp" for MCP tool policies.
input.request.methodstringHTTP method of the request.
input.request.pathstringHTTP request path.
input.request.source_ipstringSource IP address of the caller, or fabric on a request received over Fabric.

Field name mapping to MCP tool policy input

In gateway / surface policyIn MCP tool policyNotes
input.source_auth.claims.*input.jwt.*JWT claims are a flat map in the MCP tool policy input.
input.mcp.tool_nameinput.mcp.params.nameIn a tool policy, input.mcp.method is always tools/call.
input.http.methodinput.request.method
input.http.pathinput.request.path
input.channel.config_idinput.channel.id
Not availableinput.request.source_ipSource IP only available in MCP tool policies.

Absent fields and Rego behaviour

Fields that are not populated are omitted entirely from the JSON input. The only field that is ever null is a Trust Check result’s error. In Rego, referencing an absent field evaluates to undefined.

A rule block where any condition is undefined does not contribute to the allow decision. When default allow := false, a rule that silently becomes undefined causes a deny.

# This rule silently denies when input.mcp is absent (non-MCP request)
allow if {
  input.mcp.tool_name == "search"
}

To write rules that handle both present and absent fields safely, use object.get or check for field existence first:

allow if {
  input.source_auth.method == "jwt_bearer"
  object.get(input.source_auth, "claims", {}).role == "admin"
}

Stripped headers

input.http.headers never contains a header named exactly authorization, proxy-authorization, cookie, or set-cookie, or any header whose name contains token, secret, credential, apikey, or api-key, matched case-insensitively. These are stripped at policy input construction time, on both inbound and outbound requests. Policies cannot read bearer tokens, API key header values, session cookies, or similarly named credential headers from input.http.headers. Use input.source_auth for authenticated identity information instead.

On a Transit Point’s outbound leg, input.http.headers carries the non-sensitive headers from the original inbound request, so a policy on that leg can check a custom header the caller sent (for example a threat-intelligence or classification header) without needing to read it from input.source_auth.