Check agents against a trust registry

Add a Trust Check that asks a trust registry about each caller or destination agent, and a Policy element that refuses requests whose checks fail.

This guide adds a Trust Check to a surface, so the gateway asks a trust registry about each calling or destination agent, and a Policy element that refuses the request when the answer is no. For what a Trust Check asks and which agent it verifies, see Trust Checks.

A Trust Check reports its results to policy and refuses nothing by itself. Without a Policy element that reads those results, a request from an agent the registry does not recognise still reaches your managed agent.

Use this guide when:

  • Agents from outside your organisation call your surface, and you accept only those a trust registry recognises or authorises.
  • Your managed agent calls other agents through a Transit Point, and you want to check each destination before the call leaves.
  • You want your own agent’s outbound calls to stop when a trust registry no longer recognises it.

For a complete example across two organisations, from registering an Issuer to a passing check, see Verify agents across organisations with a trust registry.

Prerequisites

You needWhere it comes from
A trust registry with status CONNECTEDAdding a trust registry.
The DID you trust as the anchor, as an Authority or an Issuer on this gatewayAdding an Authority for another organisation’s Issuer, or Adding an Issuer for your own. Skip this when you keep the default Agent identity credential issuer.
A surface whose callers send an agent DIDCallers whose own gateway signs their agent identity, or callers that include identity metadata. See Identify the agents that use a surface.
A role that can create policy definitions and edit surfacesAdministrator, by default.

Steps

Add a Trust Check on the caller leg

Open the surface. From the Security & Policy section of the palette, drag Trust Check onto the Access Point → Managed Agent edge.

Select the Trust Check, then select Configure Queries….

Configure the query

Fill in the query:

  • Trust Registry: the registry to ask.
  • Record Type: Recognition to ask whether the Authority owns the agent, or Authorization to ask whether it may perform an action on a resource.
  • Authority ID: the trust anchor. Pick one, or from version 1.0.10 several, from Select Issuers or Authorities…. See Which DID goes in which field.
  • Entity ID: keep The caller’s agent DID (default).
  • Action (optional) and Resource (optional): leave blank for a Recognition query, which then asks is / ownedAgent. An Authorization query needs both, for example register and agents.

To ask more than one question, select Add Another Query. Select Save.

Trust Check Configure Queries editor on the caller leg with one Recognition query against the Local Trust Registry, Authority ID set to the Org A Claims Department authority in the multi-select, Entity ID at The caller's agent DID (default), the default Action and Resource, Add Another Query, and Close and Save

Create the policy that enforces the checks

In the sidebar, select Policies, open the Agent Surfaces tab, and select Define Agent Surface Policy. Under Start from, select Create custom policy, then switch the Policy section to Rego. Enter a Name, replace the content of Policy Content (Rego) with this Rego, and select Create:

package surface.policy

default allow := false

allow if {
    count(input.trust_check_results.caller) > 0
    every r in input.trust_check_results.caller { r.ok }
}

The rule allows a request only when the caller-leg checks ran and every one passed. The count(...) > 0 line refuses a request for which no check ran. When one query lists several Authorities, this rule needs every one of them to recognise the caller. To accept a pass from any one of them, use the rule in Accept any one of several Authorities instead.

Attach the policy to the same edge

Back on the surface, drag Policy from Security & Policy onto the Access Point → Managed Agent edge. Select it and set Policy Definition to the policy you created. Save the surface.

Surface canvas for claims-intake with a Trust Check and then a Policy on the edge from the Access Point to the Managed Agent. The Policy panel shows Policy Definition Require Org A trust and its Rego, which requires every caller-leg Trust Check result to be ok

Which DID goes in which field

Each query asks the trust registry one question, over the Trust Registry Query Protocol (TRQP): does the Authority ID recognise or authorise the Entity ID, for the Action on the Resource? The Authority is the trust anchor you rely on, and the Entity is the agent you are checking. The choices depend on the leg the Trust Check is on.

Caller agentAccess PointTrust Check · caller legManaged AgentTrust Check · target legTransit PointDestination agentAccess Point → Managed AgentEntity ID: the caller's agent DIDAuthority ID: the caller's credential issuer bydefault, or another choice in the table belowinput.trust_check_results.callerManaged Agent → Transit PointEntity ID: the target's agent DIDAuthority ID: an Issuer or Authority you pickinput.trust_check_results.target

Caller leg (Access Point → Managed Agent)

FieldDefaultOther choices
Authority IDAgent identity credential issuer: the verified issuer of the caller’s agent identity credential.Sending gateway DID (fabric-inbound), for requests that arrive from a connected gateway over fabric://. On a direct request it is empty and the query fails. You can also pick an Issuer or an Authority configured on this gateway, to check every caller against a fixed trust anchor. Your first pick replaces the default. From version 1.0.10, you can pick several, and the query asks each one.
Entity IDThe caller’s agent DID: the agent DID the caller asserts in its request.The gateway’s managed-identity DID, derived by the surface’s Identity element. The caller’s verified identity credential issuer DID, to check the issuer itself rather than the agent.

Target leg (Managed Agent → Transit Point)

FieldDefaultOther choices
Authority IDNone. Pick at least one Issuer or Authority configured on this gateway.Only Issuers and Authorities are offered, because the destination agent cannot name who vouches for it. From version 1.0.10, you can pick several. With none configured, the field shows No Issuers or Authorities configured and links to add one.
Entity IDThe target’s agent DID: the agent DID published in the destination’s agent card.From version 1.0.10, set Checks to This surface’s managed agent to ask about the DID your managed agent calls out under. See Check that your own agent is still recognised.

Action and Resource

For a Recognition query, Action and Resource are optional and default to is and ownedAgent, which asks whether the Authority owns the agent. That is the record a Trust Recorder writes. For an Authorization query, both are required, for example register and agents.

Accept any one of several Authorities

From version 1.0.10, one query can list several Authorities, for example one Issuer for each partner organisation in an ecosystem. The gateway asks each listed Authority and gives policy one result for each, all carrying the query’s id. Under the field, the editor shows how many there are, for example “3 Authorities, one result each, in the order picked”.

To accept a caller that any one of the listed Authorities recognises, use this Rego in Step 3 instead. It groups the results by query id:

package surface.policy

default allow := false

caller_checks contains r.id if {
    some r in input.trust_check_results.caller
}

caller_checks_passed contains r.id if {
    some r in input.trust_check_results.caller
    r.ok
}

allow if {
    count(caller_checks) > 0
    count(caller_checks - caller_checks_passed) == 0
}

The rule allows a request when at least one query ran and every query passed for at least one of its Authorities. The gateway waits up to 5 seconds for each listed Authority, and an Authority that doesn’t answer in time fails only its own result.

Check a Transit Point’s destination

To check the agent a managed agent calls through a Transit Point, drop a Trust Check on that Managed Agent → Transit Point edge, and set each query’s Checks to Destination agent. It applies to that Transit Point only, so give each Transit Point the checks its destination needs. A Transit Point with no Trust Check runs none. Destination checks work on A2A Transit Points. For every placement and its limits, see Trust elements reference.

Results from a Transit Point’s checks reach policy at input.trust_check_results.target. Attach this policy with a Policy element on the same Managed Agent → Transit Point edge. It requires that the checks ran as well as that they passed, so a request through a Transit Point without checks is denied:

package surface.policy

default allow := false

allow if {
    count(input.trust_check_results.target) > 0
    every r in input.trust_check_results.target { r.ok }
}

Keep this rule off the Access Point → Managed Agent edge. Inbound requests carry no Transit Point results, so there it denies every request. A rule that only looks for failed results allows every request through a Transit Point that has no checks.

The All trust checks pass policy template also requires target-leg checks to have run, but counts a query as passed when any one of its Authorities recognises the destination. Select it under Start from in place of Create custom policy.

Check that your own agent is still recognised

From version 1.0.10, a Transit Point’s Trust Check can ask whether the trust registry still recognises your own managed agent, by the DID it calls out under. With a policy that requires the check to pass, the agent’s outbound calls through that Transit Point stop once the registry marks its record as not recognised. This works on every Transit Point, MCP included.

To withdraw recognition, change the record’s status in the registry and keep the record. A Trust Recorder on the same edge writes a deleted record again, as recognised, on the managed agent’s next call, but it leaves the status of a record that already exists as it is.

Record the managed agent’s outbound DID

Drag Trust Recorder onto the Managed Agent → Transit Point edge, and configure an entry as in Record your agents in a trust registry. Skip this step when another recorder or the registry’s administrator already records that DID.

Add a managed-agent query

Drag Trust Check onto the same edge and select Configure Queries…. Set Checks to This surface’s managed agent, then fill in Trust Registry, Record Type and Authority ID as for any query. Entity ID is the DID the managed agent calls out under, so you leave it as it is. Select Save.

If the editor warns that “This Transit Point presents no managed agent identity”, give the Transit Point a managed identity first: add an Identity element on the same Managed Agent → Transit Point edge. Otherwise every request reports MANAGED_AGENT_IDENTITY_UNAVAILABLE.

Attach a policy that requires the check

Create an Agent Surface policy as in Step 3 of Steps, with this Rego, and attach it with a Policy element on the same Managed Agent → Transit Point edge. Save the surface.

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 refuses a request through that Transit Point when a managed-agent query failed for all of its Authorities. A discovery read, such as a fetch of the destination’s agent card, runs no managed-agent query, so the rule allows it.

Review Trust Checks copied to Transit Points

From version 1.0.2, each Transit Point runs only its own Trust Checks. After the upgrade, a surface that had a surface-wide target-leg Trust Check has a copy of it on every Transit Point, flagged for review. Review each copy so each Transit Point runs only the checks its destination needs.

Open the surface

Open a surface in the Surface Builder that shows a banner such as 2 Transit Points need Trust Check review above the canvas. If the banner says some are in other variants, the alternative configurations of the surface that callers select by alias, repeat these steps in each of those variants.

Select a flagged Trust Check

Select a Trust Check that carries a warning badge on a Managed Agent → Transit Point edge. Its panel shows Review this migrated Trust Check.

Surface Builder canvas with a 2 Transit Points need Trust Check review banner, warning badges on the Trust Checks of an A2A and an MCP Transit Point, and the A2A Trust Check panel showing Review this migrated Trust Check with a Keep button

Keep or remove the copy

  • To keep the checks on this Transit Point, select Keep.
  • To stop checking this Transit Point’s destination, select Remove Trust Check.

On an MCP Transit Point, a copy that holds a Destination agent query is read-only, so keep or remove it as it is.

Save the surface

Save the surface once every flagged Trust Check is reviewed. The banner disappears when no copy is left to review.

Before removing a copy, check the surface’s policies. A policy that denied on that Transit Point’s results allows its traffic once the checks stop. Use the count(...) > 0 pattern above wherever a policy must require target-leg checks.

Confirm

Callers reach your surface through their own gateway, which presents their agent identity. To test, send a request to the calling surface, whose managed agent forwards it to your surface. For example, on an A2A calling surface that requires an API key in X-API-Key:

curl -X POST "<CALLER_ENTRY_POINT_URL>" \
  -H "Content-Type: application/json" \
  -H "A2A-Version: 0.3" \
  -H "X-API-Key: <CALLER_KEY>" \
  -d '{"jsonrpc":"2.0","method":"message/send","id":1,"params":{"message":{"messageId":"trust-check-1","role":"user","parts":[{"kind":"text","text":"Hello"}]}}}'

Replace X-API-Key and <CALLER_KEY> with the header and key that the calling surface’s Caller Context reads. Read the outcome on your gateway’s Audit page, with Enable VP Auditing on and the Trust Check event selected in Settings › Security.

Test 1: request from an agent the registry recognises returns 200

Send the request from an agent whose Authority has a record for it.

Expected: your managed agent’s response, returned through the calling agent. The Audit record reads Trust check passed, with the caller leg and Result Passed.

Test 2: request from an agent the registry does not recognise returns 403

Send the same request from an agent with no record under that Authority.

Expected: your surface refuses the forwarded request with 403. The curl output depends on how the calling agent reports the refusal, so check the result on your Audit page: the record reads Trust check failed, with “Failed because NOT_RECOGNIZED”.

Test 3: call through a Transit Point from an agent the registry no longer recognises returns 403

For a Transit Point set up as in Check that your own agent is still recognised, set the managed agent’s record in the trust registry to not recognised. In the trust registry’s admin UI, select Records, open the record’s More menu and select Edit. Under Select record status, select Unrecognised, then select Save. Then send a request that makes the managed agent call out through that Transit Point.

Expected: the gateway refuses the outbound call with 403. On the Audit page, the record reads Trust check failed.

Troubleshooting

SymptomLikely causeFix
Every request returns 403, including from recognised agents.The query could not complete, for example because the registry is not CONNECTED or the caller sent no agent DID.Find the result code and follow Troubleshoot Trust Check denials.
Requests from unrecognised agents return 200.No Policy element reads the results, or the rule allows a request with no results.Attach the policy from Step 3 on the same edge as the Trust Check.
Configure Queries… shows View Queries… instead.The Trust Check is a copy on an MCP Transit Point that holds a destination query, which is read-only.Keep or remove it, as described in Review Trust Checks copied to Transit Points. To check the managed agent there, add a new Trust Check after removing the copy.
Every request through a Transit Point is refused, and the managed-agent result reads MANAGED_AGENT_IDENTITY_UNAVAILABLE.The Transit Point presents no managed agent identity, so the query has no DID to ask about.Add an Identity element on the Managed Agent → Transit Point edge to give the Transit Point a managed identity, then save the surface.
A query with several Authorities fails for one of them with QUERY_TIMEOUT.That Authority’s trust registry didn’t answer within 5 seconds.Check the registry’s connection on Connections › Registries. With the rule in Accept any one of several Authorities, another Authority’s pass still allows the request.

Next steps