How to Build a claims processing Agent Using CrewAI in Python for retail banking
A claims processing agent for retail banking takes an incoming customer claim, gathers the required evidence, checks policy and account context, routes the case through the right internal steps, and produces a decision-ready summary for a human reviewer. It matters because claims are high-volume, regulated workflows where speed, consistency, auditability, and data handling rules directly affect customer experience and operational risk.
Architecture
- •
Intake layer
- •Receives claim details from web forms, CRM cases, email parsing, or branch ops.
- •Normalizes fields like customer ID, claim type, amount, date of incident, and supporting documents.
- •
Verification agent
- •Checks whether required documents are present.
- •Validates identity signals, account ownership, transaction references, and claim completeness.
- •
Policy reasoning agent
- •Maps the claim against bank policy rules.
- •Flags exceptions such as chargeback eligibility windows, fraud indicators, duplicate claims, or missing disclosures.
- •
Decision summarizer
- •Produces a concise recommendation for a human case handler.
- •Includes rationale, evidence used, and unresolved questions.
- •
Audit and compliance layer
- •Logs every tool call, prompt input/output, and final recommendation.
- •Preserves traceability for internal audit, dispute handling, and regulator review.
- •
Storage and routing
- •Stores outputs in a case management system.
- •Routes low-risk approvals automatically and escalates ambiguous or high-value cases to humans.
Implementation
- •Install CrewAI and define your banking workflow
Use CrewAI’s Agent, Task, Crew, and Process classes. Keep the agent roles narrow; claims processing is not one big generalist prompt.
pip install crewai
from crewai import Agent, Task, Crew, Process
claims_verifier = Agent(
role="Claims Verification Specialist",
goal="Verify that a retail banking claim is complete and supported by required evidence.",
backstory=(
"You work in retail banking operations. You check claims for completeness, "
"missing documentation, identity mismatch risks, and policy prerequisites."
),
verbose=True,
allow_delegation=False,
)
policy_analyst = Agent(
role="Bank Claims Policy Analyst",
goal="Assess whether the claim fits bank policy and identify exceptions.",
backstory=(
"You interpret retail banking claims policies with strict attention to "
"compliance requirements, time windows, fraud flags, and auditability."
),
verbose=True,
allow_delegation=False,
)
case_summarizer = Agent(
role="Claims Case Summarizer",
goal="Produce a decision-ready summary for a human reviewer.",
backstory=(
"You write concise operational summaries for bank case managers. "
"You never invent facts and always cite the evidence provided."
),
verbose=True,
allow_delegation=False,
)
- •Create tasks that reflect the actual bank workflow
Each task should produce structured output. In production you want predictable artifacts that can be stored in your case system.
verify_task = Task(
description=(
"Review this retail banking claim packet for completeness. "
"Check whether the customer ID matches the account reference, whether "
"supporting documents are present, and whether any mandatory fields are missing.\n\n"
"Claim packet:\n{claim_packet}"
),
expected_output=(
"A structured verification report with: completeness status, missing items, "
"identity concerns if any, and a short evidence list."
),
agent=claims_verifier,
)
policy_task = Task(
description=(
"Assess this verified claim against bank policy. Determine if it should be "
"approved for human review escalation or rejected pending more evidence.\n\n"
"Verification report:\n{verification_report}\n\n"
"Policy notes:\n{policy_notes}"
),
expected_output=(
"A policy assessment with: eligibility decision, rule references from the notes provided, "
"risk flags, and escalation recommendation."
),
agent=policy_analyst,
)
summary_task = Task(
description=(
"Write a concise case summary for operations. Include what was checked, what was found, "
"the recommended next action, and any compliance concerns.\n\n"
"Verification report:\n{verification_report}\n\n"
"Policy assessment:\n{policy_assessment}"
),
expected_output="A final decision-ready summary suitable for a bank case management record.",
agent=case_summarizer,
)
- •Assemble the crew with sequential process execution
For claims processing you usually want deterministic ordering: verify first, then assess policy, then summarize. Sequential execution is easier to audit than parallel speculation.
claims_crew = Crew(
agents=[claims_verifier, policy_analyst, case_summarizer],
tasks=[verify_task, policy_task, summary_task],
process=Process.sequential,
verbose=True,
)
if __name__ == "__main__":
result = claims_crew.kickoff(
inputs={
"claim_packet": {
"customer_id": "CUST-10291",
"account_ref": "ACC-77821",
"claim_type": "unauthorized_card_transaction",
"amount": 245.80,
"incident_date": "2026-03-12",
"documents": ["id_scan", "transaction_statement", "signed_affidavit"],
},
"policy_notes": (
"- Claims under $500 require completed affidavit.\n"
"- Card-not-present disputes must be filed within 60 days.\n"
"- Escalate if identity mismatch or duplicate claim is detected.\n"
"- Do not approve if required documents are missing."
),
# These keys map into downstream task context in order.
# In production you would likely transform outputs between tasks explicitly.
"verification_report": "",
"policy_assessment": "",
}
)
print(result)
- •Wrap it with explicit validation before sending to core systems
Do not let raw model output write directly into your case platform. Validate schema first.
from pydantic import BaseModel
class ClaimDecision(BaseModel):
status: str
risk_level: str
next_action: str
audit_notes: str
def persist_decision(raw_text: str) -> ClaimDecision:
# Replace this with strict parsing in production.
return ClaimDecision(
status="needs_human_review",
risk_level="medium",
next_action="route_to_case_manager",
audit_notes=raw_text[:500],
)
Production Considerations
- •
Data residency
- •Keep customer data in-region if your banking policy requires it.
- •If you use hosted model endpoints or external tools via CrewAI integrations later on, verify where prompts and artifacts are processed and stored.
- •
Audit trails
- •Log task inputs/outputs with timestamps and immutable case IDs.
- •Store the exact version of prompts, policy notes, model name, and code revision used for each decision.
- •
Guardrails
- •Add schema validation before any downstream action.
- •Block auto-resolution on high-value claims, fraud indicators, sanctions hits,, or identity mismatches; force human review instead.
- •
Monitoring
- •Track false approvals, false rejections,, escalation rate,, average handling time,, and document-missing frequency.
- •Alert when outputs drift from expected formats or when the model starts over-escalating low-risk cases.
Common Pitfalls
- •
Using one generic agent for everything
- •This makes prompts bloated and decisions inconsistent.
- •Split verification,, policy reasoning,, and summarization into separate agents with tight scopes.
- •
Letting the model decide without hard rules
- •Retail banking claims have fixed thresholds,, time windows,, and mandatory disclosures.
- •Encode those rules outside the prompt where possible,, then use the agent to explain or classify against them.
- •
Skipping structured output validation
- •Free-form text is hard to route into a case management system.
- •Parse into a Pydantic model or JSON schema before persistence,, then reject anything malformed.
- •
Ignoring compliance metadata
- •If you cannot prove who processed what,, when,, using which policy version,, you will struggle in audits.
- •Persist prompt versions,, task outputs,, source documents,, region of processing,, and reviewer overrides alongside each claim record.
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