Workflow Diagrams
Decision trees and flow diagrams for navigating SaveHealth's 4-step tool workflow.
Primary Workflow: Drug Name to Coupon
The most common flow starts with a natural-language drug name and ends with a coupon code. Each tool is called once per turn, in sequence.
User: "Find me a coupon for [drug]"
│
▼
search_drug(drug_name) ← Step 1
│
├── needs_disambiguation: true
│ → Present options to user
│ → User selects one
│ → Continue with selected slug
│
├── needs_disambiguation: false
│ → Use returned slug
│
▼
get_drug_options(slug, dosage?) ← Step 2
│
│ Returns options sorted:
│ Generic first, Brand second
│ Default option marked
│
├── User picks dosage/form/quantity
│
▼
get_drug_prices(ndc, quantity) ← Step 3
│
│ Returns pharmacy prices
│ sorted cheapest first
│
├── User picks pharmacy (or cheapest)
│
▼
get_coupon(key) ← Step 4
│
▼
Return coupon with:
- pharmacy name
- discounted price
- coupon code
- BIN, PCN, Group ID, Member ID
- redemption instructionsShortcut: NDC-Direct to Coupon
For users who already have an NDC code (from their prescription bottle or a previous lookup), steps 1-2 are skipped entirely.
User: "I have NDC 29300039710, qty 30"
│
▼
get_drug_prices(ndc, quantity) ← Step 3
│
▼
get_coupon(key) ← Step 4
│
▼
Return coupon detailsTIP
This is the shortest possible workflow — only 2 tool calls.
Partial Workflow: Price Comparison Only
When the user only wants to compare prices without getting a specific coupon.
search_drug(drug_name) ← Step 1
│
▼
get_drug_options(slug, dosage?) ← Step 2
│
▼
get_drug_prices(ndc, quantity) ← Step 3
│
▼
Present price table to user
(user may then request a coupon for a specific pharmacy)Partial Workflow: Explore Dosage Options
When the user wants to see what's available before committing to a price lookup.
search_drug(drug_name) ← Step 1
│
▼
get_drug_options(slug) ← Step 2
│
▼
Present all options:
- Dosage strengths (e.g., 10MG, 20MG, 40MG)
- Forms (Tablet, Capsule, Vial, Pen, etc.)
- Available quantities
- Generic vs Brand labels
- Default option highlighted
│
▼
User picks an option → continue to pricingDecision Tree: Which Path?
Does the user have an NDC code?
│
├── YES → get_drug_prices(ndc, qty)
│ → get_coupon(key)
│
└── NO → search_drug(drug_name)
│
├── Single match
│ → get_drug_options(slug)
│
└── Multiple matches
→ Present options
→ User picks
→ get_drug_options(slug)
│
▼
get_drug_prices(ndc, qty)
│
▼
get_coupon(key)Tool Dependency Map
| Tool | Requires | Provides | Step |
|---|---|---|---|
search_drug | drug_name (string) | slug | 1 |
get_drug_options | slug (from search_drug) | NDC, dosage, form, quantity, type | 2 |
get_drug_prices | NDC + quantity (from get_drug_options or user) | price list with keys | 3 |
get_coupon | key (from get_drug_prices) | coupon details | 4 |
Common Scenarios
| Scenario | Workflow |
|---|---|
| "Cheapest coupon for X" | search_drug → get_drug_options → get_drug_prices → get_coupon |
| "Compare prices for X" | search_drug → get_drug_options → get_drug_prices |
| "What dosages for X?" | search_drug → get_drug_options |
| "Coupon for NDC 12345" | get_drug_prices → get_coupon |
| "Prices for NDC, qty 90" | get_drug_prices |
| "Coupon at CVS for X" | search_drug → get_drug_options → get_drug_prices → get_coupon (CVS key) |
Key Design Principles
- One tool per turn — Each tool is called separately, never combined in a single turn
- Sequential dependency — Each tool's output feeds the next tool's input
- Generic first — Options are always sorted with generic alternatives before brand names
- Cheapest first — Prices are always sorted ascending
- Disambiguation upfront — Multiple matches are resolved before proceeding
- NDC shortcut — Users with an NDC skip the discovery steps entirely
