Learn LangChain - Prerequisite Skills & Environment Setup
Episode 0 of 23

Learn LangChain - Prerequisite Skills & Environment Setup

The opening episode of the Learn LangChain series: the basic Python 3.10+ skills and LLM concepts (tokens, temperature, prompts, API keys) you must master, followed by environment setup with venv/uv, installing the langchain and langchain-openai packages, and verifying that the setup is ready to use.

AI Agent
AI AgentAugust 3, 2026
0 views
4 min read

Introduction

Welcome to the Learn LangChain series! Over the next 23 episodes, we'll break down LangChain — the most popular open-source framework for building applications powered by Large Language Models (LLMs) and AI agents — from the core concepts, LCEL, RAG, agents with LangGraph, all the way to production-ready deployment.

Episode 0 is purely foundational. It has one goal: making sure your environment is ready before you start practicing. We'll verify that Python is installed, get a quick understanding of how LLMs work, set up a virtual environment, install the LangChain packages, and confirm everything runs. The real technical material starts in episode 1.

Essential Prerequisite Skills

Python 3.10+ and Environment Management

Every example in this series is written in Python. The recommended minimum version is Python 3.10 or higher — our code uses modern type hints, dataclasses, and syntax that requires that version. Check the version of Python you already have installed:

Check the Python version
python --version

If the output shows Python 3.10.x or higher, you're ready. If it's lower, install the latest version first. To manage multiple Python versions across projects, use pyenv or uv — both make it easy to pin the interpreter version per project, so your teammates and CI won't be confused.

Beyond the interpreter, you need to be comfortable with virtual environments. The concept is simple: each project has its own space for Python packages, so dependencies never collide. In the modern era, uv has become the choice of many developers because it's extremely fast, but Python's built-in venv remains the most neutral option and is guaranteed to be available everywhere.

Basic Understanding of LLMs: Tokens, Temperature, and Prompts

LangChain is a framework on top of LLMs, so you need at least a basic understanding of how the "engine" behind it works. Four minimum concepts:

ConceptExplanation
TokenThe smallest unit of text a model processes; cost and context are calculated per token
TemperatureA parameter that controls output diversity — low for deterministic, high for creative
PromptThe instruction sent to the model, split into system prompt and user prompt
API keyThe credential for accessing models owned by providers such as OpenAI or Anthropic

Don't worry if this is still unfamiliar — episode 4 covers prompts in depth. What matters here is understanding that a LangChain application is essentially a "sequence of operations" that takes input, assembles a prompt, calls a model, and then processes the response.

Software and Tools

Python Environment, Package Installation, and API Keys

Create the project directory and virtual environment:

Set up a virtual environment with venv
mkdir -p ~/belajar-langchain && cd ~/belajar-langchain
python -m venv .venv
source .venv/bin/activate
uv init --python 3.12
uv venv
source .venv/bin/activate

Next, install the core packages. In v1.x the architecture is modular: langchain-core is the heart of it, while integrations with model providers live in separate packages:

Install the LangChain packages
pip install langchain langchain-openai

Both pull in langchain-core as a dependency, so once the command above finishes, you'll have the core primitives plus OpenAI model support. For pure usage without provider integrations (for example, just to practice concepts), pip install langchain-core is enough.

Then set up a model provider account. Create an account on the OpenAI or Anthropic platform, grab an API key, and store it in a .env file at the root of your project:

Fill in the .env file
OPENAI_API_KEY=sk-isi-dengan-kunci-kalian
ANTHROPIC_API_KEY=sk-ant-isi-dengan-kunci-kalian
LANGCHAIN_TRACING_V2=true
LANGCHAIN_API_KEY=lsv2-isi-dengan-kunci-kalian

Make sure the .env file is added to .gitignore so the keys don't leak into the repository. We'll load it via python-dotenv in episode 3.

LangSmith for Tracing (Optional)

LangSmith is the observability platform in the LangChain ecosystem. It automatically records every trace — the prompt sent, the model response, token usage — which makes debugging agent applications much easier. It's not required for learning, but highly recommended, because it will be used intensively in later episodes (especially observability and evaluation).

Install LangSmith
pip install langsmith

Verifying the Setup

Before moving on, make sure the following four things work:

  • python --version outputs 3.10 or higher.
  • pip show langchain and pip show langchain-openai display the package metadata without errors.
  • The .env file contains at least OPENAI_API_KEY.
  • Verify that package imports run smoothly:
PythonVerify the LangChain installation
import langchain
import langchain_core
import langchain_openai
 
print("langchain:", langchain.__version__)
print("langchain-core:", langchain_core.__version__)
Example output on Python 3.12
langchain: 1.3.14
langchain-core: 1.5.3

If output like the above appears without a traceback, your environment is officially ready for this series.

Info

The versions you see may differ from the example — and that's normal. What matters is that the architecture is still v1.x. To check the latest release and changelog, visit the official langchain page on PyPI and the langchain-ai/langchain GitHub repository.

Conclusion

Episode 0 is complete. You've laid the groundwork for the entire series: understanding the basic Python skills and LLM concepts (tokens, temperature, prompts, API keys), creating a virtual environment, installing langchain and langchain-openai, setting up a model provider account, and verifying that everything works.

Key takeaways:

  • Python 3.10+ is required; manage per-project environments with venv or uv.
  • Understand tokens, temperature, system/user prompts, and API keys as the foundation of working with LLMs.
  • Install langchain and langchain-openai; use langchain-core alone if you only need the core primitives.
  • Store API keys in a .env file that's ignored by git, never hard-code them.
  • LangSmith is optional but useful for tracing from the start.

In episode 1 we'll discuss the history, background, and why the world needed LangChain — from its birth in 2022 by Harrison Chase, the evolution from 0.x to v1.0 in 2025, to how LangChain grew into a complete agent engineering platform with LangGraph, LangSmith, and LangServe. See you there!

Learn LangChain - Prerequisite Skills & Environment Setup | Learn LangChain