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
Keep Vite running, report its exact Local URL, and wait for the user to open it in their normal signed-in browser. Never open or automate the URL yourself.
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
Leave the verified app running at http://localhost:3000 and give that URL to the user.
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.