Prepare your computer to create professional AI Agents with the right tools.

Installing Python and Required Packages

Python is the standard language for AI. Here’s how to install it correctly:

Step 1: Download Python

Visit python.org and download version 3.8 or later (recommended: 3.11).

🔹 Important: Check the "Add Python to PATH" option during installation (Windows).

Step 2: Verify Installation

Open the terminal (or Command Prompt) and type:

python --version

The output should be something like: Python 3.11.4

Step 3: Install Essential Packages

Run the following command in the terminal:

pip install openai langchain jupyter pandas numpy

📌 Package Descriptions:

  • 🧠 openai: Integrates models like GPT-4.

  • 🔗 langchain: Framework for building AI Agents.

  • 📊 pandas: Data manipulation.

  • 🔢 numpy: Mathematical operations.

  • 📖 jupyter: Interactive development environment.

Creating a Virtual Environment

Virtual environments isolate dependencies between projects, preventing conflicts.

Step 1: Create the Environment

Navigate to your project folder in the terminal and run:

python -m venv my_agent

(Substitute my_agent with your project name.)

Step 2: Activate the Environment

Windows:

.\my_agent\Scripts\activate

macOS/Linux:

source my_agent/bin/activate

You’ll see (my_agent) in the terminal, indicating the environment is active.

Step 3: Install Dependencies

With the virtual environment active, install the packages again:

pip install openai langchain jupyter pandas numpy

Introduction to Jupyter Notebook

Jupyter Notebook is ideal for prototyping and quick experimentation.

Step 1: Start Jupyter

With the virtual environment active, run:

jupyter notebook

Your browser will automatically open with the Jupyter interface.

Step 2: Create a New Notebook

Click New > Python 3.

In the first cell, test a simple script:

print("My first AI Agent is alive! 🤖")

Press Shift + Enter to run.

💡 Pro Tip: Use Jupyter for:

  • 📝 Testing OpenAI prompts.

  • 📊 Visualizing data with pandas.

  • 📜 Documenting code with Markdown cells.

Introduction to VS Code

VS Code is the most popular editor for Python. Essential setup:

Step 1: Install VS Code

Download it from code.visualstudio.com.

Step 2: Install Useful Extensions

🔹 Python (official Microsoft extension)
🔹 Jupyter (to run code cells directly in the editor)
🔹 Code Runner (quick script execution)

Step 3: Configure the Python Interpreter

Open the command palette (Ctrl + Shift + P) and type:

Python: Select Interpreter

Select the virtual environment interpreter (e.g., my_agent/bin/python).

Example Usage

Create a file agent.py and add:

from langchain.llms import OpenAI  

llm = OpenAI(api_key="your-api-key")  
response = llm("Explain quantum computing in one sentence.")  
print(response)

Run it with F5 or via the terminal.

Testing the Setup

To ensure everything works:

✅ Activate the virtual environment.
✅ Open VS Code or Jupyter.
✅ Run the example code (replace your-api-key with an OpenAI API key).
✅ If you get a coherent response, you're ready!

Common Troubleshooting

⚠️ "Python not found" error: Check PATH settings in Windows or reinstall Python with the correct option.
⚠️ Unrecognized packages: Ensure the virtual environment is active.
⚠️ VS Code issues: Restart the editor after installing extensions.