What You Will Set Up
Every exercise in this course runs in one folder on your computer,
~/multi-agent-practice, with its own Python environment. In this lesson you
create that folder, install the seven libraries the course uses at exactly
the versions the lessons were tested with, make the course's shared kit
package importable from every exercise, and run a script that checks
everything and tells you what to fix. You will also learn to recognise the
installation failures you are most likely to meet.
When you finish, the practice folder looks like this:
~/multi-agent-practice/
.venv/ the course's Python environment (never removed by cleanup)
kit/ shared code; lessons add one module at a time
data/ course-written data files, added by later lessons
<exercise>/ one folder per exercise, removed by that exercise's cleanup
Readiness Check
The course assumes you can already do the following. Try each one in a few minutes; the answers are in Answer and Reasoning. If several are hard, study Python first (for example with Python for AI and Machine Learning) before continuing.
-
Write a function
count_words(texts)that takes a dictionary of strings, such as{"a": "one two", "b": "three"}, and returns how many words each string has:{"a": 2, "b": 1}. -
A script ends with this traceback. Which line failed, and why?
Traceback (most recent call last): File "report.py", line 7, in <module> print(totals["A-1001"]) ~~~~~~^^^^^^^^^^ KeyError: 'A-1001' -
What does
json.loadsreturn for each of these strings, or what goes wrong?'{"ok": true}','[1, 2.5, null]','"done"',"{'ok': true}". -
What does this print?
from dataclasses import dataclass @dataclass class Ticket: ticket_id: str priority: int = 3 print(Ticket("T-7"))
Terminal Basics
You will type commands in a terminal: the Terminal app on macOS, any
terminal on Linux, and PowerShell on Windows. A few commands are all you
need. pwd (print working directory) shows which folder you are in;
ls (PowerShell: dir or ls) lists it; cd folder moves into a folder
and cd .. moves up one; mkdir -p a/b creates folders, including missing
parents (PowerShell's mkdir creates parents too). ~ means your home
folder; PowerShell accepts ~ and also $HOME. Commands in this course are
shown for macOS and Linux first, with the PowerShell form where it differs.
Choose a Python Version
The course supports Python 3.12, 3.13 and 3.14; it was planned on 3.13 and tested on all three. Check what you have:
python3 --version
On Windows, the Python launcher lists installed versions with py --list
and runs one with, for example, py -3.13. If you have none of the three,
install one from python.org (Windows and macOS) or your Linux distribution's
packages.
Two cases need care:
- Python 3.15 was released on 2026-10-09 (S32), but two packages that LangGraph needs, PyYAML and zstandard, do not yet publish ready-built versions ("wheels") for it (S33, S34). pip would try to compile them, and zstandard needs a C compiler, so the install usually fails. Use 3.14 or earlier for now.
- Intel Macs and Windows on Arm are not supported. A security library the
MCP SDK uses,
cryptography, publishes no wheel for them (S06), so pip would try to build it from source.
Supported computers are Apple-silicon Macs with macOS 11 or later, Linux on x86_64 or arm64, and Windows 10 or 11 on x64. The course needs about 1 GB of free disk space and no graphics card, account or payment.
Exercise: Build the Environment
Goal: create the practice folder and environment, install the pinned
libraries, make kit importable and pass check_setup.py.
Starting state: a supported Python and a terminal open in your home folder. Nothing else.
Effects: creates ~/multi-agent-practice with about 100 MB of
libraries, downloaded once from the Python Package Index (PyPI). This is the
only step in the core course that uses the network.
-
Create the folders and move into the practice folder:
mkdir -p ~/multi-agent-practice/kit ~/multi-agent-practice/data ~/multi-agent-practice/course-setup cd ~/multi-agent-practicePowerShell:
mkdir ~/multi-agent-practice/kit, ~/multi-agent-practice/data, ~/multi-agent-practice/course-setup cd ~/multi-agent-practice -
Create the environment with a supported Python. Replace
python3with the version you chose if needed, for examplepython3.13:python3 --version python3 -m venv .venvPowerShell, using the launcher:
py -3.13 -m venv .venv. -
Activate it. Activation makes
pythonandpipin this terminal mean the environment's own copies:source .venv/bin/activatePowerShell:
.venv\Scripts\Activate.ps1. If PowerShell refuses because running scripts is disabled, allow scripts you created for your own user withSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserand try again (S23). Your prompt now starts with(.venv). Each new terminal needs this activation step again. -
Save this as
requirements.txtin~/multi-agent-practice/course-setup:pytest==9.1.1 pydantic==2.14.1 langgraph==1.2.16 langgraph-checkpoint==4.3.0 langgraph-checkpoint-sqlite==3.1.2 langchain-core==1.6.12 mcp==2.3.0Then move into that folder, install the list and check the result:
cd ~/multi-agent-practice/course-setup python -m pip install -r requirements.txt python -m pip checkThe install takes one to five minutes, mostly downloading.
pip checkshould printNo broken requirements found.pip may also print a notice that a newer pip is available; it is harmless, and the course does not upgrade pip. -
Create the
kitpackage. A folder becomes a Python package when it has an__init__.pyfile. Save this askit/__init__.pyin your practice folder:"""Shared code for the Multi-Agent Systems and Workflow Orchestration course. Each module in this package is added by one lesson and not changed afterwards. """ -
Save this as
write_path_file.pyincourse-setup:"""Make the kit package importable from any folder inside this environment.""" import sys import sysconfig from pathlib import Path practice = Path.home() / "multi-agent-practice" if Path(sys.prefix).resolve() != (practice / ".venv").resolve(): sys.exit("Activate ~/multi-agent-practice/.venv first, then run this again.") target = Path(sysconfig.get_path("purelib")) / "multi_agent_practice.pth" target.write_text(str(practice) + "\n") print(f"wrote {target}") print(f"Python in this environment now also looks for packages in {practice}")Run it:
python write_path_file.py -
Save this as
check_setup.pyincourse-setup:"""Check the course environment and report what to fix.""" import os import sys from importlib.metadata import PackageNotFoundError, version from pathlib import Path EXPECTED = { "pytest": "9.1.1", "pydantic": "2.14.1", "langgraph": "1.2.16", "langgraph-checkpoint": "4.3.0", "langgraph-checkpoint-sqlite": "3.1.2", "langchain-core": "1.6.12", "mcp": "2.3.0", } TRACING_VARIABLES = ["LANGSMITH_TRACING", "LANGSMITH_TRACING_V2", "LANGCHAIN_TRACING", "LANGCHAIN_TRACING_V2"] problems = [] python = sys.version_info print(f"Python {python.major}.{python.minor}.{python.micro}") if not (3, 12) <= (python.major, python.minor) <= (3, 14): problems.append("use Python 3.12, 3.13 or 3.14") practice = Path.home() / "multi-agent-practice" inside = Path(sys.prefix).resolve() == (practice / ".venv").resolve() print(f"environment: {sys.prefix}") if not inside: problems.append("activate ~/multi-agent-practice/.venv first") for name, wanted in EXPECTED.items(): try: found = version(name) except PackageNotFoundError: found = "missing" print(f"{name:28} {found}") if found != wanted: problems.append(f"{name} should be {wanted}") try: import kit print(f"kit importable from {Path(kit.__file__).parent}") except ImportError: problems.append("kit is not importable: write the path file") tracing = [name for name in TRACING_VARIABLES if os.environ.get(name)] print("tracing variables set:", ", ".join(tracing) if tracing else "none") if tracing: problems.append("unset " + ", ".join(tracing)) if problems: print("NOT READY:") for problem in problems: print(" -", problem) sys.exit(1) print("READY")Run it:
python check_setup.pyOutput (illustrative: your paths and Python patch version will differ):
Python 3.13.0 environment: /Users/you/multi-agent-practice/.venv pytest 9.1.1 pydantic 2.14.1 langgraph 1.2.16 langgraph-checkpoint 4.3.0 langgraph-checkpoint-sqlite 3.1.2 langchain-core 1.6.12 mcp 2.3.0 kit importable from /Users/you/multi-agent-practice/kit tracing variables set: none READY
Success: the last line is READY. That means a supported Python, the
course environment active, all seven libraries at the tested versions,
kit importable, and no tracing variable set. If you see NOT READY, each
line under it names one thing to fix; When It Goes Wrong
explains them.
Why Seven Exact Versions
The == in each line pins an exact version. Agent libraries change quickly:
version 2 of the MCP Python SDK, for example, renamed its main server class
and added a new client (S09),
so code written for one version can fail on the next. Pinning means your
output matches the lessons. Five of the seven are libraries you will use
directly: pytest to test agents, pydantic to check what agents pass
to each other, LangGraph and its SQLite checkpointer for the
framework module, and the MCP SDK (S01 to S04,
S41). The other two, langgraph-checkpoint and
langchain-core, are libraries LangGraph itself uses whose behaviour shows
through in lessons (S45, S46). pip installs
about 55 further packages they depend on, at versions within the ranges these
seven allow.
How the Path File Works
Python finds packages by searching the folders listed in sys.path. Each
environment has a site-packages folder for installed libraries; Python's
sysconfig module calls it purelib (S78). When Python
starts, it reads any file in that folder whose name ends in .pth and adds
each line it contains to sys.path (S77).
write_path_file.py uses that rule:
target = Path(sysconfig.get_path("purelib")) / "multi_agent_practice.pth"
target.write_text(str(practice) + "\n")
It writes one line, the full path of your practice folder, into
multi_agent_practice.pth inside the environment. From then on, any Python
started from this environment can import kit, whichever exercise folder
you are in. A Python outside the environment never reads that file, so it
cannot see kit: the course's code stays in the course's environment. The
check at the top of the script refuses to run unless the course environment
is active, so the file cannot end up in the wrong Python by accident.
The alternative, setting the PYTHONPATH environment variable, would work
only in terminals where you remembered to set it. The path file is written
once and keeps working.
How check_setup.py Works
The script collects problems in a list instead of stopping at the first one, so one run tells you everything to fix.
sys.version_infogives the running Python's version; the comparison(3, 12) <= (major, minor) <= (3, 14)checks the supported range.sys.prefixis the folder of the environment that is running the script. Comparing its resolved path with~/multi-agent-practice/.venvshows whether the course environment is active.importlib.metadata.version(name)reads an installed package's version without importing it, and raisesPackageNotFoundErrorwhen it is not installed. Each version is compared with the pinned one.import kitsucceeds only if the path file works.- The four tracing variables are the ones the LangSmith client library (installed with LangGraph) reads to decide whether to send traces to LangSmith's service (S08). The course never sets them, so nothing is sent; the script reports them so you would notice if your terminal had them set from other work.
sys.exit(1)ends with a failure status when there are problems, so scripts and test tools can detect the failure as well as you.
When It Goes Wrong
| What you see | Cause | Fix |
|---|---|---|
python3: command not found (Windows: python opens the Microsoft Store) | No Python on the path | Install a supported Python; on Windows use the py launcher |
The virtual environment was not created successfully because ensurepip is not available | Debian and Ubuntu package venv separately | Install the package the message names, for example sudo apt install python3.13-venv, then repeat step 2 |
... cannot be loaded because running scripts is disabled on this system | PowerShell's execution policy | The Set-ExecutionPolicy command in step 3 |
NOT READY: - activate ~/multi-agent-practice/.venv first and packages missing | A different Python ran the script: the environment is not active in this terminal | Run step 3 again in this terminal |
Packages installed but check_setup.py says missing | You ran pip install instead of python -m pip install, and pip belongs to another Python | Use python -m pip, which always installs into the Python you name; python -m pip --version shows where |
Errors building zstandard, PyYAML or cryptography, or No matching distribution found | Python 3.15, an Intel Mac or Windows on Arm | Use Python 3.12 to 3.14 on a supported computer |
kit is not importable: write the path file | Step 6 not run, or run in another environment | Activate the environment and run write_path_file.py again |
tracing variables set: LANGSMITH_TRACING | Set in your shell by other work | Remove it for this course: unset LANGSMITH_TRACING (PowerShell: Remove-Item Env:LANGSMITH_TRACING) |
For example, with tracing switched on, the end of the report reads:
tracing variables set: LANGSMITH_TRACING
NOT READY:
- unset LANGSMITH_TRACING
Your Turn: Diagnose Three Failures
Each transcript below comes from a learner's terminal. For each one, name the cause and the fix before reading the answer.
-
$ pip install -r requirements.txt Successfully installed ... mcp-2.3.0 ... $ python check_setup.py mcp missing -
$ python --version Python 3.15.0 $ python -m pip install -r requirements.txt ... Building wheel for zstandard (pyproject.toml) ... error -
$ python check_setup.py ... kit is not importable: write the path file $ ls ~/multi-agent-practice/kit __init__.py
Reset and Clean Up
The environment, kit and data stay for the rest of the course. Only the
exercise folder can go. From the practice folder, this removes it after
checking where you are:
cd ~/multi-agent-practice
case "$PWD" in */multi-agent-practice) rm -rf course-setup ;; *) echo "not in the practice folder" ;; esac
PowerShell:
cd ~/multi-agent-practice
if ((Get-Location).Path -like "*multi-agent-practice") { Remove-Item -Recurse -Force course-setup }
If your environment is ever broken beyond repair, remove only .venv the same
way and repeat steps 2 to 7: kit and data are unaffected, and the path
file is written into the new environment by step 6. You can keep
check_setup.py somewhere safe and run it at the start of any lesson.
Check Your Understanding
- Why does the course say
python -m pip installrather thanpip install? - You open a new terminal tomorrow and run an exercise script. It fails with
ModuleNotFoundError: No module named 'kit'. What is the most likely cause, and why does it not mean the path file is missing? - Why would writing your practice folder's path into the
PYTHONPATHvariable be a weaker solution than the path file?
Answer and Reasoning
Readiness check.
-
One solution:
def count_words(texts): return {key: len(value.split()) for key, value in texts.items()}split()with no argument splits on any run of whitespace. -
Line 7,
print(totals["A-1001"]): the dictionarytotalshas no key"A-1001". The last line names the error type and the missing key; the line above it points at the failing expression. -
{'ok': True}(JSONtruebecomes PythonTrue);[1, 2.5, None];'done'(a JSON string on its own is valid); the last raisesjson.JSONDecodeError, because JSON requires double quotes around names. -
Ticket(ticket_id='T-7', priority=3): a dataclass generates a readable representation with each field, andprioritytakes its default.
Your turn.
pipon the path belongs to a different Python (often the system one), so the packages went there. Activate the environment and usepython -m pip install -r requirements.txt.- Python 3.15 has no ready-built zstandard wheel yet, so pip tried to compile it and failed. Create the environment with Python 3.12, 3.13 or 3.14.
- The package folder exists, but the path file is missing or in another
environment: Python does not search the practice folder. Activate the
course environment and run
python write_path_file.py.
Understanding check.
python -m pipruns the pip that belongs to that exact Python, so the packages go where that Python will look for them. A barepipmay belong to another installation.- The environment is not active in the new terminal, so
pythonis a different Python that never reads the course environment's path file. Activate the environment (step 3); the path file is still there. PYTHONPATHapplies only in terminals where it is set, and it applies to every Python started there, not just the course environment. The path file lives inside the environment, works in every terminal once it is activated, and affects nothing else.
References
- S01: PyPI, langgraph 1.2.16, S02: langgraph-checkpoint-sqlite 3.1.2, S03: mcp 2.3.0, S04: pytest 9.1.1, S41: pydantic 2.14.1, S45: langgraph-checkpoint 4.3.0, S46: langchain-core 1.6.12: the pinned versions, the latest on 2026-10-21.
- S06: PyPI, cryptography 50.0.2 files and S07: sqlite-vec 0.1.9 files: which platforms have ready-built wheels.
- S32: PEP 790, Python 3.15 release schedule, S33: PyYAML 6.0.3 files and S34: zstandard 0.25.0 files: why 3.15 is not supported yet.
- S24: PEP 693, S25: PEP 719, S26: PEP 745: security support for Python 3.12 to 3.14 until about October 2028, 2029 and 2030.
- S23: Python 3.13, venv: creating and activating environments, including PowerShell's execution policy.
- S77: Python 3.13, site and S78: sysconfig: path configuration files and the
purelibfolder. - S09: MCP Python SDK documentation, including What's new in v2: the renamed server class and the new client.
- S08: the installed langsmith 0.14.11 source (
langsmith/utils.py,tracing_is_enabled): tracing is off unless turned on.