Product advisor
Code · Template: Product advisor agent · Runs on http://localhost:3000
A microsite for trying the Product advisor agent as different shoppers. The home page lists the organization’s shoppers from Loops and lets you add new ones. Opening a shopper shows their last saved quiz and lets you chat with the agent as them.

| Shoppers | Starting a conversation |
|---|---|
![]() | ![]() |
What it shows
- Chatting with an agent from your own app. One message per request on a thread, with Loops keeping the history. See Calling an agent.
- Reading what a workflow saved. After the agent recommends, the
product-advisor-saveworkflow writes the quiz onto the shopper, and the page reads it back. - Draft shoppers. Loops creates a shopper only when their first quiz is saved, so the app keeps new shoppers as drafts marked No quiz yet until then.
The endpoints it uses
| Endpoint | Used for |
|---|---|
POST /chat | Sending one message and getting the agent’s reply. |
GET /users | The shopper list, 50 at a time with Load more. |
GET /users/:userId | A shopper’s saved quiz in metadata.quiz. 404 means none yet. |
All paths start with /loop/:organizationId/:loopId, on the product-advisor loop.
Run it
- Deploy the Product advisor agent template. Copy the organization id and the
product-advisorloop id from the loop’s page. - In Settings → API tokens, create a token for that loop with access set to Run and read.
- Copy
apps/product-advisor/.env.exampleto.envand fill inLOOPS_API_URL,LOOPS_ORGANIZATION_ID,LOOPS_LOOP_IDandLOOPS_API_TOKEN. - Run
bun run dev --filter=product-advisor.
Port 3000 is also the Loops dashboard’s port when you run Loops locally. Stop one of them, or change the port in the app’s package.json.
Where to look in the code
| File | What it does |
|---|---|
src/lib/loops.ts | Server functions for the three Loops endpoints. |
src/lib/shoppers.ts | What Loops doesn’t store: names, thread ids and transcripts. |
src/routes/index.tsx | The shopper list. |
src/routes/users.$userId.tsx | A shopper’s last quiz and the chat. |
Last updated on

