Skip to content

LeelaKarthik-26/ReAct_Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– ReAct Agent β€” AI-Powered Personal Assistant

An end-to-end Agentic AI application built with the ReAct (Reason + Act) framework - capable of managing your Notion workspace (notes & calendar) and fetching real-time weather, all through a natural language chat interface. Deployed on AWS EC2 via Docker and automated with GitHub Actions CI/CD.


πŸ“Έ Preview

Chat Interface β€” Live on EC2

Chat Interface

GitHub Actions β€” CI/CD Pipeline

GitHub Actions


🧠 What is ReAct (Reason + Act)?

ReAct is a modern agentic AI paradigm that combines chain-of-thought reasoning with tool-use action loops. Instead of a single-shot LLM response, the agent follows a structured cognitive loop:

Thought  β†’  Action  β†’  Observation  β†’  Thought  β†’  Action  β†’ ... β†’ Final Answer
Step What happens
Thought The LLM reasons about what it needs to do next
Action It selects and calls the appropriate tool
Observation It receives the tool's output
Repeat It reasons again based on that output
Final Answer It synthesises everything into a natural language response

This approach allows the agent to break complex multi-step requests into individual tool calls, chain them together intelligently, and explain its reasoning β€” far beyond what a basic prompt-response LLM can achieve.


πŸ—‚οΈ Project Structure

ReAct_Agent/
β”‚
β”œβ”€β”€ agent/
β”‚   └── bot.py                  # Agent core: LLM + tool registration
β”‚
β”œβ”€β”€ api/
β”‚   └── server.py               # FastAPI server with /chat and /health endpoints
β”‚
β”œβ”€β”€ tools/
β”‚   β”œβ”€β”€ weather.py              # Weather tool (Open-Meteo API)
β”‚   β”œβ”€β”€ notion_notes.py         # Notes CRUD tools (Notion API)
β”‚   └── notion_calender.py      # Calendar CRUD tools (Notion API)
β”‚
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ index.html              # Chat UI frontend
β”‚   β”œβ”€β”€ style.css               # Styling
β”‚   └── script.js               # Frontend logic
β”‚
β”œβ”€β”€ utils/
β”‚   └── logger.py               # Structured application logger
β”‚
β”œβ”€β”€ assets/                     # Screenshots for documentation
β”œβ”€β”€ Dockerfile                  # Container build instructions
β”œβ”€β”€ docker-compose.yml          # Local container orchestration
β”œβ”€β”€ requirements.txt            # Python dependencies
β”œβ”€β”€ main.py                     # Application entrypoint
└── .github/workflows/
    └── deploy.yml              # GitHub Actions CI/CD pipeline

✨ Features

πŸ—’οΈ Notion Notes Management

Full CRUD operations on your Notion notes database via natural language:

Tool What it does
get_notes Fetch all notes β€” returns title and status (Pending / Done)
add_note Create a new note (defaulted to Pending status)
update_note_status Change a note's status to Pending or Done
delete_note Archive (remove) a note by title β€” partial match supported

Notion Notes


πŸ“… Notion Calendar Management

Full CRUD operations on your Notion calendar database:

Tool What it does
get_calendar_events(date) Fetch events for a specific date (YYYY-MM-DD)
get_all_calendar_events Fetch all events, sorted by date ascending
add_calendar_event Add event β€” auto-sets status to Upcoming or Done based on date
update_calendar_event Update any combination of name, date, time, or status

Valid calendar statuses: Upcoming Β· Done Β· Cancelled

Notion Calendar


🌀️ Real-Time Weather

Tool What it does
get_weather(city) Fetches current temperature for any city using the free Open-Meteo API β€” no API key required

The tool performs a two-step call: first geocodes the city name to coordinates, then fetches live weather data.


πŸ—οΈ Architecture

User (Browser)
    β”‚
    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         FastAPI Server           β”‚
β”‚   POST /chat   GET /health       β”‚
β”‚   Static UI served at  /        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        ReAct Agent Core          β”‚
β”‚  LLM: Groq (llama3-70b-8192)    β”‚
β”‚  Framework: LangGraph            β”‚
β”‚  create_react_agent()            β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚                    β”‚
       β–Ό                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Weather    β”‚    β”‚   Notion API         β”‚
β”‚  Tool       β”‚    β”‚  Notes + Calendar    β”‚
β”‚ (Open-Meteo)β”‚    β”‚  (REST v1 API)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key design decisions

  • LangGraph create_react_agent β€” handles the full Thought β†’ Action β†’ Observation loop automatically
  • @tool decorator β€” each tool is self-describing; the agent reads the docstring to decide when and how to use it
  • Global agent singleton β€” the agent is initialised once at FastAPI startup via @app.on_event("startup") for performance
  • Partial match search β€” note and calendar tools use Notion's contains filter so users don't need to type exact names
  • Auto-status on date β€” calendar tools automatically set Upcoming/Done based on whether the event date is in the future or past

πŸ› οΈ Tech Stack

Layer Technology
LLM Groq β€” ultra-fast inference
Agent Framework LangGraph β€” stateful agentic workflows
LLM Toolkit LangChain β€” tools, prompts, and chain abstractions
API Backend FastAPI β€” async Python REST API
API Server Uvicorn β€” ASGI server
Frontend Vanilla HTML / CSS / JavaScript
Data Sources Notion API Β· Open-Meteo
Containerization Docker + Docker Compose
Container Registry GitHub Container Registry (GHCR)
Cloud Hosting AWS EC2
CI/CD GitHub Actions
Package Manager uv β€” ultra-fast Python package installer
Logging Python logging with structured stdout formatter

πŸ”„ Agentic Workflow β€” Step by Step

Here's what happens when a user sends: "What are my pending notes and what's the weather in New York?"

1. User sends message via chat UI
   └─▢ POST /chat { "message": "..." }

2. FastAPI passes message to the ReAct agent

3. Agent THINKS:
   "I need to fetch notes AND weather. Two tool calls needed."

4. Agent ACTS β†’ calls get_notes()
   └─▢ Notion API returns: [{"note": "Buy groceries", "status": "Pending"}, ...]

5. Agent OBSERVES the result, THINKS again:
   "Got notes. Now fetch weather."

6. Agent ACTS β†’ calls get_weather("New York")
   └─▢ Open-Meteo API returns: {"city": "New York", "temp": 3.2, "unit": "C"}

7. Agent OBSERVES, THINKS:
   "I have all the information. I can now give a final answer."

8. Agent generates a natural language response combining both results

9. FastAPI returns { "response": "..." } to the browser

The entire loop is powered by LangGraph's prebuilt ReAct agent, which manages the state machine, tool dispatch, and response synthesis without any custom orchestration code.


🐳 Docker & Deployment

Local Development

# Clone the repo
git clone https://github.com/LeelaKarthik-26/ReAct_Agent.git
cd ReAct_Agent

# Create .env file (see Environment Variables section)
cp .env.example .env   # fill in your API keys

# Run with Docker Compose
docker-compose up --build

# Visit
open http://localhost:8000

Dockerfile Overview

FROM python:3.12-slim
WORKDIR /app
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
RUN pip install uv
COPY requirements.txt .
RUN uv pip install --system -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["python", "main.py"]
  • Uses python:3.12-slim for a minimal image footprint
  • Uses uv instead of pip for dramatically faster dependency resolution
  • Multi-stage-friendly structure (copy requirements before source for Docker layer caching)

βš™οΈ CI/CD Pipeline β€” GitHub Actions

Every push to master triggers the full pipeline automatically:

Push to master
    β”‚
    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Job 1: build-and-push      β”‚
β”‚  ─────────────────────────  β”‚
β”‚  1. Checkout code           β”‚
β”‚  2. Login to GHCR           β”‚
β”‚  3. Build Docker image      β”‚
β”‚  4. Push β†’ ghcr.io/...      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚  (needs: build-and-push)
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Job 2: deploy              β”‚
β”‚  ─────────────────────────  β”‚
β”‚  1. SSH into AWS EC2        β”‚
β”‚  2. docker stop old containerβ”‚
β”‚  3. docker pull new image   β”‚
β”‚  4. docker run with env varsβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Zero-downtime rolling deploy β€” the old container is stopped, removed, and replaced with the new image in under 30 seconds.


πŸ” Environment Variables

Variable Description
GROQ_API_KEY API key from console.groq.com
NOTION_API_KEY Notion integration token from notion.so/my-integrations
NOTION_NOTES_DB_ID ID of your Notion notes database
NOTION_CALENDAR_DB_ID ID of your Notion calendar database

⚠️ Never commit your .env file. It is listed in .gitignore.


πŸ“‘ API Endpoints

Method Endpoint Description
GET / Serves the chat UI (static frontend)
POST /chat Send a message to the agent
GET /health Health check β€” returns {"status": "ok"}

Chat Request / Response

// POST /chat
{
  "message": "What are my upcoming events this week?",
  "history": []
}

// Response
{
  "response": "You have 2 upcoming events this week: ..."
}

πŸ’‘ Example Conversations

User: "Add a note to call the dentist"
Agent: "Added note 'Call the dentist' with status Pending βœ…"

User: "What are my notes?"
Agent: "You have 3 notes:
  - Call the dentist (Pending)
  - Buy groceries (Pending)
  - Read LangGraph docs (Done)"

User: "Mark 'Buy groceries' as done"
Agent: "Updated note 'Buy groceries' status to Done βœ…"

User: "Schedule a team meeting on March 10th at 10:00"
Agent: "Added Event: 'Team meeting' at 10:00 on 2026-03-10 with status 'Upcoming' βœ…"

User: "What's the weather in London?"
Agent: "The current temperature in London is 8.4Β°C."

User: "Cancel the team meeting"
Agent: "Updated event 'Team meeting': status β†’ 'Cancelled' βœ…"

πŸš€ Getting Started (Without Docker)

# 1. Clone
git clone https://github.com/LeelaKarthik-26/ReAct_Agent.git
cd ReAct_Agent

# 2. Create virtual environment
python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate

# 3. Install dependencies
pip install uv
uv pip install -r requirements.txt

# 4. Set up .env with your API keys

# 5. Run
python main.py

# 6. Open browser
open http://localhost:8000

πŸ“š Key Concepts & References

Concept Reference
ReAct Prompting ReAct: Synergizing Reasoning and Acting in Language Models (Yao et al., 2022)
LangGraph Agents LangGraph Docs β€” Prebuilt ReAct Agent
Agentic Workflows Andrew Ng β€” Agentic Design Patterns
Notion API Notion Developers Documentation
Open-Meteo Open-Meteo Free Weather API

πŸ† Why This Project Stands Out

  • βœ… End-to-end production system β€” not a notebook demo; it's a containerised, deployed, live application
  • βœ… Real agentic reasoning β€” the agent dynamically decides which tools to call and in what order
  • βœ… Full CI/CD pipeline β€” code pushed to GitHub automatically builds, pushes to GHCR, and deploys to AWS
  • βœ… Clean tool architecture β€” each tool is a self-contained, documented, independently testable function
  • βœ… Real-world integrations β€” Notion API, Open-Meteo API, Groq LLM
  • βœ… Production patterns β€” structured logging, startup lifecycle hooks, error handling, graceful Docker restarts

πŸ‘€ Author

LeelaKarthik Devisetty
AI/ML Engineer Β· Building intelligent agentic systems

GitHub


Built with 🧠 LangGraph · ⚑ Groq · 🐳 Docker · ☁️ AWS EC2

About

End-to-end Agentic AI assistant built with ReAct (Reason+Act) framework. Manages Notion notes & calendar, fetches live weather via natural language. Deployed on AWS EC2 with Docker & GitHub Actions CI/CD.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors