By Sagar Shankaran, Founder of CallSphere
Learn how to build an AI agent for car dealerships that searches vehicle inventory, schedules test drives, and generates finance quotes using tool-calling patterns and structured vehicle databases.
Key takeaways
Car dealerships handle thousands of customer inquiries every week. Shoppers want to know if a specific model is in stock, whether they can test drive it Saturday afternoon, and what their monthly payment would be on a 60-month loan. Traditionally these questions get routed to salespeople who manually search DMS (Dealer Management System) databases, check calendars, and run finance calculators.
An AI agent can handle the entire pre-sales workflow: searching inventory by make, model, year, color, and price range; booking test drive appointments against availability; and generating personalized finance estimates based on credit tier and down payment. The agent connects to real dealership data through tools and returns accurate, structured answers in seconds.
A dealership inventory system needs to capture vehicle details, pricing, and availability status. Here is a practical schema:
flowchart LR
INPUT(["User intent"])
PARSE["Parse plus<br/>classify"]
PLAN["Plan and tool<br/>selection"]
AGENT["Agent loop<br/>LLM plus tools"]
GUARD{"Guardrails<br/>and policy"}
EXEC["Execute and<br/>verify result"]
OBS[("Trace and metrics")]
OUT(["Outcome plus<br/>next action"])
INPUT --> PARSE --> PLAN --> AGENT --> GUARD
GUARD -->|Pass| EXEC --> OUT
GUARD -->|Fail| AGENT
AGENT --> OBS
style AGENT fill:#4f46e5,stroke:#4338ca,color:#fff
style GUARD fill:#f59e0b,stroke:#d97706,color:#1f2937
style OBS fill:#ede9fe,stroke:#7c3aed,color:#1e1b4b
style OUT fill:#059669,stroke:#047857,color:#fff
from dataclasses import dataclass
from enum import Enum
from typing import Optional
class VehicleStatus(str, Enum):
AVAILABLE = "available"
ON_HOLD = "on_hold"
SOLD = "sold"
IN_TRANSIT = "in_transit"
@dataclass
class Vehicle:
stock_number: str
vin: str
year: int
make: str
model: str
trim: str
exterior_color: str
interior_color: str
mileage: int
msrp: float
selling_price: float
status: VehicleStatus
features: list[str]
image_url: Optional[str] = None
In production, this data lives in the DMS. For our agent, we expose it through search tools that query the database with filters.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent for auto shop in your browser — 60 seconds, no signup.
The search tool accepts flexible criteria and returns matching vehicles ranked by relevance:
from agents import Agent, Runner, function_tool
from typing import Optional
VEHICLE_INVENTORY = [
Vehicle("STK-1001", "1HGCG5655WA123456", 2026, "Honda", "Accord",
"Sport", "Platinum White", "Black", 12, 33500.00, 32200.00,
VehicleStatus.AVAILABLE, ["Sunroof", "Heated Seats", "CarPlay"]),
Vehicle("STK-1002", "5YJSA1E26MF123789", 2026, "Tesla", "Model 3",
"Long Range", "Midnight Silver", "White", 0, 42990.00, 42990.00,
VehicleStatus.AVAILABLE, ["Autopilot", "Premium Audio"]),
Vehicle("STK-1003", "2T1BURHE0KC987654", 2025, "Toyota", "Camry",
"XSE", "Celestial Silver", "Red", 8500, 31500.00, 29800.00,
VehicleStatus.AVAILABLE, ["TRD Package", "Panoramic Roof"]),
]
@function_tool
def search_inventory(
make: Optional[str] = None,
model: Optional[str] = None,
min_year: Optional[int] = None,
max_price: Optional[float] = None,
color: Optional[str] = None,
) -> str:
"""Search dealership vehicle inventory by make, model, year, price, or color."""
results = [v for v in VEHICLE_INVENTORY if v.status == VehicleStatus.AVAILABLE]
if make:
results = [v for v in results if v.make.lower() == make.lower()]
if model:
results = [v for v in results if v.model.lower() == model.lower()]
if min_year:
results = [v for v in results if v.year >= min_year]
if max_price:
results = [v for v in results if v.selling_price <= max_price]
if color:
results = [v for v in results
if color.lower() in v.exterior_color.lower()]
if not results:
return "No vehicles found matching your criteria."
lines = []
for v in results:
lines.append(
f"{v.year} {v.make} {v.model} {v.trim} | {v.exterior_color} | "
f"{v.mileage} mi | ${v.selling_price:,.0f} | Stock: {v.stock_number}"
)
return "\n".join(lines)
The scheduling tool checks availability windows and books appointments:
from datetime import datetime, timedelta
BOOKED_SLOTS: dict[str, list[str]] = {}
@function_tool
def schedule_test_drive(
stock_number: str,
customer_name: str,
preferred_date: str,
preferred_time: str,
) -> str:
"""Schedule a test drive for a specific vehicle."""
try:
dt = datetime.strptime(
f"{preferred_date} {preferred_time}", "%Y-%m-%d %H:%M"
)
except ValueError:
return "Invalid date/time format. Use YYYY-MM-DD and HH:MM."
if dt < datetime.now():
return "Cannot book a test drive in the past."
if dt.weekday() == 6:
return "Dealership is closed on Sundays."
slot_key = dt.strftime("%Y-%m-%d %H:%M")
day_key = dt.strftime("%Y-%m-%d")
if day_key in BOOKED_SLOTS and slot_key in BOOKED_SLOTS[day_key]:
return f"The {slot_key} slot is already booked. Try 30 minutes later."
BOOKED_SLOTS.setdefault(day_key, []).append(slot_key)
return (
f"Test drive confirmed for {customer_name}: "
f"{stock_number} on {slot_key}. Please bring a valid driver's license."
)
The finance calculator computes monthly payments using standard amortization:
@function_tool
def calculate_finance_quote(
vehicle_price: float,
down_payment: float,
term_months: int = 60,
annual_rate: float = 6.5,
) -> str:
"""Calculate monthly payment for a vehicle purchase."""
loan_amount = vehicle_price - down_payment
if loan_amount <= 0:
return "Down payment covers the full vehicle price. No financing needed."
monthly_rate = (annual_rate / 100) / 12
payment = loan_amount * (
monthly_rate * (1 + monthly_rate) ** term_months
) / ((1 + monthly_rate) ** term_months - 1)
return (
f"Vehicle Price: ${vehicle_price:,.0f}\n"
f"Down Payment: ${down_payment:,.0f}\n"
f"Loan Amount: ${loan_amount:,.0f}\n"
f"Term: {term_months} months at {annual_rate}% APR\n"
f"Monthly Payment: ${payment:,.2f}"
)
dealership_agent = Agent(
name="Dealership Assistant",
instructions="""You are a helpful car dealership assistant. Help customers:
1. Search for vehicles by make, model, year, price, or color
2. Schedule test drives for available vehicles
3. Calculate finance quotes with different down payments and terms
Always be friendly and transparent about pricing.""",
tools=[search_inventory, schedule_test_drive, calculate_finance_quote],
)
result = Runner.run_sync(
dealership_agent,
"I'm looking for a white sedan under $35,000. Can I test drive one Saturday at 2pm?"
)
print(result.final_output)
The agent will search inventory, find the Honda Accord, and offer to book the test drive in a single conversational turn.
Still reading? Stop comparing — try CallSphere live.
See the auto shop AI agent handle a real call — complete, industry-specific, and live in your browser. No signup.
Replace the in-memory inventory list with API calls to your DMS provider. Most modern DMS platforms offer REST APIs. Wrap each API call in a tool function that handles authentication, pagination, and error responses. Cache inventory data with a short TTL to reduce API calls.
Yes. Add a tool that accepts the customer's trade-in VIN and mileage, then calls a valuation API like Kelley Blue Book or Black Book to return an estimated value. Subtract the trade-in value from the vehicle price before calculating the finance quote.
In production, use a database-backed appointment system with row-level locking or optimistic concurrency control. Check availability inside a transaction and insert the booking atomically. The in-memory approach shown here is for demonstration only.
#AutomotiveAI #CarDealership #InventoryManagement #AIAgents #Python #AgenticAI #LearnAI #AIEngineering

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
A practical guide for automotive businesses across the Balkans to deploy a CallSphere AI voice and chat agent that books service, answers parts questions, and captures every lead in every local language.
A founder's guide to the personal AI assistant market: best AI assistant apps, business-grade options, and how CallSphere's voice agent fits in.
A founder's guide to free AI agents, low-code AI agent builders, and how to know when you should pay for a real platform like CallSphere.
Graphiti is the open-source temporal knowledge graph for AI agents in 2026. Learn how bi-temporal memory beats vector RAG for voice agents and long-running LLMs.
Chatbot app vs ChatGPT in 2026: a founder's clear take on the difference, when to use which, and how a real AI chatbot app development works.
How we built a fault-tolerant HVAC emergency triage and tech-dispatch platform on Kubernetes — three-tier CQRS, 11 micro-agents on the OpenAI Agents SDK + LangGraph, NATS JetStream, DTMF/SMS/WebSocket acceptance, circuit breakers, and an evaluation pipeline that catches regressions before they wake a tech at 3 AM.
© 2026 CallSphere Inc. All rights reserved.
Made within San Francisco
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.