Skip to Content
ExamplesOverview

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/.

ExampleTemplateWhat it shows
Product advisorProduct advisor agentChatting as different shoppers, and reading back the quiz the agent saved.
ProtocolProtocol agentA store that triggers a workflow on each order, then a routine chat with check-ins and a timeline.
Subscription saveSubscription save agentA cancel chat, a webhook that receives each outcome, and a store desk that confirms cancellations.
Scan recommendationScan to recommendation agentSending someone through a face scan, waiting for the results, and recommending from them.
Wellness scoreInsurer wellness score agentA member portal that starts a wellness check and explains the score without touching cover.
Clinic intakeClinic intake agentA patient intake chat, red flags surfaced by the app, and a clinic view of booking requests.
Lab resultsLab results agentA patient portal that explains results, and a clinician list of results flagged for follow-up.
ReturnsReturns agentA 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