aliases: [] canonical_name: Threaded Email Agent Pattern (FastAPI + Claude) dashboard_url: https://dashboard.kismetpets.com/context/concepts/mechanism/threaded-email-agent-pattern/ id: 182 kind: mechanism last_synthesized_at: ‘2026-05-07T21:20:09.551308+00:00’ slug: threaded-email-agent-pattern updated_at: ‘2026-05-07T21:20:09.551453+00:00’

Threaded Email Agent Pattern (FastAPI + Claude)

Mechanism — threaded-email-agent-pattern

Reusable mechanism for building branded customer-support email agents at Kismet: a FastAPI webhook receives inbound emails as JSON, persists conversation history keyed by thread_id, replays prior turns into Claude with a domain-specific system prompt, and returns a response email plus updated thread_id for follow-ups. Externalizes the system prompt into its own module (e.g. system_prompt.py) so voice/tone can be iterated without touching transport code.

Strategic value: pattern is reusable for non-vet email personas (e.g. nutrition concierge, subscription support). Key knobs: model choice, system prompt, clarifying-question policy, and product-mention guardrails. First instantiation is the Ask a Vet email agent.

Referenced by