NLWeb Setup
Before writing code
Fetch live docs first:
- Fetch https://github.com/nlweb-ai/NLWeb (README) for the current minimum Python version and required deps.
- Fetch https://github.com/nlweb-ai/NLWeb/blob/main/docs/nlweb-hello-world.md for the canonical hello-world flow.
- Fetch https://github.com/nlweb-ai/NLWeb/blob/main/docs/nlweb-cli.md for current
nlwebCLI flags. - Web-search
site:github.com/nlweb-ai/NLWeb docs/release_notesand read the most recent dated release note — config keys and required env vars change between releases. - Identify the default
write_endpointand verify which backends are enabled by default inconfig/config_retrieval.yamlonmain.
Conceptual Architecture
What "setup" produces
A working NLWeb dev environment has four parts:
- Cloned repo + Python virtualenv with requirements installed.
.envfile with provider credentials (OpenAI/Azure OpenAI key + retrieval backend secrets).- Sample data ingested into the local vector store (Qdrant local by default).
- A running aiohttp server on
:8000with/ask,/mcp,/sitesreachable.
Three Default-Enabled Backends — Watch Out
NLWeb ships with three retrieval backends enabled by default in config_retrieval.yaml:
qdrant_local(file-backed, fine for dev)nlweb_west(Azure AI Search — requires Azure credentials)shopify_mcp(queries Shopify's MCP endpoint, requires network)
For most local-dev cases, disable the latter two by setting enabled: false so you don't get connection errors at startup. The write_endpoint should point to qdrant_local for dev.
Setup Decision Checklist
- LLM provider — OpenAI, Azure OpenAI (default), Anthropic, Gemini, Ollama (offline), Snowflake Cortex?
- Embedding provider — must match between ingest and query; default is
text-embedding-3-smallon Azure OpenAI. - Retrieval write endpoint — Qdrant local for dev, Azure AI Search / Snowflake Cortex / pgvector for prod.
- Data source — Schema.org JSON-LD on the site, RSS/Atom feed, sitemap.xml, or CSV?
- Mode —
development(allows query-string config overrides) orproductioninconfig_webserver.yaml? - OAuth — anonymous-only, or login-gated (GitHub/Google/Microsoft/Facebook)?
Project Layout (after setup)
NLWeb/ # cloned repo
├── AskAgent/python/
│ ├── app-aiohttp.py # main entry
│ ├── core/, methods/, webserver/ # core code
│ ├── llm_providers/, embedding_providers/, retrieval_providers/
│ └── data_loading/
├── config/
│ ├── config_llm.yaml
│ ├── config_embedding.yaml
│ ├── config_retrieval.yaml
│ ├── config_nlweb.yaml
│ ├── config_webserver.yaml
│ ├── config_oauth.yaml
│ ├── config_storage.yaml
│ ├── config_tools.yaml
│ ├── site_types.xml
│ └── prompts.xml
├── data/db/ # qdrant_local file store
├── .env # YOUR credentials (gitignored)
└── docs/, scripts/, demo/, tests/
Setup Sequence
git clone https://github.com/nlweb-ai/NLWeb && cd NLWebnlweb init-python(or manualpython -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt)nlweb init— interactive prompts walk through LLM + retrieval selection and write.env- Disable the unwanted default backends in
config/config_retrieval.yaml(nlweb_west,shopify_mcpfor local-only dev) nlweb data-load <source> <site-name>— ingest sample content (use a small RSS feed for first run)nlweb check— runs connectivity diagnostics; resolve any red flagsnlweb app— start the server, hithttp://localhost:8000/- Test
/ask?query=hello&site=<site-name>&streaming=false
.env Conventions
NLWeb expects credentials via env vars (never YAML). Common keys (verify live):
OPENAI_API_KEY,AZURE_OPENAI_API_KEY,AZURE_OPENAI_ENDPOINTANTHROPIC_API_KEY,GEMINI_API_KEYAZURE_SEARCH_ENDPOINT,AZURE_SEARCH_API_KEYQDRANT_API_KEY(only for remote Qdrant)SNOWFLAKE_USER,SNOWFLAKE_PASSWORD,SNOWFLAKE_ACCOUNTCLOUDFLARE_API_TOKEN,CLOUDFLARE_ACCOUNT_ID
Verification Targets
After setup, these should work:
curl http://localhost:8000/sites→ JSON list including your loaded sitecurl 'http://localhost:8000/ask?query=test&site=<your-site>&streaming=false'→ JSON with resultscurl -X POST http://localhost:8000/mcp -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'→ask,list_sites, optionallywho
Common Setup Failures
nlweb checkfails on Azure: usuallyAZURE_OPENAI_ENDPOINTmissing trailing slash or wrong deployment name.- Embedding dim mismatch on retrieval: data was loaded with a different embedding provider than runtime config. Either re-ingest or change
preferred_providerinconfig_embedding.yaml. - Server starts but
/askreturns empty: site name in the query doesn't match thesitevalue used during ingest, or thesites:allowlist inconfig_nlweb.yamlexcludes it. - Slow first request: cold model loading +
/whoendpoint pingingnlwm.azurewebsites.net. Disablewho_endpoint_enabledfor offline dev.
Always re-verify against the latest hello-world doc — the exact env-var names and CLI flags change.