KYC Customer Onboarding

Agent-as-orchestrator pattern. Unlike the matching-first templates, this one starts with an AI agent that coordinates multiple verification workflows, synthesizes results across them, and escalates when signals conflict.

What Gets Automated

Identity verification, sanctions screening, adverse media scanning, and risk scoring: run as separate sub-workflows coordinated by an orchestrator agent. The agent synthesizes pass/fail/flag signals across all checks, identifies conflicts, and makes an onboarding recommendation.

What Humans Still Own

Final approval on flagged or conflicted cases. Enhanced due diligence investigations. Policy exception decisions for high-profile applicants.

Pipeline

flowchart TD A[Input: Applicant Data] --> B[Orchestrator Agent] B --> C[Workflow Tool: Identity Verification] B --> D[Workflow Tool: Sanctions Screening] B --> E[Workflow Tool: Adverse Media Scan] C -->|pass / fail / flag| F[Agent Synthesizes Results] D -->|pass / fail / flag| F E -->|pass / fail / flag| F F -->|Clear recommendation| G[Human Approval] F -->|Conflict detected| H{Agent Investigates} F -->|Hard fail| G H -->|Resolved| G H -->|Unresolvable| K[pause_for_human: Compliance Review] K -->|Guidance supplied| G K -->|EDD required| N[Workflow Tool: Enhanced Due Diligence] N --> K G -->|Approved| L[Provision Account] G -->|Rejected| M[Run Ends; Decision Recorded] L --> O[Custom Table: Onboarding Log] style B fill:#4ade80,color:#09090b,stroke:none style K fill:#60a5fa,color:#09090b,stroke:none style C fill:#e8a84c,color:#09090b,stroke:none style D fill:#e8a84c,color:#09090b,stroke:none style E fill:#e8a84c,color:#09090b,stroke:none

This template demonstrates Pattern C: Agent as Orchestrator. The agent coordinates multiple sub-workflows through declared workflow tools and synthesizes their results to make a decision.

## Workflow Definition
json
{
  "name": "kyc_customer_onboarding",
  "definition": {
    "actions": [
      {
        "type": "loop",
        "properties": {
          "mode": "react",
          "objective": "Start by reading the current applicant with the supplied tool. Run identity verification, sanctions screening, and adverse media screening with the returned applicant facts. Synthesize the results into a risk recommendation. Pause for compliance review when results conflict or confidence is below 0.8. Do not provision an account during this step.",
          "tools": [
            { "type": "action", "name": "read_current_applicant" },
            { "type": "workflow", "id": "wfl-identity-verification-001" },
            { "type": "workflow", "id": "wfl-sanctions-screening-002" },
            { "type": "workflow", "id": "wfl-adverse-media-scan-003" }
          ],
          "max_iterations": 15,
          "timeout_ms": 300000,
          "on_stuck": {
            "iterations": 4,
            "action": "escalate"
          },
          "result_key": "onboarding_decision"
        }
      },
      {
        "type": "PbotApproval",
        "properties": {
          "comment": "Review the KYC recommendation before account provisioning.",
          "request_payload": {
            "applicant_id": "@input.applicant_id",
            "recommendation": "@onboarding_decision.answer",
            "confidence": "@onboarding_decision.confidence"
          }
        }
      },
      {
        "type": "loop",
        "filter": {
          "condition": {
            "equal": ["@__approved", true]
          }
        },
        "properties": {
          "mode": "react",
          "objective": "The compliance reviewer approved account provisioning. Read the current applicant with the supplied tool. Create the account, assign the tier specified in the reviewer guidance, trigger the welcome sequence, and complete with the receipts returned by those tools.",
          "tools": [
            { "type": "action", "name": "read_current_applicant" },
            { "type": "action", "name": "create_customer_account" },
            { "type": "action", "name": "assign_account_tier" },
            { "type": "workflow", "id": "wfl-welcome-sequence-004" }
          ],
          "max_iterations": 5,
          "result_key": "provisioning_result"
        }
      },
      {
        "type": "gmail_send",
        "filter": {
          "condition": {
            "equal": ["@__approved", true]
          }
        },
        "properties": {
          "__oauth_account__": "[email protected]",
          "to": "@input.applicant_email",
          "subject": "Welcome: your account is ready",
          "body": "Your account has been verified and provisioned."
        }
      },
      {
        "type": "custom-table",
        "properties": {
          "table": "onboarding_log",
          "operation": "write",
          "keys": ["applicant_id"],
          "values": ["@input.applicant_id"],
          "fields": {
            "recommendation": "@onboarding_decision.answer",
            "confidence": "@onboarding_decision.confidence",
            "run_id": "@__run_id",
            "completed_at": "@now"
          }
        }
      }
    ]
  }
}

Required Workflows

These workflows are declared as typed workflow tools and triggered by the orchestrator agent as needed:

Workflow Purpose
identity_verification Document verification, liveness check, PII validation
sanctions_screening OFAC, EU, UN sanctions list matching
adverse_media_scan News and media screening for negative coverage
enhanced_due_diligence Deep investigation for flagged applicants

Required Registered Actions

Action Kind Purpose
create_customer_account http Provision account in your system
assign_account_tier http Set account tier based on risk assessment
read_current_applicant custom-table Read the applicant selected by the workflow input

Bind read_current_applicant to your applicant table with operation: "read" and where: { "applicant_id": "@input.applicant_id" }. The model starts with a fixed read tool instead of relying on workflow-template interpolation inside the ReAct objective.

Customization Notes

Confidence guidance. The 0.8 value in the objective tells the agent when to escalate. Keep consequential actions behind explicit approval and tool boundaries instead of treating model confidence as a control by itself.

Timeout. 300 seconds (5 minutes) covers the round-trip time for multiple sub-workflow executions. Extend if your verification providers have slow response times.

Iterations. 15 iterations is higher than other templates because the orchestrator needs to run multiple workflows, store intermediate results, synthesize, and potentially escalate. Don't reduce below 10.

Sub-workflows. Each verification workflow (identity_verification, sanctions_screening, etc.) must be created separately in Hyphen before running this template. They can be simple HTTP-action workflows that call your verification providers.