AI Agent for Vehicle Insurance: Quote Generation, Claims Intake, and Policy Questions
Build an AI agent for vehicle insurance that generates coverage quotes, handles claims intake with proper classification, collects required documents, and answers policy questions accurately.
AI Agents in Vehicle Insurance
Vehicle insurance involves complex workflows: generating quotes based on driver profiles and vehicle details, processing claims that range from minor fender-benders to total losses, answering policy questions about coverage limits and deductibles, and routing escalations to the right department. These interactions follow predictable patterns that an AI agent can handle efficiently.
The agent we build will generate personalized insurance quotes, walk customers through claims intake with proper incident classification, collect required documentation, and provide accurate answers about policy coverage.
Driver and Policy Data Models
from dataclasses import dataclass, field
from datetime import date
from enum import Enum
from typing import Optional
class CoverageType(str, Enum):
LIABILITY = "liability"
COLLISION = "collision"
COMPREHENSIVE = "comprehensive"
UNINSURED_MOTORIST = "uninsured_motorist"
PIP = "personal_injury_protection"
class ClaimType(str, Enum):
COLLISION = "collision"
THEFT = "theft"
WEATHER = "weather"
VANDALISM = "vandalism"
GLASS = "glass"
ANIMAL = "animal_strike"
HIT_AND_RUN = "hit_and_run"
@dataclass
class DriverProfile:
driver_id: str
name: str
age: int
years_licensed: int
violations_3yr: int
accidents_5yr: int
credit_tier: str
zip_code: str
@dataclass
class VehicleProfile:
vin: str
year: int
make: str
model: str
trim: str
annual_mileage: int
ownership: str # owned, financed, leased
anti_theft: bool = False
garage_kept: bool = False
@dataclass
class Policy:
policy_number: str
driver: DriverProfile
vehicle: VehicleProfile
coverages: dict[str, dict]
premium_monthly: float
deductible_collision: float
deductible_comprehensive: float
effective_date: str
expiration_date: str
Quote Generation Tool
The quote engine scores risk factors and calculates premiums:
from agents import function_tool
BASE_RATE = 120.00 # Monthly base
@function_tool
def generate_insurance_quote(
driver_age: int,
years_licensed: int,
violations_3yr: int,
accidents_5yr: int,
vehicle_year: int,
vehicle_make: str,
vehicle_model: str,
annual_mileage: int,
zip_code: str,
coverage_level: str = "standard",
) -> str:
"""Generate a vehicle insurance quote based on driver and vehicle details."""
rate = BASE_RATE
# Age factor
if driver_age < 25:
rate *= 1.45
elif driver_age > 65:
rate *= 1.15
# Experience factor
if years_licensed < 3:
rate *= 1.30
# Violations and accidents
rate *= 1.0 + (violations_3yr * 0.15)
rate *= 1.0 + (accidents_5yr * 0.25)
# Vehicle age factor
vehicle_age = 2026 - vehicle_year
if vehicle_age <= 2:
rate *= 1.20
elif vehicle_age > 10:
rate *= 0.85
# Mileage factor
if annual_mileage > 15000:
rate *= 1.10
elif annual_mileage < 7500:
rate *= 0.90
# Coverage levels
coverage_configs = {
"basic": {
"multiplier": 0.70,
"liability": "50/100/50",
"collision_deductible": 1000,
"comprehensive_deductible": 1000,
"uninsured": False,
"pip": False,
},
"standard": {
"multiplier": 1.00,
"liability": "100/300/100",
"collision_deductible": 500,
"comprehensive_deductible": 500,
"uninsured": True,
"pip": False,
},
"premium": {
"multiplier": 1.35,
"liability": "250/500/250",
"collision_deductible": 250,
"comprehensive_deductible": 250,
"uninsured": True,
"pip": True,
},
}
config = coverage_configs.get(coverage_level, coverage_configs["standard"])
monthly = round(rate * config["multiplier"], 2)
annual = round(monthly * 12, 2)
lines = [
f"=== Insurance Quote ===",
f"Driver: Age {driver_age}, {years_licensed} years experience",
f"Vehicle: {vehicle_year} {vehicle_make} {vehicle_model}",
f"Coverage: {coverage_level.title()}\n",
f"Liability: {config['liability']}",
f"Collision Deductible: ${config['collision_deductible']}",
f"Comprehensive Deductible: ${config['comprehensive_deductible']}",
f"Uninsured Motorist: {'Included' if config['uninsured'] else 'Not Included'}",
f"Personal Injury Protection: {'Included' if config['pip'] else 'Not Included'}\n",
f"Monthly Premium: ${monthly:.2f}",
f"Annual Premium: ${annual:.2f}",
f"\nQuote valid for 30 days.",
]
return "\n".join(lines)
Claims Intake Tool
The claims tool classifies the incident and collects the required information:
See AI Voice Agents Handle Real Calls
Book a free demo or calculate how much you can save with AI voice automation.
@function_tool
def file_insurance_claim(
policy_number: str,
incident_date: str,
incident_description: str,
incident_location: str,
police_report_number: Optional[str] = None,
other_party_involved: bool = False,
injuries_reported: bool = False,
) -> str:
"""File a new insurance claim with incident details and classification."""
description_lower = incident_description.lower()
# Auto-classify claim type
if any(w in description_lower for w in ["hit", "crash", "rear-end", "collision"]):
claim_type = ClaimType.COLLISION
elif any(w in description_lower for w in ["stolen", "theft", "broke into"]):
claim_type = ClaimType.THEFT
elif any(w in description_lower for w in ["hail", "flood", "storm", "tree"]):
claim_type = ClaimType.WEATHER
elif any(w in description_lower for w in ["deer", "animal", "bird"]):
claim_type = ClaimType.ANIMAL
elif any(w in description_lower for w in ["windshield", "glass", "window"]):
claim_type = ClaimType.GLASS
elif any(w in description_lower for w in ["vandal", "keyed", "graffiti"]):
claim_type = ClaimType.VANDALISM
else:
claim_type = ClaimType.COLLISION
claim_number = f"CLM-{policy_number[-4:]}-{incident_date.replace('-', '')}"
priority = "HIGH" if injuries_reported else "STANDARD"
required_docs = ["Photos of damage", "Driver's license"]
if police_report_number:
required_docs.append("Police report copy")
if other_party_involved:
required_docs.append("Other driver's insurance info")
required_docs.append("Other driver's contact details")
if claim_type == ClaimType.THEFT:
required_docs.append("Police report (required for theft)")
if injuries_reported:
required_docs.append("Medical records / bills")
lines = [
f"=== Claim Filed ===",
f"Claim Number: {claim_number}",
f"Policy: {policy_number}",
f"Type: {claim_type.value.replace('_', ' ').title()}",
f"Priority: {priority}",
f"Date of Incident: {incident_date}",
f"Location: {incident_location}\n",
f"Required Documents:",
]
for doc in required_docs:
lines.append(f" - {doc}")
if injuries_reported:
lines.append("\nIMPORTANT: This claim involves injuries and has been escalated to a senior adjuster.")
lines.append(f"\nA claims adjuster will contact you within 24 hours.")
return "\n".join(lines)
Policy Lookup Tool
POLICIES = {
"POL-AA-12345": Policy(
policy_number="POL-AA-12345",
driver=DriverProfile("D-001", "Maria Gonzalez", 34, 16, 0, 0, "excellent", "90210"),
vehicle=VehicleProfile("1HGCG5655WA027834", 2024, "Honda", "Accord", "Sport",
12000, "financed", True, True),
coverages={
"liability": {"limit": "100/300/100"},
"collision": {"deductible": 500},
"comprehensive": {"deductible": 250},
"uninsured_motorist": {"limit": "100/300"},
},
premium_monthly=142.50,
deductible_collision=500.0,
deductible_comprehensive=250.0,
effective_date="2026-01-15",
expiration_date="2026-07-15",
),
}
@function_tool
def lookup_policy(policy_number: str) -> str:
"""Look up policy details including coverages, deductibles, and premium."""
policy = POLICIES.get(policy_number.upper())
if not policy:
return f"Policy {policy_number} not found. Please verify the number."
lines = [
f"=== Policy Details ===",
f"Policy: {policy.policy_number}",
f"Insured: {policy.driver.name}",
f"Vehicle: {policy.vehicle.year} {policy.vehicle.make} "
f"{policy.vehicle.model} {policy.vehicle.trim}",
f"VIN: {policy.vehicle.vin}",
f"Period: {policy.effective_date} to {policy.expiration_date}\n",
f"Coverages:",
]
for cov, details in policy.coverages.items():
name = cov.replace("_", " ").title()
info = " | ".join(f"{k}: {v}" for k, v in details.items())
lines.append(f" {name}: {info}")
lines.append(f"\nMonthly Premium: ${policy.premium_monthly:.2f}")
lines.append(f"Annual Premium: ${policy.premium_monthly * 12:.2f}")
return "\n".join(lines)
Assembling the Insurance Agent
from agents import Agent, Runner
insurance_agent = Agent(
name="Insurance Advisor",
instructions="""You are a vehicle insurance assistant. Help customers:
1. Generate insurance quotes based on their driver profile and vehicle
2. File claims with proper classification and document requirements
3. Look up policy details and explain coverages
Always explain coverage terms in plain language. For claims involving injuries,
emphasize the importance of seeking medical attention first.""",
tools=[generate_insurance_quote, file_insurance_claim, lookup_policy],
)
result = Runner.run_sync(
insurance_agent,
"I hit a deer on Highway 101 last night. My policy is POL-AA-12345. No injuries but significant front-end damage."
)
print(result.final_output)
FAQ
How do I make the quote engine more accurate?
Production insurance rating engines use actuarial tables, territory codes (based on zip code loss history), vehicle symbol ratings (from ISO), and proprietary loss models. Integrate with rating APIs from providers like Guidewire or Duck Creek. The agent collects inputs and calls the rating engine rather than computing premiums directly.
Can the agent handle policy changes like adding a driver or changing vehicles?
Yes. Add endorsement tools that modify an existing policy. Each endorsement type (add driver, change vehicle, adjust coverage) requires specific inputs. The tool should calculate the pro-rated premium adjustment and present it to the customer for approval before applying the change.
How should I handle sensitive personal information during claims intake?
Never store sensitive data like Social Security numbers in conversation logs. Use the agent to collect non-sensitive claim details, then redirect the customer to a secure portal for document uploads and sensitive information. Implement PII detection in the agent's response pipeline to redact any accidentally shared sensitive data.
#VehicleInsurance #ClaimsProcessing #QuoteGeneration #InsurTech #Python #AgenticAI #LearnAI #AIEngineering
CallSphere Team
Expert insights on AI voice agents and customer communication automation.
Try CallSphere AI Voice Agents
See how AI voice agents work for your industry. Live demo available -- no signup required.