Skip to content

Add travel-concierge example (cloud catalog + live session)#408

Open
samanyugoyal2010 wants to merge 17 commits into
usemoss:mainfrom
samanyugoyal2010:examples/add-travel-concierge
Open

Add travel-concierge example (cloud catalog + live session)#408
samanyugoyal2010 wants to merge 17 commits into
usemoss:mainfrom
samanyugoyal2010:examples/add-travel-concierge

Conversation

@samanyugoyal2010

@samanyugoyal2010 samanyugoyal2010 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Supersedes #347 with review fixes applied on top of that branch.

A new voice-agent example under moss-live-labs/examples/travel-concierge that shows Moss answering from two indexes in a single call:

  • Pre-loaded catalog (cloud index) — long-term trip knowledge, shared across every call.
  • Live session — an in-memory session index that captures what the traveler says on this call.

Each turn the agent recalls the traveler's stated preferences from the session and recommends matching trips from the catalog. Both result sets are published on a moss.retrieval data channel, and the web UI renders them side by side, lighting up per turn with per-query latency.

Why it's interesting

  • Demonstrates long-term knowledge + short-term memory in the same call — one pre-loaded index and one live session, both queried in milliseconds.
  • Facts are distilled from each turn before they're stored, so the session holds clean preferences (e.g. "Budget is about $2,500 per person") rather than raw questions.

Review fixes included (on top of #347)

  • Bound fact-extraction wait so a slow remember cannot stall the voice loop
  • Include recalled session preferences in the catalog query
  • Remember facts even when retrieval fails; republish session panel after store
  • Upsert preferences by stable category id so corrections replace stale values
  • Skip blank transcriptions; validate fact-list shape; avoid logging sensitive turn content at INFO
  • Harden web: validate moss.retrieval payloads, room-live status, optional APP_SECRET on /api/token, generic 500s, a11y live region, contrast tokens, working eslint + Node 18 types
  • Docs use uv run python ...; UTF-8 catalog seeding

Contents

  • agent.py — LiveKit agent querying catalog + session each turn
  • seed_index.py — seeds the catalog cloud index
  • data/catalog.json — 14 destinations
  • web/ — Next.js UI showing both panels
  • README.md, DEMO_SCRIPT.md

Try it

uv sync && cp .env.example .env   # fill in Moss + provider keys
uv run python seed_index.py
livekit-server --dev
uv run python agent.py dev
cd web && npm install && cp .env.local.example .env.local && npm run dev

Docs: https://docs.moss.dev/docs/integrate/sessions

Note for maintainers

Please close #347 in favor of this PR (same branch history + review hardening). GitHub does not auto-close PRs via Closes #347.

HarshaNalluru and others added 7 commits July 6, 2026 20:11
… session)

A voice travel concierge that answers from two Moss indexes at once:
- a pre-loaded catalog (long-term, shared across every call)
- a live session that captures what the traveler says on this call

Each turn it recalls stated preferences from the session and recommends
trips from the catalog. Facts are distilled from each turn before they
are stored, so the session holds clean preferences rather than raw
questions. The web UI shows both indexes side by side, lighting up per
turn with per-query latency.

Includes agent.py, seed_index.py, a Next.js web UI, README, and a demo
script.
- next.config: use serverExternalPackages for livekit-server-sdk instead
  of a non-standard outputFileTracingRoot, matching insurance-adjuster
- token route: require LIVEKIT_* env vars and return 500 on misconfig
  instead of silently falling back to well-known dev credentials
- DualPanel: reuse a single TextDecoder across data-channel messages
- token route: use crypto.randomUUID() for room/identity (collision-resistant).
- agent.py: await the previous turn's fact-remember task before recalling, so an
  immediate follow-up question sees the just-stored facts (no fire-and-forget race).
…seed_index), add uuid suffix to session name (no same-second collision), Node 18.18+ in README
…CRIPT quote block; fail fast if catalog index is missing
…ilience

Keep the voice loop responsive under slow fact extraction, include recalled preferences in catalog search, and make the web UI/token path safer for unexpected payloads and public deploys.

Co-authored-by: Cursor <cursoragent@cursor.com>
@samanyugoyal2010 samanyugoyal2010 changed the title Examples/add travel concierge closes PR #347 Add travel-concierge example (cloud catalog + live session) Jul 17, 2026
@samanyugoyal2010

Copy link
Copy Markdown
Contributor Author

This PR supersedes #347. Maintainers: please close #347 when taking this one.

@samanyugoyal2010

Copy link
Copy Markdown
Contributor Author

@cubic.dev

@cubic-dev-ai

cubic-dev-ai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@cubic.dev

@samanyugoyal2010 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 25 files

Tip: instead of fixing issues one by one fix them all with cubic
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread moss-live-labs/examples/travel-concierge/web/app/api/token/route.ts Outdated
Comment thread moss-live-labs/examples/travel-concierge/pyproject.toml Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/components/Transcript.tsx Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/app/api/token/route.ts Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/components/DualPanel.tsx Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/components/DualPanel.tsx Outdated
Comment thread moss-live-labs/examples/travel-concierge/agent.py Outdated
… and UI

Replace the client-visible token secret with an httpOnly gate cookie, keep fact writes alive across turn timeouts, and tighten the demo UI (side-by-side panels, transcript scroll/a11y, mic-only grants, Python <3.15).

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 15 files (changes from recent commits).

Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread moss-live-labs/examples/travel-concierge/web/app/api/gate/route.ts
Comment thread moss-live-labs/examples/travel-concierge/agent.py Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/lib/gate.ts Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/app/api/gate/route.ts Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/components/DualPanel.tsx Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/app/page.tsx Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/app/page.tsx Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/app/page.tsx Outdated
…lize preference writes

Sign issuance time into the gate cookie, rate-limit unlock/token attempts, compare secrets in constant time, and drop stale category upserts so slow extracts cannot overwrite newer corrections.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 8 files (changes from recent commits).

Tip: instead of fixing issues one by one fix them all with cubic
Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread moss-live-labs/examples/travel-concierge/web/lib/rate-limit.ts
Comment thread moss-live-labs/examples/travel-concierge/web/lib/rate-limit.ts Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/app/api/token/route.ts
Comment thread moss-live-labs/examples/travel-concierge/web/app/page.tsx Outdated
Comment thread moss-live-labs/examples/travel-concierge/agent.py
Comment thread moss-live-labs/examples/travel-concierge/agent.py
…preference races

Ignore forwarding headers unless TRUST_PROXY=1, evict expired limiter buckets, clear the gate code as soon as the cookie is set, and only advance category/refresh sequencing after successful session writes.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files (changes from recent commits).

Tip: instead of fixing issues one by one fix them all with cubic
Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread moss-live-labs/examples/travel-concierge/web/.env.local.example Outdated
Comment thread moss-live-labs/examples/travel-concierge/agent.py Outdated
Comment thread moss-live-labs/examples/travel-concierge/agent.py Outdated
Comment thread moss-live-labs/examples/travel-concierge/agent.py Outdated
Comment thread moss-live-labs/examples/travel-concierge/web/lib/rate-limit.ts Outdated
samanyugoyal2010 and others added 2 commits July 17, 2026 14:41
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
…imit identity

Keep panel refresh off the write lock with write-gen ordering, claim category seq before store with a retry, ignore spoofable X-Forwarded-For in favor of platform IP headers, and reserve rate-limit capacity before insert.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread moss-live-labs/examples/travel-concierge/web/lib/rate-limit.ts Outdated
Comment thread moss-live-labs/examples/travel-concierge/agent.py
Comment thread moss-live-labs/examples/travel-concierge/agent.py Outdated
samanyugoyal2010 and others added 2 commits July 17, 2026 15:09
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
…l refresh

Use an explicit TRUSTED_CLIENT_IP_HEADER instead of a multi-header TRUST_PROXY flag, and run session panel refresh on a detached task so slow publishes no longer extend the voice-turn remember wait.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread moss-live-labs/examples/travel-concierge/web/lib/rate-limit.ts Outdated
Comment thread moss-live-labs/examples/travel-concierge/agent.py
samanyugoyal2010 and others added 2 commits July 17, 2026 15:37
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Stop evicting unexpired client buckets to make room for new keys, which reset an active client's allowance early. Unknown keys are rejected until a slot expires.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread moss-live-labs/examples/travel-concierge/README.md Outdated
Comment thread moss-live-labs/examples/travel-concierge/agent.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants