How to Build a claims processing Agent Using AutoGen in Python for wealth management
A claims processing agent for wealth management takes incoming client claims, extracts the relevant facts, checks them against policy and account data, routes edge cases to a human reviewer, and produces an auditable decision trail. It matters because wealth firms deal with regulated workflows, sensitive client data, and strict service-level expectations; a bad automation pattern here becomes a compliance problem fast.
Architecture
- •
Client intake layer
- •Receives claim emails, PDFs, portal submissions, or CRM tickets.
- •Normalizes the payload into a structured case object.
- •
LLM orchestration layer
- •Uses
autogen.AssistantAgentfor reasoning andautogen.UserProxyAgentfor tool execution. - •Keeps the agent loop bounded and deterministic.
- •Uses
- •
Policy and eligibility tools
- •Fetches account status, product rules, KYC flags, jurisdiction constraints, and claim limits.
- •Exposes these as Python functions registered with AutoGen.
- •
Audit logging layer
- •Stores prompts, tool calls, decisions, timestamps, and reviewer overrides.
- •Needed for internal audit and regulator review.
- •
Human review gate
- •Escalates ambiguous or high-value claims.
- •Prevents the agent from auto-adjudicating cases that need compliance sign-off.
- •
Data controls
- •Enforces data residency, redaction, and retention policies before any model call.
- •Critical for wealth management because client PII and portfolio data are highly sensitive.
Implementation
1) Set up AutoGen agents and a controlled tool surface
Use a small set of tools. Don’t give the model direct database access; wrap every lookup in a function you can log and validate.
from typing import Dict, Any
import json
import autogen
llm_config = {
"config_list": [
{
"model": "gpt-4o-mini",
"api_key": "YOUR_OPENAI_API_KEY",
}
],
"temperature": 0,
}
def get_claim_policy(claim_id: str) -> Dict[str, Any]:
# Replace with real policy service lookup
return {
"claim_id": claim_id,
"max_auto_approve_amount": 2500,
"requires_human_review_over": 2500,
"allowed_jurisdictions": ["US", "CA"],
}
def get_account_context(account_id: str) -> Dict[str, Any]:
# Replace with real CRM / core banking lookup
return {
"account_id": account_id,
"kyc_status": "verified",
"jurisdiction": "US",
"risk_rating": "medium",
"data_residency": "us-east-1",
}
assistant = autogen.AssistantAgent(
name="claims_assistant",
llm_config=llm_config,
)
user_proxy = autogen.UserProxyAgent(
name="claims_executor",
human_input_mode="NEVER",
code_execution_config=False,
)
2) Register tools as callable functions
AutoGen’s function registration pattern lets the assistant call your Python functions through the user proxy. Keep the schema tight so the model can’t wander outside the workflow.
@user_proxy.register_for_execution()
@assistant.register_for_llm(description="Fetch claim policy rules by claim ID.")
def fetch_claim_policy(claim_id: str) -> str:
return json.dumps(get_claim_policy(claim_id))
@user_proxy.register_for_execution()
@assistant.register_for_llm(description="Fetch account context by account ID.")
def fetch_account_context(account_id: str) -> str:
return json.dumps(get_account_context(account_id))
3) Run a bounded adjudication conversation
The agent should classify the claim, pull only the required context, then produce either an approval recommendation or an escalation recommendation. Use explicit instructions so it does not invent missing facts.
system_prompt = """
You are a claims processing agent for a wealth management firm.
Rules:
- Use only provided tools and supplied case data.
- Never approve claims above policy thresholds.
- Escalate if jurisdiction is unsupported, KYC is not verified, or data is incomplete.
- Produce an audit-friendly response with: decision, reason_code, required_follow_up.
"""
assistant.update_system_message(system_prompt)
case_payload = """
Claim case:
- claim_id: CLM-10491
- account_id: ACC-88210
- amount_usd: 1800
- claim_type: fee_reimbursement
- description: Client disputes advisory fee charged after service outage.
"""
result = user_proxy.initiate_chat(
assistant,
message=case_payload + "\nFirst fetch policy and account context before making a recommendation.",
)
print(result.summary)
4) Add an audit record around every decision
Wealth management teams need traceability. Persist inputs, tool outputs, model output, and final human action in one immutable record.
from datetime import datetime
def write_audit_record(case_id: str, input_text: str, decision_text: str) -> None:
record = {
"case_id": case_id,
"timestamp_utc": datetime.utcnow().isoformat(),
"input_text": input_text,
"decision_text": decision_text,
"model_name": llm_config["config_list"][0]["model"],
}
print(json.dumps(record)) # Replace with append-only storage
write_audit_record(
case_id="CLM-10491",
input_text=case_payload,
decision_text=str(result.summary),
)
Production Considerations
- •
Deploy in-region
- •Keep model inference and storage in approved regions that match client data residency requirements.
- •If your firm services EU clients separately from US clients, split workloads accordingly.
- •
Log everything needed for audit
- •Persist prompt version, tool inputs/outputs, final recommendation, reviewer override, and timestamps.
- •Make logs immutable or append-only.
- •
Add hard guardrails
- •Block auto-resolution above threshold amounts.
- •Force escalation on sanctions hits, KYC failures, suspicious activity indicators, or unsupported jurisdictions.
- •
Monitor drift and failure modes
- •Track approval rate by product line, escalation rate by jurisdiction, tool error rate, and human override rate.
- •A sudden drop in escalations usually means your prompt or routing logic broke.
Common Pitfalls
- •
Letting the model infer missing financial facts
- •Fix it by requiring explicit tool lookups for policy thresholds, jurisdiction checks, KYC state, and account status.
- •If the tool does not return it, treat it as unknown and escalate.
- •
Skipping auditability
- •Fix it by storing every intermediate step: case payloads, function calls, outputs from
register_for_execution, and final recommendations. - •In wealth management this is non-negotiable during internal review or regulatory inquiry.
- •Fix it by storing every intermediate step: case payloads, function calls, outputs from
- •
Using one global workflow for all clients
- •Fix it by partitioning flows by region, entity type, product type, and risk tier.
- •A private wealth claim in Singapore should not follow the same residency path as a retail brokerage reimbursement in the US.
If you keep the AutoGen surface area small and wrap every business rule in deterministic Python functions, you get an agent that is useful without becoming uncontrollable. That is the difference between a demo bot and something you can put near client money.
Keep learning
- •The complete AI Agents Roadmap — my full 8-step breakdown
- •Free: The AI Agent Starter Kit — PDF checklist + starter code
- •Work with me — I build AI for banks and insurance companies
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