Wellness score
Code · Template: Insurer wellness score agent · Runs on http://localhost:3014
A mock insurer or employer portal. Add a test member, start a wellness check, watch their face scan come back as a wellness score, and chat with the agent about what it means.

| A check in progress | Members |
|---|---|
![]() | ![]() |
What it shows
- Sending a full payload. The check form posts age, sex and three health answers to
wellness-score-scan, which uses them in the risk estimates. - A long wait. The run waits up to an hour for the scan. The app refetches the member until
wellnessScore.scannedAtchanges, and keeps the previous score if the scan isn’t taken. - Explaining a score the agent can’t see. The first message carries the member’s answers and latest score, and the agent never ties it to cover, premiums or claims.
The endpoints it uses
| Endpoint | Used for |
|---|---|
POST / on wellness-score-scan | Starting a wellness check. |
POST /chat on wellness-score | Sending one message and getting the reply. |
GET /users | The member list, 50 at a time with Load more. |
GET /users/:userId | A member’s latest score and memory. |
The check body:
{
"memberId": "member-10442",
"age": 46,
"gender": "female",
"smoker": false,
"hasDiabetes": false,
"isTreatedForHypertension": true
}The template’s payload example in the dashboard shows userId, but the workflow reads memberId, and needs age and gender.
Run it
- Deploy the Insurer wellness score agent template. There’s nothing to tick and nothing to set under Variables and secrets.
- Copy the organization id, the
wellness-scoreloop id and thewellness-score-scanloop id. - In Settings → API tokens, create a token for the whole organization with access set to Run and read.
- Copy
apps/wellness-score/.env.exampleto.envand fill inLOOPS_API_URL,LOOPS_ORGANIZATION_ID,LOOPS_AGENT_LOOP_ID,LOOPS_SCAN_LOOP_IDandLOOPS_API_TOKEN. - Run
bun run dev --filter=wellness-score.
Take the scan on a phone or laptop with a camera, in Chrome or Safari. WhatsApp’s in-app browser can’t run it.
Where to look in the code
| File | What it does |
|---|---|
src/lib/loops.ts | Server functions for the Loops endpoints. |
src/lib/members.ts | What Loops doesn’t store: names, health answers, open checks and transcripts. |
src/components.tsx | The score band and blood pressure in words. |
src/routes/members.$memberId.tsx | A member’s score card, wellness check, history and the chat. |
Last updated on

