Skip to content

Compliance risk agent

This page explains how a compliance risk agent, under controlled authority, patrols owned sites and marketing materials for wording that touches forbidden claims or regulatory red lines, and combines public regulatory announcements into an evidence-backed risk list. After reading it, you will understand which modules this scenario needs, when interactive consent is actually needed, and why forbidden-claims lists and regulation versions must come from a controlled policy store rather than Memory.

Use case

Compliance teams need to monitor regulatory announcements, policy changes, industry risks, and business impact, while ensuring that wording on owned websites, landing pages, and marketing materials does not touch forbidden claims or regulatory red lines. Material volume is large and updates are frequent; manual page-by-page checks cannot keep up with the release pace, and once a regulator's letter arrives, reconstructing "what the page said at the time" is often impossible.

Typical triggers:

  • A regulator publishes new wording restrictions or industry guidance, and existing materials must be screened for impact.
  • Before a major campaign launches, all landing pages and materials must be patrolled for wording.
  • A periodic compliance patrol cycle is due, and this period's risk list and evidence archive must be produced.

Engineering challenges

  • The judgment basis must be controlled: forbidden-claims lists and regulation entries are compliance assets with versions and effective dates. Any rule "recalled from memory" may be stale wording — a conclusion built on the wrong list is more dangerous than a missed item.
  • Evidence requirements exceed a normal patrol: a regulator's follow-up needs to reconstruct "what the page said, judged against which list version"; a suspected item without a screenshot, verbatim excerpt, and timestamp has no evidentiary value.
  • The output's positioning is sensitive: once a tool's output is treated as a compliance verdict, it displaces the professional judgment that belongs to the compliance team — the output must stay strictly an audit data foundation, never a conformity assertion.

Module composition

ModuleRoleNotes
GenAuthCoreSilent delegation issues the short-lived runtime credential every product call requires; interactive consent is only needed when login state or write actions enter the picture. Credentials are re-issued per cycle and revocable.
Web AgentCorePatrols owned sites and material pages with Track, comparing wording against the forbidden-claims list with deterministic rules; searches regulator sites and public legal materials through WebSearch, keeping all sources.
GUMemNot usedForbidden-claims lists and regulation versions are controlled compliance assets — they must come from your controlled policy store and be cited by version. Risk lists, evidence, and the compliance team's final judgments are archived to your audit storage. Neither is Memory.

Compliance risk agent architecture

Every product call requires a GenAuth delegate token; public read-only scenarios are covered by silent delegation. The main targets in this scenario are owned public pages and public regulatory sources, which silent delegation (delegateToken without mode: 'interactive') covers: credentials are short-lived, revocable at any time, and re-issued per patrol cycle. Only the following cases require escalating to interactive consent, confirmed by the compliance owner in Qoni Console:

  • The patrol needs a signed-in materials back office or CMS preview.
  • The delegation scope expands to a new business line or region.

Note: the SDK example requests product-level scopes (such as webagent.do_anything:read). Fine-grained boundaries — business lines, regions, page ranges — are enforced by the GenAuth Agent Profile or your policy layer, not by the task prompt; that configuration is not shown on this page. See Delegate token and attenuation for the full semantics.

Workflow

Compliance risk agent workflow

  1. The compliance team submits the patrol scope: business line, region, and material list.

  2. GenAuth issues a read-only delegation credential for this patrol cycle.

  3. Your app loads the current version of the forbidden-claims list and applicable regulation entries from the controlled policy store and injects them into the task.

  4. Web Agent searches related regulatory announcements and legal updates through WebSearch, recording sources.

  5. Web Agent patrols owned sites and material pages with Track, comparing wording against the forbidden-claims list with deterministic rules.

    Checkpoint: Every suspected violation must retain a page screenshot, verbatim excerpt, and source URL; suspected items without evidence do not enter the risk list.

  6. Your app validates the output contract — suspected items missing an evidence source or rule ID are dropped — and archives the risk list and evidence pointers to your audit storage by list version.

  7. The Agent returns the risk list, evidence, items pending human confirmation, and audit id, and hands them to the compliance team.

    Checkpoint: The deliverable should state explicitly that it "provides an audit data foundation and makes no compliance conformity assertion"; the final judgment belongs to the compliance team.

Example code

The example below wires this scenario into your backend with the official Qoni SDK (@qoniai/qoni): silent delegation → load the forbidden-claims list and regulation versions from your controlled policy store → one doAnything.run() consumed through the events() stream for a single read-only patrol cycle → parse and validate the risk list. Recurring patrols are re-run on your application's schedule.

ts
import { Qoni, QoniScopes } from '@qoniai/qoni'

const qoni = new Qoni({
  accessKey: process.env.QONI_ACCESS_KEY!,
  secretKey: process.env.QONI_SECRET_KEY!,
})

export async function runComplianceCycle(ownedPages: string[]) {
  // 1. Silent delegation: patrols owned public pages, no third-party sign-in
  //    (your app schedules recurring cycles and re-issues per cycle;
  //     switch to mode: 'interactive' when a signed-in back office is needed,
  //     confirmed by the compliance owner)
  const { data: grant } = await qoni.delegateToken({
    user: { id: process.env.QONI_USER_ID! },
    agent: 'compliance-risk',
    scopes: [QoniScopes.DO_ANYTHING_READ, QoniScopes.DO_ANYTHING_MANAGE],
  })

  // 2. Before the patrol: load the current forbidden-claims list and
  //    regulation entries from YOUR controlled policy store (not Memory)
  const policy = await loadCompliancePolicy() // e.g. { version: '2026-08', forbiddenClaims: [...], regulations: [...] }

  // 3. Start this cycle's read-only patrol: compare wording, keep evidence
  const run = await qoni.doAnything.run({
    token: grant.token,
    prompt: `
      Patrol these owned pages: ${ownedPages.join(', ')}.
      Compare wording against the compliance policy below. For every suspected
      item, keep a page screenshot, a verbatim excerpt and the source URL, and
      return items as a JSON array of { page, quote, ruleId, sourceUrl }
      objects. Also check public regulatory announcements for updates and
      record their sources. Read only: never edit materials or take pages
      down. Output an audit data foundation only — make no compliance
      conformity assertion; mark undecidable items as pending human judgment.

      Compliance policy (version ${policy.version}):
      ${JSON.stringify(policy)}
    `,
    capture: { screenshots: true },
  })

  // 4. Consume the run through the event stream: keep the trace,
  //    forward login walls to the compliance officer
  let output = ''
  for await (const event of run.events()) {
    if (event.type === 'progress') appendTrace(event.data)
    if (event.type === 'interaction') notifyComplianceOfficer(event.data) // signed-in material pages → officer
    if (event.type === 'done') output = event.data.output
  }

  // 5. Validate the output contract on the app side: suspected items
  //    missing an evidence source or rule ID are dropped
  const riskItems = parseRiskItems(output).filter((i) => i.sourceUrl && i.ruleId)

  // Archive the risk list and evidence pointers to YOUR audit storage,
  // keyed by list version (not Memory)
  await archiveRiskList(riskItems, policy.version)

  return {
    riskItems, // an audit data foundation — no conformity assertion
    policyVersion: policy.version,
    audit: { auditId: grant.auditId, permissionBoundary: grant.grantedScopes },
  }
}

The output structure is a contract set by the task prompt: here it is an array of { page, quote, ruleId, sourceUrl }, parsed and validated by parseRiskItems on the app side, and any entry missing sourceUrl or ruleId is dropped. The SDK itself returns the generic RunResult (runId, status, output, artifacts, and so on); event type constants for events() are in QoniEventTypes.

Data and memory boundaries

This scenario touches four kinds of data; none of them needs GUMem:

  • Versioned rules: forbidden-claims lists and regulation entries with effective dates — managed by version in your controlled policy store, with every risk item citing a list version.
  • Business state: risk lists, evidence (screenshots, verbatim excerpts, source URLs), and the compliance team's final judgments — archived by list version to your audit storage for regulatory follow-up.
  • Audit records: the delegation and behavior chain formed by grantId and auditId — maintained by GenAuth.
  • User Memory (optional): this scenario neither recalls nor writes back by default; the compliance judgment basis must come entirely from the controlled policy store, and rules from Memory are not accepted.

Failure handling

SituationRecommended handling
A material page requires sign-in and the login state expiresSuspend the task, notify the compliance officer to sign in again, and resume the patrol from the checkpoint.
A regulatory source page is unreachableKeep the failure record and mark related risk items as having incomplete basis; never substitute cached content.
The policy store is unreachable or the list version is missingAbort this cycle and alert; never continue on a cached or previous-cycle list.
Wording is suspicious but rules cannot decide deterministicallyKeep the evidence and mark it as pending human judgment; the Agent must not classify it as violating or compliant on its own.

Production notes

Compliance conclusions should include sources and uncertainty. They do not replace professional legal advice. The Agent outputs an audit data foundation — risk lists, evidence, and sources — not a compliance conformity assertion; whether something violates the rules and how to remediate is the compliance team's final call. The patrol is read-only and never edits or takes down any material; every cycle's risk list should bind to the forbidden-claims list version, and old conclusions are not retroactively re-judged after the list changes.

Next steps