Skip to content

Integrate Governance with Agent Intelligence

An agent in a session can complete the same sensitive actions as a person, such as logging in or submitting a payment. Agent Intelligence monitors this activity and writes it to the session. This guide describes how to integrate Agent Governance with Agent Intelligence and obtain a decision based on that session data. Your application can then block the request, require step-up, or limit what the session can do, depending on which agent it is and whether a human is involved.

Note

To retrieve the session from your backend, see Retrieve session data. Agent Governance is for cases where you want Mosaic to evaluate your governance policy and return an outcome.

How it works

  1. An agent loads the page. The SDK initializes with agenticCollect: true and enableSessionToken: true, and writes the session token to a cookie on your domain.
  2. The agent browses pages and performs actions while Agent Intelligence monitors this activity and writes it to the session.
  3. When your backend needs a decision, such as at login, payment, or another sensitive request, it calls Governance with the session token.
  4. Governance reads the session from Agent Intelligence, runs the rules you enforced, and returns Allow, Deny, or Challenge.
  5. Your backend applies that outcome in the app, for example, blocks an agent or forces step-up authentication.
Agent IntelligenceGovernanceYour backendClient with Platform SDKBrowserAgent IntelligenceGovernanceYour backendClient with Platform SDKBrowserLoad the pageInitialize with agenticCollectand enableSessionTokenSet the session token cookieBrowse pages and perform actionsStream activitySensitive request, with the cookieSession token, ruleset, and request contextRead the current sessionActor, context, and risk signalsAllow, Deny, or ChallengeEnforce the outcome
Agent IntelligenceGovernanceYour backendClient with Platform SDKBrowserAgent IntelligenceGovernanceYour backendClient with Platform SDKBrowserLoad the pageInitialize with agenticCollectand enableSessionTokenSet the session token cookieBrowse pages and perform actionsStream activitySensitive request, with the cookieSession token, ruleset, and request contextRead the current sessionActor, context, and risk signalsAllow, Deny, or ChallengeEnforce the outcome

Before you start

  • A Mosaic application with client credentials. Create an application in the Admin Portal if you do not already have one.
  • The Execute rule sets permission granted to that client. Without it, a client cannot obtain decisions.
  • Agent Intelligence integration. If you already use Mosaic Fraud Prevention, keep the same clientId and the same region in serverPath.

Step 1: Obtain session token

Client

Modify your Agent Intelligence integration to enable session token generation. Set enableSessionToken: true in the same SDK configuration that enables Agent Intelligence. The SDK then writes the session token to the ts_asc cookie on your site's parent domain, so a backend on another subdomain of that site receives the cookie with the request.

Add the flag inside drs, next to agenticCollect:

drs: {
  agenticCollect: true, // Enables Agent Intelligence detection
  enableSessionToken: true, // Writes the session token cookie for your backend
  serverPath: 'https://api.transmitsecurity.io/risk-collect/', // Set serverPath based on your region or custom domain
}
Note

If your API is on a different site, the browser does not send the cookie. Read the token in the page and pass it to your backend in a header or field your API accepts. With the Platform SDK in your application code, you can read it with getSessionToken().

Step 2: Set up a ruleset

Admin Portal

In the Admin Portal, go to Agentic Trust > Agent Governance > Policy Management and create a ruleset on Agent Intelligence data. A policy is the governance principle for what your application allows. You create it by creating a ruleset: a collection of rules, each with a condition on an Agent Intelligence signal and a result of Allow, Challenge, or Deny. For the concepts, see How policies work; for the full workflow, see Manage policies.

Publish the ruleset in Enforce so Agent Governance acts on it when your backend asks for a decision. Note the ruleset ID for the next step.

Step 3: Obtain decision

Backend

Call Governance APIs from your backend when you need a decision. Authorize the call with a client access token generated from your client credentials. The token must be issued to the same client as the clientId query parameter.

Send POST /ido/api/v2/decisioning/rule-sets/[RULESET_ID]/evaluate?clientId=[CLIENT_ID], where [RULESET_ID] is the UUID of a ruleset published to Enforce and [CLIENT_ID] is your client ID. In the request body, specify AGENT_INTELLIGENCE as a source and provide additional parameters.

Put the session token and any context under sources.AGENT_INTELLIGENCE. session_token is required. The other fields are optional but your rules can use them for decisioning, for example, action_type and claimed_user_id.

Important

A field sent at the top level of the body is ignored. The ruleset then has no session data, data_unavailable is true, and the decision falls through to Allow. An unknown key under sources returns 400.

// Update the API host to match your region or custom domain
const resp = await fetch(
  'https://api.transmitsecurity.io/ido/api/v2/decisioning/rule-sets/[RULESET_ID]/evaluate?clientId=[CLIENT_ID]',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Authorization: 'Bearer [ACCESS_TOKEN]', // Client credentials token of [CLIENT_ID]
    },
    body: JSON.stringify({
      sources: {
        AGENT_INTELLIGENCE: {
          session_token: '[SESSION_TOKEN]', // Required. Value of the ts_asc cookie
          action_type: 'transaction', // Optional. The type of action, such as login, transaction
          correlation_id: '[CORRELATION_ID]', // Optional
          claimed_user_id: '[HASHED_USER_ID]', // Optional. Must be hashed. Do not send an email address, phone number, or other plain-text personal data
          claimed_user_id_type: 'account_id', // Optional
          auth_context: {
            user_id: '[USER_ID]', // Optional. ID of logged-in user
            auth_method: 'webauthn', // Optional
            failed_attempts: 0, // Optional
          },
        },
      },
    }),
  }
);

A successful response looks like this:

{
  "error_code": 0,
  "error_message": "",
  "data": {
    "evaluation_id": "[EVALUATION_ID]",
    "decision": "Allow",
    "matched_rule": { "id": "[RULE_ID]", "name": "Rule 1" },
    "data_unavailable": false,
    "degraded": false
  },
  "headers": []
}

data contains:

  • evaluation_id, unique to this call. It is also returned on errors, which helps when you contact support.
  • decision: Allow, Deny, or Challenge.
  • matched_rule: the id and name of the rule that matched, or null when no rule matched. The decision is then the default Allow.
  • data_unavailable: true when the ruleset needs Agent Intelligence data and it was not sent. The decision is then made without that data.
  • degraded: true when the decision did not come from the Enforce rules. For example, the ruleset only has a Monitor version, or an internal failure occurred. The decision is then the default Allow.

The response does not include the Agent Intelligence session, the context you sent, or a session ID. Trust Allow only when data_unavailable and degraded are both false.

Errors use the same envelope, with a non-zero error_code:

  • 400 / 17: the ruleset ID is malformed, or the body is invalid (for example, session_token is missing, or an unknown key under sources).
  • 400 / 18102: Agent Intelligence rejected the session token (expired or invalid, it belongs to another tenant, there is no current session, or the session ended), or the Agent Intelligence session endpoint is not enabled for the tenant.
  • 401 / 5000: the Authorization header is missing.
  • 401 / 5001: the access token is invalid or expired, it was not issued to clientId, or it belongs to another tenant.
  • 403 / 17000: clientId is missing.
  • 403 / 5010: the client does not have the Execute rule sets permission.
  • 404 / 18101: the ruleset was not found.
  • 404 / 24: Agent Governance is not enabled for the tenant.
  • 500 / 18106: an internal error.
  • 502 / 18105: an unexpected response from Agent Intelligence.
  • 503 / 18103: Agent Intelligence timed out.
  • 503 / 18104: Agent Intelligence is unavailable or rate-limited. You can retry.

Step 4: Act on the decision

Backend
Client

Apply decision in your application. Mosaic does not block, redirect, or step up the interaction for you.

  • Allow continues the action. Continue only when data_unavailable and degraded are both false.
  • Deny stops the request.
  • Challenge requires a stronger check before the action continues.

Use the same outcome values your rules return, and keep the enforcement in the backend.