What does AI Agents and Jupyter using Anaconda even mean? What does artificial intelligence, spies, a planet and a snake have in common? Of course they all relate to computer technology and what’s happening now and where the future of IT is heading.
This article walks you through setting up a clean development environment using Anaconda Navigator and preparing to experiment with AI Agents using Jupyter Notebook. This document assumes you are familiar with at least one programming language, have already installed Anaconda Navigator on your computer. Here are the steps.
- Launch Anaconda Navigator
- Create a New Environment
- Activate the Environment and Open Terminal
- Work from the D: Drive (Optional)
- Launch Jupyter Notebook
Step 1: Launch Anaconda Navigator
Open Anaconda Navigator from your Start Menu (Windows) or Applications folder (macOS).
Step 2: Create a New Environment
- Click the Environments tab in the left sidebar.
- Click the Create button at the bottom of the list.
- Name your environment (e.g.,
ai_agent_sandbox). - Set Python version to 3.10 (recommended).
- Click Create and wait a moment for the environment to be built.
Step 3: Activate the Environment and Open Terminal
- In the Environments tab, select your new environment.
- Click the play ▶️ button next to it.
- Choose Open Terminal to launch a command-line interface within this environment.
Step 4: Work from the D: Drive (Optional)
If you prefer to store your code on a different drive (e.g., D:), do the following in the terminal:
- Type
D:and press Enter to switch drives. - Navigate to your desired folder, or create a new one:
mkdir Projects\AI_Agents
cd Projects\AI_Agents
Step 5: Launch Jupyter Notebook
- From your working directory (now on D:), start Jupyter by typing:
jupyter notebook - Your default browser will open Jupyter rooted in your chosen folder.
An anaconda_projects folder may appear — this is normal and can be ignored unless you wish to delete it.
You are now ready to install libraries and begin experimenting with LangChain and AI Agents.
Now I’m sitting at the browser at http://localhost:8890/tree? and I see jupyter and a menu (file, view settings help) and under that I see two tabs (Files and Running). I’m in the files tab and in that window under the tab I see a folder icon and the one folder it created (anaconda_projects). We’re in the perfect position to create several AI Agent projects.You’re at the browser interface for Jupyter, rooted in your working directory. The anaconda_projects folder is just a default — you can ignore it or use it. You are free to create and organize your own folders.
How to Create Multiple AI Agent Projects
- Click the “New” button (top right).
- Select “Folder” to create a new folder.
- Rename the folder to something meaningful.
- Click into the folder, then click “New” > “Python 3 (ipykernel)” to create a new notebook inside it.
You Can Now…
- Create one .ipynb file per experiment
- Import shared utilities if needed (later you can organize with .py files)
- Keep things modular, like “Trip Planner Agent”, “Toolchain Demos”, “SDG Data Agent”, etc.
I’ve created that new folder inside jupyter. I notice that I see that folder in Windows File Explorer. I created a langchain_tests folder because it seemed most appropriate for just seeing if we could get this set up correctly.
Next Steps in Your langchain_tests Folder
Now that you’ve created your langchain_tests folder and confirmed it’s visible in Windows File Explorer, you’re ready to start testing your AI Agent setup. Here’s what to do next:
1. Create Your First Notebook
- Click into the
langchain_testsfolder in Jupyter. - Click the New button and select Python 3 (ipykernel).
- Rename the notebook to something like
test_agent.ipynb.
2. Install LangChain and OpenAI
In a Jupyter notebook cell or in the terminal, run the following to install the core packages:
!pip install langchain openai python-dotenv
Optional but recommended for using tools and integrations:
!pip install langchain-community
3. Test LangChain with a Simple Agent
You’re now ready to try a basic LangChain agent. For example:
- Load your OpenAI key from a
.envfile - Create an LLM-powered agent
- Try a question like: “What is sustainable farming?”
Bonus Tip: Keep Projects Organized
- Use one folder per concept (e.g.,
trip_planner_agent,pipeline_builder) - Include a
README.mdfile in each folder for notes or blog ideas - Download notebooks occasionally as backups: File > Download > .ipynb
Next Steps
✅ Rename the Notebook. Click Untitled at the top and rename it something like: test_agent _one.ipynb, or whatever you like. Where are we now. We’re in a great position because now we’re ready to dive in and start building and testing. By the way, Juyper is a great tool in my opinion. You can write python code and document it well all in the same file. When you explain your code, you can even format your explanations with section heading, bold, italics and so on. This is called markdown.
- Install packages
- Load your API keys
- Start testing LangChain tools and agents
A small starter snippet
First, paste this code into a Code cell and run it with the right arrow icon. It takes a moment as there are lots of things to install. To give you an idea, here below is waht was produced in the cell after I ran the following code.
!pip install langchain openai python-dotenv langchain-community
Since it’s a bit too much, I have moved it to the bottom of this post.
OpenAI
I have my own OpenAI account. I thinks it is about $20 USD per month. Because I have that I have an OpenAI key. Let’s set that up in our project.
🛡️ What is a .env file?
A .env file stores environment variables (like your API keys) so you don’t have to hard-code them into your Python scripts or notebooks. This keeps your secrets private and your code reusable.
Step-by-Step: Creating a .env File for Your OpenAI Key
This file securely stores your OpenAI API key so it can be accessed in your notebook without hard-coding it. Follow the steps below:
1. Create the file manually
Use Windows File Explorer to navigate to your langchain_tests folder.
- Right-click and choose New > Text Document
- Name it
.env(make sure there’s no.txtat the end) - Tip: You may need to enable “Show file extensions” in File Explorer
2. Add your OpenAI key
Paste the following into the .env file:
OPENAI_API_KEY=sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Replace the value with your actual key from OpenAI. Save and close the file.
3. Load the key in your notebook
In a Jupyter notebook cell, run this code to load your key:
import os
from dotenv import load_dotenv
load_dotenv() # Loads the .env file into environment variables
openai_key = os.getenv("OPENAI_API_KEY")
print("OpenAI Key Loaded:", bool(openai_key)) # Should print: True</code></pre>
This confirms that your key is loaded and ready to use. Do not print the full key — just check if it exists.
May need to install this:
!pip install langchain-openai
I got an error when I tried the code above starting with import os, however, after I ran the code starting with !pip install langchain-openai it worked! I saw OpenAI Key Loaded: True in Jupyter Notebook..
Why did I get an error? LangChain modularized their packages. So now: langchain-openai provides the OpenAI integrations. langchain is the core framework. This change happened mid-2024 and affects newer setups like yours.