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 tiged --mode=git gleanwork/glean-cookbook/recipes/acme-answers/web-sdk acme-answersInstall dependencies
cd acme-answers && npm installCredentials
Default SSO auth needs no configuration — the Web SDK relies on the user's existing browser session with Glean.
Run it
npm run devVerify
Open the printed local URL and ask "What's our PTO policy?" — confirm a real, cited answer renders inside Glean's chat UI.
Scaffold the project
npx tiged --mode=git gleanwork/glean-cookbook/recipes/acme-answers/chat-api acme-answersInstall dependencies
cd acme-answers && npm installSet credentials
Fill in GLEAN_API_TOKEN and GLEAN_INSTANCE — see the client-api-oauth-or-token auth section in cookbook-conventions for how to get a token.
cp .env.example .envRun it
Leaves the server running so you can try it yourself at http://localhost:3000 — stop it (Ctrl-C) before the deterministic verify step below, which starts its own instance.
npm startVerify
Starts the server itself, runs both demo queries for real, and asserts the response shape (non-empty answer, non-empty deduped citations with title+url) — exits non-zero on any failure. Do not report this recipe as done until this passes.
npm run verifyagentId — to the chat component for Path A, or in the chat.create request for Path B.followUpPrompts.Copies a prompt your AI assistant can build from.