How to Build a claims processing Agent Using AutoGen in TypeScript for fintech

By Cyprian AaronsUpdated 2026-04-21
claims-processingautogentypescriptfintech

A claims processing agent in fintech takes an incoming claim, extracts the relevant facts, checks policy or transaction rules, asks for missing evidence, and produces a decision package for a human reviewer or downstream system. It matters because claims are high-volume, document-heavy, and audit-sensitive; if you automate them badly, you create compliance risk, inconsistent outcomes, and expensive manual rework.

Architecture

  • Claim intake layer

    • Receives email, API payloads, uploaded PDFs, or OCR text.
    • Normalizes the input into a structured claim case.
  • AutoGen orchestrator

    • Coordinates specialized agents.
    • Owns the conversation flow and tool calls.
  • Claims analyst agent

    • Extracts entities like claimant name, policy ID, incident date, amount requested.
    • Produces a structured assessment.
  • Policy/compliance tool layer

    • Checks eligibility rules, limits, exclusions, KYC flags, and jurisdiction constraints.
    • Keeps regulated logic outside the LLM.
  • Human review gate

    • Routes low-confidence or high-risk claims to an adjuster.
    • Captures approval/rejection rationale for audit.
  • Audit and persistence store

    • Stores prompts, tool outputs, model responses, and final decisions.
    • Supports traceability for regulators and internal risk teams.

Implementation

1) Install AutoGen and define your claim schema

For TypeScript projects, use the AutoGen agentchat package and keep your claim state typed. In fintech systems, typed state is not optional; it is how you prevent free-form model output from leaking into decision logic.

npm install @autogen-agentchat/agents @autogen-agentchat/openai
export type ClaimCase = {
  claimId: string;
  customerId: string;
  policyId: string;
  jurisdiction: string;
  amountRequested: number;
  incidentDate: string;
  description: string;
  attachments: string[];
};

export type ClaimDecision = {
  status: "approve" | "reject" | "needs_review";
  reason: string;
  missingFields: string[];
};

2) Create an AutoGen assistant with strict instructions

Use AssistantAgent as the claims analyst. Keep the system message narrow: extract facts, identify missing data, and never make final payout decisions without tools.

import { AssistantAgent } from "@autogen-agentchat/agents";
import { OpenAIChatCompletionClient } from "@autogen-agentchat/openai";

const modelClient = new OpenAIChatCompletionClient({
  model: "gpt-4o-mini",
});

const claimsAnalyst = new AssistantAgent({
  name: "claims_analyst",
  modelClient,
  systemMessage: `
You are a claims processing analyst for a fintech platform.
Extract claim facts from the input.
Do not invent missing data.
If policy checks are required, request them through tools.
Return concise findings with explicit uncertainty.
`,
});

3) Add deterministic policy checks as tools

Do not let the model decide compliance-sensitive rules from memory. Wrap those checks in code and expose them as callable functions. This keeps residency rules, limits checks, and sanction screening outside prompt drift.

type PolicyCheckResult = {
  eligible: boolean;
  reason: string;
};

async function checkPolicyEligibility(claim: ClaimCase): Promise<PolicyCheckResult> {
  if (claim.jurisdiction !== "GB") {
    return { eligible: false, reason: "Data residency requires GB-only processing for this case." };
    }
  
  if (claim.amountRequested > 5000) {
    return { eligible: false, reason: "Amount exceeds automated approval threshold." };
  }

  return { eligible: true, reason: "Within automated processing rules." };
}

If you want to call tools through AutoGen’s conversation loop instead of manually invoking them in application code, register them in your orchestration layer and let the agent request them when needed. The important part is that the rule itself stays deterministic.

4) Orchestrate the workflow with a manager agent

For multi-step flows in AutoGen TypeScript, use RoundRobinGroupChat when you want one agent to draft analysis and another to validate it. This pattern works well for claims because it separates extraction from compliance review.

import {
  RoundRobinGroupChat,
} from "@autogen-agentchat/agents";

async function processClaim(claim: ClaimCase): Promise<ClaimDecision> {
  const policy = await checkPolicyEligibility(claim);

    if (!policy.eligible) {
    return {
      status: "needs_review",
      reason: policy.reason,
      missingFields: [],
    };
  }

    const result = await claimsAnalyst.run({
    task:
      `Analyze this claim:\n${JSON.stringify(claim)}\n` +
      `Return whether it should be approved or sent to review.`,
    });

    const text = result.messages.at(-1)?.content?.toString() ?? "";

    return {
      status: text.toLowerCase().includes("approve") ? "approve" : "needs_review",
      reason: text.slice(0, 300),
      missingFields: [],
    };
}

const demoClaim: ClaimCase = {
  claimId: "CLM-10021",
  customerId: "CUST-7781",
   policyId: "POL-4455",
   jurisdiction: "GB",
   amountRequested: 1200,
   incidentDate: "2026-03-18",
   description: "Unauthorized card-not-present transaction reported by customer.",
   attachments: ["statement.pdf", "id-verification.png"],
};

processClaim(demoClaim).then(console.log);

The real production pattern is slightly richer than this example:

  • Intake service validates payloads.
  • OCR/document parser extracts text first.
  • Policy engine runs before any LLM call that could influence approval.
  • AutoGen handles narrative reasoning and exception handling.
  • A human reviewer signs off on anything ambiguous or above threshold.

Production Considerations

  • Keep regulated logic out of prompts

    • Eligibility thresholds, sanctions screening, AML triggers, chargeback windows, and residency constraints should live in code or dedicated services.
    • The model can summarize; it should not be your source of truth.
  • Log everything needed for audit

    • Persist raw inputs, normalized claim state, tool results, model outputs, timestamps, and final disposition.
    • In fintech audits you need replayability more than clever prompts.
  • Enforce data residency and retention controls

    • Route EU/UK claims to region-specific infrastructure.

Keep learning

By Cyprian Aarons, AI Consultant at Topiax.

Want the complete 8-step roadmap?

Grab the free AI Agent Starter Kit — architecture templates, compliance checklists, and a 7-email deep-dive course.

Get the Starter Kit

Related Guides