Skip to main content

What This Example Shows

  • How to map a pandas DataFrame of insurance claims into the batch payload shape
  • How to call /v1/agent/batch/completions with thousands of independent rows
  • A structured-output prompt that returns coverage match, fraud signal, and a payout estimate
  • How to write the results back to the original DataFrame in one merge
  • A real cost comparison against a human claims-adjuster floor
This tutorial uses /v1/agent/batch/completions — the highest-throughput endpoint on the platform. It is premium-only and accepts up to 50 tasks per request, so larger workloads are submitted in chunks. For sustained batches above 1,000 rows or production SLAs, upgrade to Pro, Ultra, or Premium at https://swarms.world/platform/account for access and the rate-limit headroom you need.

Why This Matters

Claims triage is the single largest cost center in P&C insurance ops. Every incoming claim has to be read, classified, checked against the policy, scored for fraud, and routed — and 80% of them are routine. Adjusters spend most of their day on the boring 80% and run out of bandwidth for the complex 20% that actually need a human. The job is to take that 80% off the floor: a single specialized agent, called once per claim, ten thousand at a time, with structured output your downstream systems can act on directly. The batch endpoint is the perfect fit — every claim is independent, compute per row is small, and the work parallelizes trivially.

Step 1: Setup

Step 2: Define the Triage Agent

One agent, one job: read a claim, return structured JSON. The prompt is built around the exact downstream schema your claims system needs.

Step 3: Load the Claims CSV

A realistic claims feed lives in a database or warehouse — this example uses a CSV but the shape is identical.
The batch endpoint executes each request’s tasks in parallel server-side, up to 50 tasks per request. You do not need to thread the requests on your end — submit each chunk and wait.

Step 4: Submit Claims in Chunks

Submit in chunks of 50 — the maximum batch size the endpoint accepts per request — which also makes retries cheap if a single chunk fails.

Step 5: Parse and Merge Results Back

The agent returns strict JSON in its output — parse it, expand into columns, and join back on claim_id.
The result is a single CSV your claims system can ingest directly. Auto-approve rows close the loop without a human ever opening them. Adjuster-review rows land in the queue with structured context already attached. SIU referrals carry the fraud indicators the investigator needs on day one.

Real Cost vs. Human Adjuster Floor

You are not eliminating the adjuster floor — you are taking the routine 80% off their plate so the remaining 20% gets the attention it actually needs. That is a 100x cost reduction on the boring half of the work and faster cycle times on the half that matters.

Next Steps