Local installation¶
What you need for every topic: Python, Ollama, two models, and the Python packages. Nothing else: every topic, the MCP server included, is Python.
Tested with Python 3.14, the package versions in requirements.lock, Ollama 0.40.15 with qwen3:8b,
nomic-embed-text and qwen3-vl:8b-instruct, on macOS (Apple Silicon, 16 GB) and Linux (CI). Other Python versions,
Windows and Intel Macs aren't tested but should mostly work; uv venv --python 3.14 gets you the tested Python.
Rough hardware: about 6 GB of disk for the models and 8 GB or more of RAM (16 GB is comfortable).
With 8 GB or less, start with the Low-RAM quick start instead of sections 1-2.
Low-RAM quick start (8 GB or less)¶
qwen3:8b needs about 5-6 GB of free memory while it answers. On an 8 GB laptop that means swapping and replies that
take minutes. Run chat on Groq's free plan instead: the labs don't change, only a few lines in .env.
Path A (recommended): Groq for chat, local embeddings. Install Ollama (section 1) but pull only the small embedding model (270 MB); Groq has no embeddings. RAG and RnR results stay close to the recorded Expected output, since their distances were measured on this model.
ollama pull nomic-embed-text # not qwen3:8b
uv venv && source .venv/bin/activate # from the ai-learning folder (sections 3-4)
uv pip install -r requirements.lock
uv pip install -e '.[hosted]' # adds LiteLLM
cp .env.example .env
In .env, with a free key from console.groq.com/keys (no card):
LLM_MODEL=groq/openai/gpt-oss-120b
GROQ_API_KEY=gsk_...
Then python check_setup.py: chat should show groq/... with the key set, embeddings nomic-embed-text pulled.
The vision model line stays a WARN: Groq's free models read no photos, so skip whatsapp-agent 09. It needs a
local vision model (16 GB RAM) or a paid one that reads images; lab 09 says so and stops if neither is set.
Path B: no Ollama at all. Groq for chat as above, plus a free Google AI Studio key for embeddings:
EMBED_MODEL=gemini/gemini-embedding-001
GEMINI_API_KEY=...
Easiest install, but distance numbers in RAG and RnR's RNR_ASK_MAX_DISTANCE were measured on nomic-embed-text:
expect different numbers and re-check them (providers/).
Use Gemini only for embeddings: its free chat allowed 20 requests a day in November 2026, less than two labs.
Good to know on a free tier:
- Limits. Free plans cap requests per minute and per day: Groq about 30 a minute and 1,000 a day per model in
November 2026 (your console shows yours). The door waits out a short
429for you ([door] ... rate limited, waiting 7 s), up to 2 minutes per call (DOOR_MAX_WAIT_S); a daily quota stops the lab withquota used up, retry in 4.2 h. Eval labs: use the small sample (RnR takes--n 20). - Company network.
CERTIFICATE_VERIFY_FAILED ... self-signed certificatemeans a proxy (Netskope, Zscaler) inspects HTTPS: see Troubleshooting. - Data. Free-tier prompts may be used to improve the provider's models. Fine for these synthetic labs, never for real customer or company data.
- Results. Expected output blocks were recorded on qwen3:8b; a hosted model usually does better, sometimes differently.
1. Ollama¶
Ollama runs the models on your machine and serves them at http://localhost:11434.
- macOS:
brew install ollama, or download the app from https://ollama.com/download - Windows: download the installer from https://ollama.com/download
- Linux:
curl -fsSL https://ollama.com/install.sh | sh
Make sure it is running. The desktop app starts it for you; otherwise run ollama serve in a terminal.
2. Pull the models¶
ollama pull qwen3:8b # chat and tool calling (all topics)
ollama pull nomic-embed-text # embeddings (rag)
ollama pull qwen3-vl:8b-instruct # only whatsapp-agent lab 09: reads photos and does the text steps there, about 6 GB
Check that they work:
ollama run qwen3:8b "Say hello in five words"
ollama show qwen3:8b # "Capabilities" should list tools
ollama list # both models should be listed
3. Python and uv¶
Tested with Python 3.14. Other versions from 3.10 up should mostly work but aren't tested; on 3.10 the LangGraph
labs (agents 07, multi-agent 07) fail. To match the tested setup without touching your system Python, let uv fetch it:
uv venv --python 3.14 in section 4.
uv is a fast package and venv manager (plain python -m venv and pip also work):
- macOS:
brew install uv - Linux / macOS:
curl -LsSf https://astral.sh/uv/install.sh | sh - Windows:
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
4. Project setup¶
One virtual environment, at the root (ai-learning/.venv), for every topic. Create it once, from the
ai-learning folder, never from inside a topic folder:
cd ai-learning # the repo root: README.md, requirements.txt and pyproject.toml are here
uv venv # creates ai-learning/.venv (uv venv --python 3.14 for the tested version)
source .venv/bin/activate # Windows: .venv\Scripts\activate. The prompt shows (ai-learning)
uv pip install -r requirements.lock # every topic's packages plus door/, the tested versions
Then cd into any topic and run its labs: the same venv serves them all. Activate it in every new terminal
(source ~/…/ai-learning/.venv/bin/activate works from any folder). When a topic adds a package, run
uv pip install -r requirements.lock again from the root.
Using VS Code? Open the ai-learning folder (File > Open Folder) and install the recommended Python extension
when asked. Guides open as rendered pages, and the root .venv is picked up. Open a lab, then Terminal > Run Task:
"Run this lab" (Cmd/Ctrl+Shift+B), "Run this lab on the fake model (no Ollama)", "Test this topic" or "Check my
setup". To edit a .md file, right-click its tab > Reopen Editor With > Text Editor.
requirements.lock pins every package (and their dependencies) to the versions the labs and CI were tested with, so
your results match the Expected output blocks. requirements.txt holds the loose ranges it's built from: installing
that instead also works, but you may get newer versions than were tested.
Got more than one venv? Clean up¶
A topic folder with its own .venv (the prompt shows (llm-api) or (rag) instead of (ai-learning)) has only that
topic's packages, so other labs fail with ModuleNotFoundError. Keep one:
deactivate # leave whichever venv is active
cd ai-learning
find . -name .venv -type d -prune -not -path ./.venv # lists the extra venvs, e.g. ./llm-api/.venv ./rag/.venv
rm -rf llm-api/.venv rag/.venv # delete the ones it listed (never ./.venv)
rm -rf .venv && uv venv # optional: start the root venv fresh too
source .venv/bin/activate
uv pip install -r requirements.lock # add '-e .[hosted]' too if you use a hosted model
pytest -q door # 11 passed, 1 skipped
Nothing in a venv is your work: it is only installed packages, so deleting one is always safe.
5. Verify¶
Start with the setup check: it prints OK, WARN or FAIL per item, with the fix.
python check_setup.py # Python, venv, packages, Ollama, models, one chat and one embedding call
pytest -q test_check_setup.py door # 20 passed, 1 skipped (30 passed once .[hosted] is installed)
cd python-basics && python 01_data_shapes.py && cd ..
cd llm-api && pytest -q && python tools.py "How many BOLT-M8-40 are in stock?" && cd ..
cd rag && pytest -q && python 03_ingest_and_search.py && cd ..
cd mcp-server && pytest -q && python 01_list_capabilities.py && cd ..
cd agents && pytest -q && cd ..
cd multi-agent && pytest -q && cd ..
cd rnr && pytest -q && python 00_generate_data.py && cd ..
cd whatsapp-agent && pytest -q && python 04_confirm_in_code.py && cd ..
Tests need no model. The tools.py run should print a 🔧 get_stock(...) line and an answer;
the RAG run should print {'added': 33, ...} and three search results per question;
the MCP run should list 7 tools, 3 resources plus 1 resource template, and 1 prompt; the agents and multi-agent tests should all pass, none skipped;
the whatsapp-agent run should print six button cases ending in "That cart is no longer open";
the RnR run should print the three planted stories (S03 48% late in October, B12 19/36 returned, 25 fake PVC reviews).
6. Use a hosted model (optional)¶
Every lab runs on Ollama by default. To run the same labs on OpenAI, Anthropic, Gemini, Groq or OpenRouter, change
two lines in .env; no code changes:
uv pip install -e '.[hosted]' # once: adds LiteLLM, pinned to the tested version
cp .env.example .env # then set LLM_MODEL and that provider's key
python -c "import door; print(door.describe())"
Step-by-step guide per provider, plus the rules on data, keys, cost and embeddings: providers/.
Troubleshooting¶
| Symptom | Fix |
|---|---|
ConnectionError / connection refused |
Ollama is not running. Start the app or run ollama serve. On a hosted model: check the network and LLM_MODEL. |
ModuleNotFoundError: No module named 'door' |
From the ai-learning folder: uv pip install -r requirements.lock |
Hosted models need LiteLLM |
uv pip install -e '.[hosted]' |
AuthenticationError (401) on a hosted model |
The provider's key is missing or wrong in .env (see providers/). |
RateLimitError (429) on a hosted model |
Free-tier limits. The door already waited up to DOOR_MAX_WAIT_S (120 s): wait a minute, run fewer reviews (--n 20), or use a paid key. |
CERTIFICATE_VERIFY_FAILED / self-signed certificate on a hosted model |
A company proxy (Netskope, Zscaler) re-signs HTTPS and Python doesn't trust it. Check with curl -sv https://generativelanguage.googleapis.com 2>&1 \| grep issuer. Netskope on a Mac: SSL_CERT_FILE="/Library/Application Support/Netskope/STAgent/data/nscacert_combined.pem" in .env. Otherwise build a bundle: mkdir -p ~/.certs, security find-certificate -a -p /Library/Keychains/System.keychain /System/Library/Keychains/SystemRootCertificates.keychain > ~/.certs/macos-roots.pem, then cat "$(python -m certifi)" ~/.certs/macos-roots.pem > ~/.certs/ca-bundle.pem and point SSL_CERT_FILE at it. Never turn verification off. |
model "qwen3:8b" not found or "nomic-embed-text" not found |
Run the matching ollama pull. |
"qwen3-vl:8b-instruct" not found, or "does not support images" |
ollama pull qwen3-vl:8b-instruct (update Ollama if the pull fails). VISION_MODEL must name a vision model, not qwen3:8b. |
| Very slow replies | The model may not fit in memory. Close other apps, or use the Low-RAM quick start. |
| Model ignores tools | Use a model whose ollama show output lists the tools capability. |
| RAG results look random after changing the chunker | Old vectors are still stored. Delete rag/store/ and run again (changing EMBED_MODEL is safe: one folder per model). |
No module named 'b2b_catalog' |
Run the mcp-server labs from the mcp-server folder. |
| MCP host hangs or reports invalid JSON | The server printed to stdout. On stdio, log to stderr only. |
| mcp-server lab 06: "Connection refused" | Start the HTTP server in a second terminal: cd mcp-server && python -m b2b_catalog.http_app. |
| Agents 06-07, multi-agent 05 and 07: "Port 8765 is used by another program" | Those labs start the catalog HTTP server in the background on port 8765. Set MCP_HTTP_PORT to a free port in .env or the shell. |
RnR: sqlite3.OperationalError: database is locked |
Another process holds a write (worker, a script, a DB browser). Close it or wait; rerunning 00_generate_data.py rebuilds the file. |
ModuleNotFoundError in a topic |
You're in a topic venv or none: activate ai-learning/.venv, run uv pip install -r requirements.lock from the root (section 4) |