Veterinary Multi-Agent System
11 specialist AI agents behind one triage layer — rewritten until the numbers were right.
Client work — case study anonymized; architecture and metrics are real.
The system
A pet owner describes a problem; a triage agent gathers context, detects emergencies, and routes to one of eleven specialists — behavioral, blood analyst, fecal analyst, geneticist, nutritionist, radiologist, trainer, translator, urinalyst, vaccination, veterinarian. Each specialist returns a deeply nested, strongly typed Pydantic report, plus a consumer-friendly variant of the same report for the mobile UI.
The platform runs on FastAPI with server-sent events for streaming, deployed on Cloud Run, with async job queues for long-running analyses, per-request credit billing with itemized cost breakdowns, and media handling with content-moderation flags.
Five rewrites, measured honestly
The interesting part isn't the first version — it's that the system was rebuilt five times, with a controlled before/after evaluation at each step: every specialist, fifty cases each, identical inputs.
The final architecture splits every specialist into a two-model pipeline: a reasoning model thinks, then a fast structuring model forces the output into the Pydantic schema. Latency collapsed — the behavioral specialist alone dropped from 33.1s to 11.7s — while judge scores dipped slightly, a tradeoff the eval report names explicitly as the schema tax and accepts with eyes open.
Safety as a regression suite
A 14-question stress test built from confirmed prior failures — missed emergencies, dangerous advice, wrong clinical facts — runs against every generation of the system. Between generations, clear safety and emergency failures went from five to zero, dangerous advice from one to zero, and incorrect clinical facts from one to zero, with the two remaining soft gaps flagged rather than hidden.
Under burst load at concurrency 15, the behavioral specialist profiles at a 12.15s mean, 20.4s P95, and 22.3s P99 across 50 cases — at a marginal LLM cost held under $0.02 per turn.
Built with
Every technology this project runs on, and the job it does here. Each one links to the other projects it appears in.