Kkarthik.dev
Back to projects
AI

Errand Agent

Home-services booking agent where the LLM proposes and code disposes: no booking without approval, no double booking, never a false 'booked'

Python 3.12SQLiteClaude APIpytestruffmypy --strictuv

Overview

A chat agent that arranges plumbers, electricians, AC servicing and cleaning against a mocked provider world. It asks only for missing details, compares providers with reasons, needs explicit approval before anything consequential and recovers safely when tools fail.

Problem

Booking agents can spend users' money and trust: acting without consent, booking twice after a timeout, claiming success that never happened or obeying instructions hidden in reviews.

Solution

The model only turns language into a schema-checked intent. Approval is decided by deterministic rules, grants are single-use and tied to the exact provider, slot and price, idempotency keys and database constraints stop double bookings, and after a timeout the agent checks booking status before saying anything.

Architecture

  1. 1Intent parser (LLM) feeding a deterministic state machine
  2. 2Single-use approval grants fingerprinted to provider, slot, price and hold
  3. 3Write-ahead intents, idempotency keys and UNIQUE constraints
  4. 4Tool-less sub-agent with closed enums for reading reviews (prompt-injection isolation)
  5. 5Seven global invariants checked on every eval scenario

Technical Challenges

  • Proving the agent never claims a booking that isn't in the provider ledger.
  • Making 'forget this' actually remove data from memory and stored turns.

Results

  • 263 passing tests including concurrency and mutation tests.
  • Runs offline with no API key in about 2 minutes; eval results are generated, never hand-written.