Skip to main content

Every team has the same first Glean app: a single page where anyone can ask a company question and get a cited, permission-aware answer. There are two equally valid ways to build it — this recipe builds both, side by side, so you can pick the trade-off that fits your app.

Company Answers pagesingle input + answer card
Path A: Web SDKrenderChat — Glean owns the UI
Path B: Chat APIchat.create — you own the UI
Gleanpermission-aware answers with citations
A Glean instance with content indexed
For the Web SDK path: an existing Glean session in your normal browser
Node 20.19+ or 22.12+
1

Pick a path

Path A (Web SDK) renders Glean's own chat UI for you — fastest to stand up, no backend code. Path B (Chat API) calls the Chat API directly from your own backend — you own every pixel of the UI and the request/response shape. Both reach the same place: a permission-aware, cited answer.

1

Scaffold the project

npx -y tiged@2.12.8 --mode=git gleanwork/glean-cookbook/recipes/company-answers/web-sdk company-answers
2

Install dependencies

cd company-answers && npm install
3

Configure the tenant

Enter the user's work email when prompted. The shipped discovery command writes VITE_GLEAN_BACKEND to .env.local. Set VITE_GLEAN_INITIAL_MESSAGE to the topic they supplied.

cd company-answers && npm run configure -- --email "<work-email>"
4

Run it

cd company-answers && npm run dev
5

Verify

Give the user the exact printed local URL to open in their normal signed-in browser. Ask them to try a topic they know exists in their Glean instance and confirm a real, cited answer renders inside Glean's chat UI.

Take it further
  • Swap in a specific agent by passing its agentId — to the chat component for Path A, or in the chat.create request for Path B.
  • Stream responses instead of waiting for the full answer (both the Web SDK and the Chat API support streaming).
  • Add follow-up prompt suggestions from the Chat API response's followUpPrompts.

What's our PTO policy?

Returns a non-empty answer with at least one citation carrying a real title and URL, drawn from your own indexed content.

How do I request time off?

Returns a non-empty answer with at least one citation carrying a real title and URL, drawn from your own indexed content.

Each of these was run against a live Glean instance on 2026-08-02.

View source

Runs the recipe through the Glean cookbook plugin.

Auth

This path uses your existing Glean browser session. Find the web app URL on the About page. The API server URL is a different field.

Run the authenticate step on this page. It discovers your tenant from work email and signs you in with OAuth. If OAuth is unavailable, create a scoped Glean-issued token in Token Management (CHAT).

At a glance
SurfacesClient API, API clients, Web SDK
StatusShowcase
Time~30 min
Required scopes
CHAT