Skip to content

Workflow Diagrams

Decision trees and flow diagrams for the 4-step tool workflow.


Primary Workflow: Drug Name to Coupon

The most common flow. Starts with a drug name and ends with a coupon code. Each tool runs once, in sequence.

User: "Find me a coupon for [drug]"
        |
        v
  search_drug                                ← Step 1
        |
        +-- Multiple matches found
        |       -> Options presented to user
        |       -> User selects one
        |
        +-- Single match found
        |       -> Proceeds automatically
        |
        v
  get_drug_options                           ← Step 2
        |
        |   Options shown:
        |   Generic first, Brand second
        |   Default option highlighted
        |
        +-- User picks dosage/form/quantity
        |
        v
  get_drug_prices                            ← Step 3
        |
        |   Real-time pharmacy prices
        |   sorted cheapest first
        |
        +-- User picks pharmacy (or cheapest)
        |
        v
  get_coupon                                 ← Step 4
        |
        v
  Coupon with:
    - Pharmacy name
    - Discounted price
    - BIN, PCN, Group ID, Member ID
    - Redemption instructions

Shortcut: NDC-Direct to Coupon

For users who already have an NDC code (from the prescription bottle or a previous lookup), steps 1-2 are skipped.

User: "I have NDC 29300039710, qty 30"
        |
        v
  get_drug_prices                            ← Step 3
        |
        v
  get_coupon                                 ← Step 4
        |
        v
  Coupon details

TIP

This is the shortest workflow: only 2 tool calls.


Partial Workflow: Price Comparison Only

When the user only wants to compare prices without getting a coupon.

  search_drug                                ← Step 1
        |
        v
  get_drug_options                           ← Step 2
        |
        v
  get_drug_prices                            ← Step 3
        |
        v
  Price table shown
  (user may then request a coupon for a specific pharmacy)

Partial Workflow: Explore Dosage Options

When the user wants to see available options before looking up prices.

  search_drug                                ← Step 1
        |
        v
  get_drug_options                           ← Step 2
        |
        v
  All options displayed:
    - Dosage strengths (e.g., 10MG, 20MG, 40MG)
    - Forms (Tablet, Capsule, Vial, Pen, etc.)
    - Available quantities
    - Generic vs Brand labels
    - Default option highlighted
        |
        v
  User picks an option -> continue to pricing

Decision Tree: Which Path?

Does the user have an NDC code?
  |
  +-- YES -> get_drug_prices
  |            -> get_coupon
  |
  +-- NO -> search_drug
              |
              +-- Single match
              |     -> get_drug_options
              |
              +-- Multiple matches
                    -> User picks
                    -> get_drug_options
                          |
                          v
                    get_drug_prices
                          |
                          v
                    get_coupon

Common Scenarios

ScenarioWorkflow
"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

Key Design Principles

  1. One tool per turn: each tool runs separately, never combined in a single turn
  2. Sequential: each tool's output feeds the next step
  3. Generic first: options are always sorted with generic alternatives before brand names
  4. Cheapest first: prices are always sorted ascending
  5. Disambiguation upfront: multiple matches are resolved before proceeding
  6. NDC shortcut: users with an NDC skip the discovery steps

Powered by SaveHealth