Examples
Example apps that call Loops from the outside, each one built around a template. The code is in Ollie-Health-Inc/examples on GitHub, with one TanStack Start app per folder under apps/.
| Example | Template | What it shows |
|---|---|---|
| Product advisor | Product advisor agent | Chatting as different shoppers, and reading back the quiz the agent saved. |
| Protocol | Protocol agent | A store that triggers a workflow on each order, then a routine chat with check-ins and a timeline. |
| Subscription save | Subscription save agent | A cancel chat, a webhook that receives each outcome, and a store desk that confirms cancellations. |
| Scan recommendation | Scan to recommendation agent | Sending someone through a face scan, waiting for the results, and recommending from them. |
| Wellness score | Insurer wellness score agent | A member portal that starts a wellness check and explains the score without touching cover. |
| Clinic intake | Clinic intake agent | A patient intake chat, red flags surfaced by the app, and a clinic view of booking requests. |
| Lab results | Lab results agent | A patient portal that explains results, and a clinician list of results flagged for follow-up. |
| Returns | Returns agent | A staff returns desk that applies the store’s policy and keeps each customer’s returns log. |
What every example has in common
- The API token stays on the server. Every call to Loops is a server function in the app’s
src/lib/loops.ts, and the browser only calls the app. - The first message introduces the person. The chat API has no user field, and agents can’t read a user’s metadata. So each thread starts with a line saying who the person is, plus anything the agent needs, such as what they ordered or their latest score.
- Results are read back from the user. Workflows finish a few seconds after the agent replies. The app refetches the user with
GET /users/{userId}until the field it’s waiting for changes. - The app keeps what Loops doesn’t. Names, transcripts and thread ids live in the app, because Loops stores only the user’s id, metadata and memory.
Running an example
Every app needs the same four values in its .env: LOOPS_API_URL, LOOPS_ORGANIZATION_ID, the loop ids it calls, and LOOPS_API_TOKEN. Each example’s page lists its loops and anything extra.
git clone https://github.com/Ollie-Health-Inc/examples.git
cd examples
bun install
cp apps/<example>/.env.example apps/<example>/.env
bun run dev --filter=<example>To run against Loops on your machine, set LOOPS_API_URL to http://localhost:8787.
Last updated on