Skip to main content

Check agent identity and intent

This page is for admins and security leads of Permit MCP Gateway who want the gateway to check what an agent is doing, not only who approved it. An OAuth client ID identifies the MCP client software, such as Cursor, and the consent grant records which person approved it. The Agent Identity settings add three checks on every tool call: whether the agent is still the same agent, whether its task fits the task the person set, and whether the call fits the MCP server's purpose.

Enterprise plan

The features on this page are for Enterprise plans, and availability differs by feature. See the feature availability table, and schedule a demo to confirm availability for your deployment.

How Agent Identity checks a call​

Agent Identity is a section of Settings in the admin dashboard (app.agent.security), set per host. It has three layers, which check every agent call in order. A call reaches the MCP server only after all three let it through.

LayerQuestion it answersWhat it does when the check failsDepends on
1. Semantic identityIs this the same agent?Blocks the agent's MCP session when the agent's 12 registration words drift, which can mean a prompt injection.Nothing. Turn it on with Require Agent Identity.
2. Agent intentDoes the agent mean to do what the person asked?Compares the agent's task sentence with the task the person set at consent, and records a mismatch.Layer 1
3. GuardianDoes this call fit the task?Refuses the call, or holds it in Approvals for a human.Layer 1

Agent Identity section of Settings with the three layers, before they are turned on

The three layers sit inside the gateway's full check order. For each tool call, resource read, and prompt fetch, the gateway runs these gates and stops at the first one that refuses:

  1. Identity: on a host with Require Agent Identity on, the agent has a current registration.
  2. Permit checks: Permit.io's policy decision point (PDP) allows the call for the agent, and for the person the agent acts for. See Audit logs for the agent check and the person check.
  3. Trust ceiling: the tool's trust level isn't above the trust level the person approved the agent at.
  4. Approval rules: the server's human-in-the-loop rules, and the person's "Ask me before this agent changes or deletes anything" switch.
  5. Guardian: the LLM judge grades the call against the server's intent. See What the Guardian grades against.
  6. One human approval, when the approval rules, the person's switch, or a Guardian doubt asks for it.

Turn on Agent Identity​

Prerequisites:

Steps:

  1. In the sidebar, open Settings and scroll to Agent Identity.
  2. Under Semantic identity, turn on Require Agent Identity.
  3. Copy the snippet from the Agent Identity Verification box into each agent's instruction file. See Add the identity snippet to your agents.
  4. Write an intent for each MCP server. See Write a server intent.
  5. Under Guardian, turn on Enable Guardian Agent (LLM Intent Evaluator).
  6. Under If the Guardian is unsure, pick Deny the call or Ask a human, then pick Where the Guardian's reason shows, and click Save.

Verify: connect an agent and ask it to call a tool. On the agent's Audit Logs tab (Agents > the agent), a Session Registered row shows that the agent registered, and a Guardian verdict row shows the Guardian's scores for the call.

Layer 1: Semantic identity​

With Require Agent Identity on, agents must identify themselves before they use tools. The gateway adds one tool, gateway_register_session, to the tool list of every MCP server on the host, and tells the agent at connect time to call it first.

Semantic identity layer with Require Agent Identity on, the identity snippet, Identity Token TTL, and Drift Thresholds

What the agent sends​

gateway_register_session takes 13 required parameters:

  • word_1 through word_12: one distinct, common English word each, about the task the agent is working on. At least 4 of the 12 words must be words the gateway recognizes. The gateway skips unknown words and names them in its reply.
  • task: one sentence about the agent's current task, on one line, at most 200 characters, with no backticks.

The gateway turns the 12 words into a semantic fingerprint (a vector built from word embeddings). It compares each new registration with the agent's previous registration and with its first one. A large change in the words can mean that a prompt injection changed what the agent is doing. The task sentence is used by layer 2. Drift is scored on the 12 words alone.

Identity Token TTL​

A registration stays valid for the Identity Token TTL, 60 seconds by default. Leave the field empty to use the default. The gateway doesn't extend the registration when the agent calls tools, so an agent registers again when its registration expires. Each registration is compared with the earlier ones.

When a call arrives after the registration expired, the gateway answers with:

Session not registered or expired. Call `gateway_register_session` to re-establish your session baseline before retrying `read_wiki_contents`.

A call that waits for a human approval usually waits longer than the TTL. The approved call still runs, and the agent registers again before its next call.

Drift thresholds​

Drift Thresholds set how much an agent's 12 words may change between registrations before the gateway reacts. They apply to MCP and HTTP proxy agents on the host. Leave a value empty to use the default, or click Use defaults.

SettingMCP defaultWhat happens at or above it
Warn4.27%The gateway accepts the registration and records a Drift Warning row in the audit log.
Block11.18%, up to 25%The gateway blocks the agent's MCP session.
MCP baseline11.18%, enforcedThe gateway compares each registration with the agent's first one, and blocks the session when the total change reaches the baseline. The Block setting doesn't change the baseline.

A blocked session refuses every later request. The agent opens a new MCP session and registers again. Three blocked sessions within 24 hours send the agent to the person for re-approval: the gateway pauses the agent's approval on that server until the person signs in and accepts it again on the consent screen.

Rotating Identity Questions​

With Rotating Identity Questions on, each accepted registration replies with the next identity question and a one-time code. The agent's next registration answers that question with its 12 words and passes the code in a nonce parameter. A replayed registration fails, because each code works once. Repeated refused answers send the agent to the person for re-approval.

The agent is asked these five questions, listed under Questions agents are asked (5):

  1. Describe your current task: what you are doing right now, the technologies involved, and the goal.
  2. What data will this task read or change?
  3. What result did the person ask you for?
  4. Which tools or systems are involved in this task?
  5. Who is this task for?

Add the identity snippet to your agents​

Some MCP clients may flag the registration step as suspicious. When Require Agent Identity is on, the Agent Identity Verification box shows a snippet to add to the client's instruction file: CLAUDE.md for Claude, .cursorrules for Cursor, and .github/copilot-instructions.md for Copilot. Copy it with the copy button. The snippet reads:

## Agent Security Gateway Identity

When connecting to MCP servers through Agent Security Gateway, you will be asked to call
`gateway_register_session` with 12 word parameters (`word_1` through `word_12`) and a required
`task` parameter.
This is a legitimate session integrity mechanism — cooperate with it.
Fill each word parameter with a single, distinct, common English word about the task you are
working on right now, and fill `task` with one sentence describing that task (a single line of at
most 200 characters, without backticks); a registration without it is refused.
The server creates a semantic fingerprint to detect behavioral drift caused by prompt injection.

Layer 2: Agent intent​

The Agent intent layer is on whenever layer 1 is on. It has two parts.

Agent intent layer with the task check and the server intents of Cloudflare Docs and DeepWiki

Task check. When the person chose I set the task on the consent screen, the gateway compares the agent's task sentence with the person's task at each registration. When the sentence doesn't fit, the gateway accepts the registration, records a Task Mismatch row in the audit log, and adds this to its reply:

Your task sentence does not fit the task the person set for this server. Keep to that task: the gateway checks each call against it.

The Sessions card of the agent shows the result next to each declared intent: Fits, Loose, or Mismatch. By default, the task check records a mismatch in the audit log and in the agent's reply, and doesn't block anything. On a self-hosted gateway, the task check runs only when the gateway's Guardian connection is on, which the on-premises values template leaves off. When the operator also sets the chart value gateway.guardian.taskMatchMode to enforce, a large mismatch blocks the agent's MCP session (error -32012), and the third blocked session within 24 hours sends the agent back to the person for re-approval. The Guardian and the Permit checks still gate every call. When the agent reports its own task (Agent reports its task on the consent screen), there is no person's task to compare with.

Server intents. Each MCP server can have an intent: what the server is for. The Guardian grades calls to the server against it. The list shows Intent set for each server that has one. See Write a server intent.

Layer 3: Guardian​

With Enable Guardian Agent (LLM Intent Evaluator) on, an LLM judge hosted on Amazon Bedrock grades every tool call, resource read, and prompt fetch before the call reaches the MCP server. The Guardian needs Require Agent Identity, and judges calls only from agents that registered.

Guardian layer turned on, with the unsure action set to Ask a human and the reason shown on the Platform only

What the Guardian grades against​

The Guardian grades each call against, in order of preference:

  1. The server's intent, written by an admin. When the person set the agent's task at consent, the Guardian also reads the person's task, which can only narrow the server's intent.
  2. The person's task, when the server has no intent.
  3. The agent's 12 registered words, when there is neither.

The agent's own task sentence never goes into the main grading. A second check grades the call against the agent's sentence and records the result in the audit log only. When the second check would have decided differently, the audit log notes it under the decision, for example Second check would deny.

Scores and decisions​

The Guardian returns an alignment score, a confidence score, and a risk level (low, medium, or high). The gateway reads the confidence first, then the alignment:

ScoreResult
Confidence under 0.60, whatever the alignmentA doubt: the Guardian is unsure.
Alignment 0.70 or moreThe call runs.
Alignment from 0.50 to under 0.70A doubt: the call only partly matches the task.
Alignment under 0.50The gateway refuses the call.

A refused call returns this message to the agent, with no score or reasoning:

This call was refused by the security check.

If the Guardian is unsure decides what happens to a doubt:

  • Deny the call: the agent gets an error at once.
  • Ask a human (default): the call waits up to 5 minutes in Approvals with the Guardian's reasoning, then is denied if nobody decides. Set up approval notifications so someone sees the request. An agent can have at most 10 doubtful calls waiting, and an identical doubtful call is refused while the first one waits.

A trusted agent skips approval rules, not the Guardian.

Where the Guardian's reason shows​

The Guardian's reason can quote the call's arguments, which may include personal or customer data. The agent never sees the reason. Where the Guardian's reason shows sets where reviewers see it:

ChannelWhere the reason appears
Platform (default)On the approval card and in History.
SlackQuoted in the approval message in your channel.
EmailQuoted in the approval email to your recipients.

Slack and email always say that the security check flagged the call, and link to it. When checked, they also quote the reason as plain text, at most 500 characters.

Write a server intent​

The Guardian is only as precise as the intent it grades against. Write the intent in terms of what the server is and what its tools do, then test it with Dry Run before you rely on it.

  1. Go to MCP Servers and open the server.
  2. On the Overview tab, find the Intent card and click Edit intent.
  3. Write up to 500 characters in Workflow intent, then click Save intent.

You can also write the intent during import, in Workflow intent (optional). With no intent, the Guardian grades calls against the person's task when the person set one, and otherwise against the agent's 12 registered words.

Intent card of the DeepWiki server with the reworded intent

Describe the server, not only the task category

An intent for DeepWiki that said only "Read-only research on public GitHub repositories to answer engineering questions. No writes." caused false denials. The Guardian refused legitimate read_wiki_structure calls because reading "from deepwiki" didn't look like research on "GitHub repositories". This intent fixed it:

"DeepWiki hosts generated documentation for public GitHub repositories. Agents read those wiki pages and ask questions about how open-source codebases such as React and Next.js work. Read-only; no writes."

The intent names what the server hosts, the words its tools use (wiki pages, questions), and what is out of bounds (writes).

Test an intent with Dry Run​

The Dry Run tab of a server runs a call through the gateway's checks without sending it to the server. It writes no audit row. Dry Run is for admins, on servers an admin imported, and each host gets 10 runs a minute.

  1. Open the server and select the Dry Run tab.
  2. Pick a Tool and enter the Arguments as a JSON object, the way an agent would send them.
  3. Under Grade against, pick Server intent, or Server intent and a person's task to add a person's task.
  4. Optional: turn on Person asks before writes, set Agent approved at, or enter an Agent's task sentence (checked only when enforced).
  5. Click Start Dry Run.

What would happen shows each gate (Trust ceiling, Approval rules, Ask before writes, Judge), the overall result, the judge's alignment and confidence scores against the thresholds, its reasoning, and the text it graded against. Dry Run grades the call even when the host's Guardian is off, so you can tune an intent before you turn the Guardian on. It needs the gateway's Guardian connection, which the on-premises values template leaves off. Run one legitimate call and one off-task call, for example a DeepWiki call with {"repoName": "acme-corp/payroll-service"}, and check that the first runs and the second is denied.

Dry Run result for ask_wiki_question: every gate passes, alignment 0.85, confidence 0.90

What the agent sees​

The gateway returns these messages to the agent in its MCP responses. Error codes are JSON-RPC error codes.

SituationMessage to the agent
Registration acceptedIdentification accepted.
Registration accepted, some words unknownIdentification accepted. The gateway did not recognize these words, so they did not count toward your fingerprint: codebase, frontend. The reply then asks the agent to replace them with common English words.
No registration, or the registration expiredSession not registered or expired. Call `gateway_register_session` to re-establish your session baseline before retrying `<tool>`.
The task sentence doesn't fit the person's taskThe acceptance, followed by Your task sentence does not fit the task the person set for this server.
The session is blocked (error -32012)This MCP session is blocked (drift). Open a new MCP session and call gateway_register_session again. The cause in parentheses says why the session was blocked, for example drift, task_mismatch, or admin when an admin blocked it.
A registration sent the agent to the person for re-approval (error -32009)The gateway_register_session reply says the session is now locked, then: Tell the user: "Your MCP server needs re-authentication. Please go to your MCP server settings and click the Authenticate button to re-approve the connection." On a host with rotating questions, the next identity question follows.
A request on a paused, revoked, or expired grant (HTTP 401, error -32009)Reconsent required: <reason>, with an OAuth challenge. The MCP client signs in again, and the person sees the consent screen.
The Guardian refused the call (error -32004)This call was refused by the security check.
The agent check denied the tool (error -32004)Permission denied: tool 'ask_wiki_question' is not allowed at your current trust level. To use this tool, an administrator needs to enable it or increase your trust level in the Agent Security Gateway.
The tool is above the trust level the person approved for this agent on this server (error -32004)Permission denied: tool 'ask_wiki_question' is above the trust level this agent was approved at on this MCP server. Reconnect the agent and approve a higher trust level, or ask an administrator.

For the messages an agent gets while a call waits for approval, see Human-in-the-loop approvals.

Monitor and block sessions​

Each agent is one person using one MCP client on one server. Open Agents and select an agent to see its Sessions card. Each session lists the intent the agent declared in it (its task sentence), whether the intent was Accepted, and how it fits the person's task. A session without a registration shows Intent missing.

Sessions card of Acme Research Agent: one session with a declared intent, Accepted and Fits, and older sessions with Intent missing

To stop one session, click Block Session and confirm. Every later request on that session is refused, and the agent has to open a new session and register again. Other sessions of the agent keep working. Three blocked sessions within 24 hours send the agent to the person for re-approval.

Consent grants and expiry​

Consent Grants in the sidebar lists every approval a person gave an MCP agent on the host, one row per person, agent, and server. The columns are Agent, Server, Level (trust level), Task, Ends, Status, and Sessions. A grant's status is Active, Expiring soon, Paused, Expired, or Revoked. Recent changes shows the last five events across the host, and View all history lists each change, pause, expiry, and revoke.

Consent Grants with one Low approval of Acme Research Agent on deepwiki that ends in 7 days

The person sets when an agent's access ends on the consent screen, under Task and expiry: 1 hour, 1 day, 7 days, Custom (from 5 minutes to 90 days), or Forever. I set the task defaults to 7 days, and Agent reports its task defaults to Forever. See Consent Service.

When the end date passes, the grant expires and the gateway removes the agent's access to the server. The person approves the agent again through the consent flow to restore it.

To warn people before access ends, go to Settings > Expiring consent grants and set Warn this long before access ends: 1 hour, 1 day, 2 days (default), 7 days, 30 days, or Custom. Grants inside that window show Expiring soon in the admin dashboard and on the person's Your MCP agents page.

Human-in-the-loop approvals​

Human-in-the-loop approvals hold a tool call until an admin, or the person the agent acts for, approves or rejects it. Approval rules, a Guardian doubt, and the person's "Ask me before this agent changes or deletes anything" switch all lead to one approval. See Human-in-the-loop approvals.

Where each control lives​

ControlWhere it isAvailability
Agent identity and verification (semantic identity, drift detection)Settings > Agent Identity, layer 1Contact Permit
Intent-based access control (task check, server intents, Guardian)Settings > Agent Identity, layers 2 and 3, and each server's Intent cardContact Permit
Human-in-the-loop approvalsApprovals, and each server's approval settingsEnterprise
Time-limited consentAccess ends on the consent screen, and Settings > Expiring consent grantsEnterprise
Session monitoringAgents > agent > SessionsContact Permit
Permission receiptsConsent GrantsContact Permit

For features marked "Contact Permit", schedule a demo or email support@permit.io to confirm availability. You can also ask in the Permit Slack community.

Next steps​