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.
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.
- Web SDK
- Chat API
Scaffold the project
npx -y tiged@2.12.8 --mode=git gleanwork/glean-cookbook/recipes/company-answers/web-sdk company-answersInstall dependencies
cd company-answers && npm installConfigure 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>"Run it
cd company-answers && npm run devVerify
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.
Scaffold the project
npx -y tiged@2.12.8 --mode=git gleanwork/glean-cookbook/recipes/company-answers/chat-api company-answersInstall dependencies
cd company-answers && npm installSet credentials
The shipped command discovers the tenant from the user's work email, signs them in with OAuth, and writes the backend plus short-lived access token to ignored .env. Set GLEAN_DEMO_QUERY to the supplied topic. If tenant OAuth is unavailable, enter a CHAT-scoped API token as the fallback.
cd company-answers && npm run login -- --email "<work-email>"Verify
Takes about 1–3 minutes. It starts its own server and checks the configured topic for a non-empty answer with deduplicated citations.
cd company-answers && npm run verifyRun it
cd company-answers && npm start- Swap in a specific agent by passing its
agentId— to the chat component for Path A, or in thechat.createrequest 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.
Web SDK
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.
Chat API
Run the authenticate step on this page. It discovers your tenant from work email and signs you in with OAuth, using the shipped login command. If OAuth is unavailable, create a scoped Glean-issued token in Token Management (CHAT).
Chat API