Basics of AI & Agents Curriculum
Phase 0: Developer Tooling FundamentalsΒ·7 min read

Module 0.3

Python & JavaScript Environments

What are Runtime Environments?

A runtime is the engine that executes your code. Python code needs a Python interpreter. JavaScript code needs a Node.js runtime (or a browser). Before you can write a single line of agent code, these runtimes must be installed and configured correctly.

This module covers the environment management side β€” not the languages themselves, but the tooling around them: installing runtimes, managing packages, isolating projects from each other, and keeping everything reproducible.

Real-world usage: Every production AI system declares its exact dependencies. Anthropic's Claude SDK is a Python package installed via pip. LangChain, CrewAI, and every other agent framework are npm or pip packages. Getting the environment wrong means "works on my machine" bugs β€” the number one cause of wasted hours in software teams.

Key terms:

  • Runtime β€” the program that executes your code (python, node)
  • Package β€” a reusable library someone else wrote that you install into your project
  • Package manager β€” the tool that installs, updates, and removes packages (pip for Python, npm for JavaScript)
  • Virtual environment β€” an isolated bubble where packages are installed per-project, not globally

Python Setup

Installing Python:

Bash
# macOS (with Homebrew) brew install python # Ubuntu/Debian sudo apt install python3 python3-pip python3-venv # Windows # Download from python.org or: winget install Python.Python.3.12 # Verify python3 --version # or just 'python' depending on your system

A common watch-out: many systems have both python (pointing to Python 2) and python3 (Python 3). Always use python3 explicitly, or set up an alias. Python 2 reached end-of-life in January 2020 β€” avoid it for new projects.


Virtual Environments (Python)

For any project you plan to keep or share, a virtual environment (venv) is the right call.

Without a venv, every pip install dumps packages into a single global pile. Project A needs langchain==0.3.0 and Project B needs langchain==0.2.0? Conflict. Broken imports. Hours of debugging.

A virtual environment creates an isolated directory for each project's packages. Nothing leaks between projects.

Bash
# Create a venv python3 -m venv .venv # Activate it source .venv/bin/activate # Mac/Linux .venv\Scripts\activate # Windows # Your prompt changes to show you're inside the venv (.venv) $ pip install anthropic # Installs ONLY in this project # Deactivate when done deactivate

The mental model: Think of a venv as a sealed room. When activated, every pip install goes into that room. When you deactivate, you leave the room. Other projects can't see what's inside.

The .venv/ folder is local and should be in your .gitignore. It's not portable β€” you regenerate it from a requirements file.


pip and requirements.txt

pip is Python's package manager. It installs packages from PyPI (the Python Package Index β€” a public registry of 500,000+ packages).

Bash
pip install anthropic # Install a package pip install anthropic==0.43.0 # Install a specific version pip install -r requirements.txt # Install everything from a file pip list # Show installed packages pip freeze > requirements.txt # Export current packages to a file

The requirements.txt file is how you declare your project's dependencies:

txt
anthropic==0.43.0 langchain>=0.3.0,<0.4.0 python-dotenv==1.0.1

When someone clones your project, they run pip install -r requirements.txt and get the exact same packages. This is reproducibility.

Why it matters for agents: Agent projects have deep dependency trees. The Anthropic SDK, LangChain, vector databases, web frameworks β€” all installed via pip. If you don't manage versions carefully, a minor update to one library can break your entire agent.


Node.js and npm

Node.js is the JavaScript runtime for server-side code. It comes bundled with npm (Node Package Manager).

Bash
# Install Node.js (which includes npm) brew install node # macOS sudo apt install nodejs # Ubuntu (consider using nvm for version management) # Verify node --version npm --version

npm installs JavaScript packages from the npm registry (2 million+ packages):

Bash
npm init -y # Create a new project (generates package.json) npm install axios # Install a package npm install -D typescript # Install as dev dependency npm install # Install everything from package.json

package.json

The package.json file is Node.js's equivalent of requirements.txt β€” but richer. It declares your project's dependencies, scripts, and metadata:

JSON
{ "name": "my-agent", "version": "1.0.0", "scripts": { "start": "node index.js", "dev": "nodemon index.js", "build": "tsc" }, "dependencies": { "@anthropic-ai/sdk": "^0.33.0", "express": "^4.18.2" }, "devDependencies": { "typescript": "^5.3.0" } }

The scripts section is powerful β€” npm run dev executes nodemon index.js. It's how every Node project defines its commands.

The node_modules/ folder (where npm installs packages) is massive and should always be in .gitignore. It's regenerated by running npm install.

Why it matters: Many agent tools have TypeScript/JavaScript SDKs. The Claude API has an official TypeScript SDK. MCP servers are often built in TypeScript. You need to be comfortable in both ecosystems.


Python vs. Node.js: When to Use Which

Use CasePreferredWhy
AI/ML, data sciencePythonLibraries (PyTorch, NumPy, pandas) are Python-native
Agent backendsPythonClaude SDK, LangChain, CrewAI all Python-first
Web frontendsJavaScript/TypeScriptReact, Next.js, the browser
MCP serversTypeScriptOfficial MCP SDK is TypeScript
API serversEitherPython (FastAPI) or Node (Express) both work
Scripting/automationPythonCleaner syntax, better stdlib for file/text manipulation

In this curriculum, you'll use Python for most agent work and TypeScript for web interfaces and MCP servers. Both are essential.

Sources