Conservative AI
AfterHours Ally uses AI in a deliberately narrow, safety-bounded role. The system is designed so that no model output can change a triage outcome or give advice that substitutes for veterinary judgment.
"The deterministic engine classifies urgency. The AI assists with language. Those roles never swap."
— AfterHours Ally Safety Contract
How it works
Deterministic engine decides
Every urgency classification — Routine, Semi-Urgent, Urgent, Emergency — is made by a rule-based scoring engine. The engine evaluates symptom weights against fixed thresholds. No machine-learning model is in the decision path. This makes outcomes predictable, auditable, and reproducible.
AI only suggests; it never overrides
The AI layer (Claude, accessed through Vercel's AI Gateway) assists with two narrow tasks: mapping a free-text chief complaint to the most relevant clinical domain, and generating a plain-language summary for the result screen. In both cases the AI output is advisory. The engine's numerical result always takes precedence.
Clinical weights never reach the model
Symptom weights, red-flag flags, and threshold values are never included in the AI prompt. The model has no visibility into what weights a symptom carries or what score triggers which urgency level. This eliminates the risk of model manipulation or adversarial prompt injection affecting triage outcomes.
All AI output is labeled
Any text generated by the AI is presented with a visible "AI-Assisted" label. The result screen distinguishes deterministic urgency (large, high-contrast, unambiguous) from AI-generated guidance text (smaller, labeled, secondary). Owners and DVMs always know the difference.
Every decision is time-stamped and logged
Each interaction generates an immutable audit record: species, age, symptoms selected, domain, engine score, urgency result, consent timestamp, and client IP. The AI's input and output are also logged. Records are retrievable in the Audit Log and exportable as PDF or CSV.
Outputs are suggestions, not directives
All owner-facing text includes appropriate hedging language and a consistent disclaimer that the triage tool does not replace professional veterinary evaluation. Emergency results include explicit instructions to seek immediate care — the system does not attempt to reassure owners out of emergency action.
Request flow
FAQ
Can the AI cause a missed emergency?
No. The AI is not in the urgency decision path. A pet showing emergency-weight symptoms will always receive an Emergency result regardless of what the AI generates. If the AI fails (API timeout, rate limit), the engine continues running and the result is delivered without AI text.
What model is used?
The production deployment uses Anthropic Claude (claude-haiku for domain classification, claude-sonnet for result summaries) via Vercel's AI Gateway. Model calls are server-side only — the model name, prompt structure, and response never reach the browser.
What data does the AI receive?
The classify endpoint sends: species, age group, and selected symptom display labels. No owner PII (name, phone, email), no client IP, no raw free-text from owners, and no clinical weights. The model output is a domain suggestion and/or a plain-language summary.
Does the AI learn from our clinic's cases?
No. AfterHours Ally uses the hosted Anthropic API via Vercel. No training or fine-tuning occurs based on clinic data. Each request is stateless.
Can I turn off the AI layer?
Yes. In Settings → AI Features, you can disable AI domain classification and AI result summaries independently. With both disabled, the system runs in fully deterministic mode: owners see a plain urgency result with a canned template, with no AI text anywhere in the flow.