Skip to content

Apply the decision

A policy only takes effect when your application asks for a decision and then acts on the reply. Agent Governance evaluates an enforced ruleset and returns the outcome, while your backend uses that outcome to authorize the action, such as a login, a payment, or an account change. Mosaic does not grant, block, or step up the request for you. The rules stay in the ruleset, so you can change what is allowed without changing your application's code, as long as the application still handles the same outcomes.

How it works

The user starts a sensitive action in your client. The client sends that request to your backend, and the backend queries Mosaic for a decision before the action proceeds. Mosaic evaluates the ruleset and returns the result. The backend authorizes the action from that reply, then tells the client whether to continue, stop, or ask for something more, such as a step-up.

MosaicBackendClientUser / AgentMosaicBackendClientUser / AgentStart a sensitive actionSend the request/evaluateReturn the decisionAuthorize from the replyAllow, deny, or challengeContinue or stop the action
MosaicBackendClientUser / AgentMosaicBackendClientUser / AgentStart a sensitive actionSend the request/evaluateReturn the decisionAuthorize from the replyAllow, deny, or challengeContinue or stop the action

Before you start

  • A Mosaic application with a client ID and a client secret. Create an application in the Admin Portal if you do not already have one. Your backend uses the client ID and secret to generate the access token for the decision call.
  • The Execute rule sets permission granted to that client. Without it, a client cannot obtain decisions.
  • A ruleset published to Enforce. A ruleset that exists only in Monitor returns Allow with degraded set to true. See Manage policies.

Step 1: Obtain a decision

Backend

Your backend asks for a decision when it is about to perform a sensitive action and needs to know whether that action should proceed. 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 the source and other parameters.

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.

For example, to obtain a decision for an Agent Intelligence session, send the Agent Intelligence session under sources. Put every Agent Intelligence field under sources.AGENT_INTELLIGENCE. session_token is required. Optional fields, such as action_type, correlation_id, claimed_user_id, and auth_context, go in the same AGENT_INTELLIGENCE object. For the full request, see Integrate Governance with Agent Intelligence.

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
        },
      },
    }),
  }
);

A successful response contains:

  • evaluation_id, unique to this call. It is also returned on errors.
  • decision: Allow, Deny, or Challenge. If matched_rule is null, no rule matched and decision is the default Allow.
  • matched_rule, with the rule id and name, or null.
  • 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.
{
  "error_code": 0,
  "error_message": "",
  "data": {
    "evaluation_id": "[EVALUATION_ID]",
    "decision": "Allow",
    "matched_rule": { "id": "[RULE_ID]", "name": "[RULE_NAME]" },
    "data_unavailable": false,
    "degraded": false
  },
  "headers": []
}

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 2: Authorize access

Backend

The reply is the input to your own authorization logic. After the call returns, your backend reads decision and decides what the caller may do. That logic belongs in the application, close to the action it protects, so a decision is applied before the login completes, the payment is submitted, or the account change is saved.

Trust Allow only when data_unavailable and degraded are both false. If either is true, do not treat Allow as permission to continue.

  • Allow grants the action and lets it continue.
  • Deny refuses the action and stops it.
  • Challenge asks for a stronger check before the action continues.

Handle the same outcome values your rules return, and keep this code stable. When the decision should change, update the ruleset rather than the authorization logic. A new rule, promoted from Monitor to Enforce, then reaches the same code path on the next call.