A hands-on project to learn how to build a ReAct (Reasoning and Acting) agent. This project will guide you through creating an intelligent agent that can reason through problems and take actions step by step.
Before you begin, make sure you have:
- Python 3.11 installed on your system
- An OpenAI API key (we'll set this up in the setup guide below)
Follow these simple steps to get started:
-
Clone the repository:
git clone <repository-url> cd Ai-Upskilling-ReAct-Agent
-
Create and activate a virtual environment:
Option A: Using conda (if you have conda installed)
# Create conda environment conda create -n venv python=3.11 # Activate conda environment conda activate venv
Option B: Using venv (if you don't have conda)
# Create virtual environment python3.11 -m venv venv # Activate virtual environment # On Linux/Mac: source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up your API key:
Create a
.env
file in the project root:# Create .env file touch .env
Add your OpenAI API key to the
.env
file:OPENAI_API_KEY=your_openai_api_key_here
To get an OpenAI API key:
- Go to OpenAI Platform
- Sign up or log in to your account
- Click "Create new secret key"
- Copy the key and paste it in your
.env
file
-
Run the application:
streamlit run app.py
-
Open your browser:
- Go to
http://localhost:8501
- Select "agent" from the dropdown menu in the left sidebar
- Start building your AI agent!
- Go to
After running the application, you should see an interface similar to this:
The interface should show:
- A left sidebar with settings and data tables (Orders and Shipments)
- A chat interface on the right with sample conversation
- Dropdown menus for agent and user selection
- Pre-populated data in the tables
This project will teach you:
- How AI agents think and make decisions
- How to build tools that agents can use
- How to create interactive web interfaces for your agents
- How to handle different types of user questions
Once your agent is set up, you can ask questions like:
- "Where is my order #1234?"
- "What's the status of order #1235?"
- "Tell me about shipment #1001"
- "Is order #1236 delivered?"
- "Show me all orders for customer 1001"
- "What orders did customer 1001 place in September 2025?"
- User Input: User enters a question in the Streamlit interface
- Agent Reasoning: The ReAct agent analyzes the question and decides what action to take
- Tool Execution: Agent calls appropriate tools (get_order, get_shipment, etc.)
- Observation: Agent processes the tool results
- Iteration: Agent continues reasoning until it has enough information
- Final Answer: Agent provides a complete, grounded answer
- tools.py: Defines Pydantic schemas and tool functions
- agent.py: Implements the ReAct agent with LangChain integration
- app.py: Provides the Streamlit web interface
├── app.py # Web interface for your agent
├── agent.py # Your AI agent (starts with basic code)
├── tools.py # Tools your agent can use
├── requirements.txt # Python packages needed
└── README.md # This guide
The project starts with basic code that you'll build upon. As you progress through the learning modules, you'll:
- Add more capabilities to your agent
- Create new tools for different tasks
- Improve how your agent responds to users
- Learn best practices for AI agent development
If you run into any issues:
- Make sure you're using Python 3.11
- Check that your virtual environment is activated
- Verify your
.env
file has the correct API key - Ensure all dependencies are installed with
pip install -r requirements.txt