Skip to content

Dakshin10/ReActFlow-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ReActFlow-Agent

Autonomous Multi-Agent AI Travel Intelligence Platform

Python LangGraph Groq Gradio ChromaDB Tavily License: MIT


ReActFlow-Agent is a production-grade, autonomous multi-agent system that researches, plans, and generates comprehensive, personalized travel itineraries β€” powered by LangGraph, Groq LLMs, RAG memory, and real-time web intelligence.


πŸš€ Quick Start Β· πŸ—οΈ Architecture Β· πŸ€– Agents Β· πŸ› οΈ Tools Β· πŸ’‘ Features Β· βš™οΈ Configuration


πŸ’‘ Features

🧠 Multi-Agent Orchestration

  • 7 specialized AI agents operating in sequence and parallel
  • LangGraph StateGraph with typed state and list reducers
  • Parallel research workers via Send() map-reduce
  • Supervisor feedback loop with autonomous retry logic

🌐 Real-Time Web Intelligence

  • Tavily Search β€” AI-optimized semantic web search
  • SerpAPI Google Search β€” organic results and snippets
  • Geolocation intelligence via Maps tool
  • Weather & budget context tools

πŸ’Ύ Persistent RAG Memory

  • ChromaDB vector store β€” semantic similarity retrieval
  • HuggingFace embeddings β€” all-MiniLM-L6-v2
  • Traveler profile persistence β€” JSON-based user model
  • Cross-session memory β€” personalization across queries

✨ Premium Gradio Dashboard

  • Live execution pipeline visualizer with animations
  • Streaming agent output β€” real-time node-by-node updates
  • Rich prose travel reports with Merriweather typography
  • Editable traveler profile with instant persistence

πŸ—οΈ Architecture

Architecture Diagram

Graph Execution Flow

User Query
    β”‚
    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 🧠 Planner  |────▢│ πŸ’Ύ Memory    │────▢│ πŸ‘€ Profile   β”‚
β”‚ Agent       β”‚      β”‚ Agent (RAG)  β”‚      β”‚ Agent        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚
                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
                              β”‚     Parallel Send()
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  🌐 Research Worker  Γ—  3 tasks    |
                    β”‚  [Tavily + SerpAPI + Maps]         β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                          β”‚ Merge + Reduce
                                          β–Ό
                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                              β”‚ 🧭 Supervisor Agent   β”‚
                              β”‚ approve / retry loop  β”‚
                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                          β”‚ approve
                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                          β”‚       πŸ“… Itinerary Agent      β”‚
                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                          β”‚
                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                          β”‚       πŸ“ Summarizer Agent     β”‚
                          β”‚  (saves to RAG memory)        β”‚
                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                          β”‚
                                          β–Ό
                              βœ…  Final Travel Report

Key Design Patterns

Pattern Implementation
Map-Reduce Send() dispatches N parallel research tasks; operator.add reducer merges results
State Typing Annotated[list, operator.add] on research_results, sources, agent_logs
Supervisor Loop Conditional routing with retry cap (max 2), decision moved into node not router
RAG Pipeline ChromaDB + HuggingFace embeddings for cross-session travel memory retrieval
Profile Extraction Groq structured output β†’ Pydantic UserProfile β†’ persisted JSON

πŸ–₯️ Interface Gallery

Here is a walk-through of the ReActFlow-Agent dashboard and execution workflow:

πŸ‘€ Traveler Profile Configuration

Set your travel style, preferred transportation, food preferences, and climate style. The profile is automatically persisted locally as a JSON model and retrieved to guide all subsequent agent routing and recommendations.

Traveler Profile

πŸ” Live Multi-Agent Research Execution

See the parallel agent execution live. As the planner node breaks down your query into independent tasks, parallel Groq research workers spin up, call Tavily/SerpAPI, and output live execution logs.

Live Research Execution

πŸ’Ύ Semantic RAG Memory Retrieval

Before planning, the system performs a semantic similarity search in ChromaDB. Relevant historical preferences and past itineraries are injected as custom context to provide context-aware planning across sessions.

RAG Memory Context

πŸ“… Rich Day-by-Day Itinerary

The agent designs structured daily modules for Morning, Afternoon, Evening, Food, Transport, and Budget details.

Day-by-Day Itinerary

πŸ“„ Final Consolidated Travel Report

The end product is a beautifully synthesized markdown document containing local weather advice, attraction logs, budgeting projections, packing lists, itineraries, and citations.

Consolidated Travel Report


πŸ€– Agents

🧠 Planner Agent

Model: llama-3.1-8b-instant

Decomposes the user's raw travel query into 3 focused research sub-tasks (capped to prevent TPM saturation). Uses structured output to return a TravelPlan with a tasks: list[str] field.

Input:  { "user_query": "Plan a 7-day budget trip to Japan..." }
Output: TravelPlan(tasks=["Japan budget accommodation", "Tokyo transport", "Food guide"])

πŸ’Ύ Memory Agent

Store: ChromaDB + sentence-transformers/all-MiniLM-L6-v2

Performs semantic similarity search against all previous travel sessions and returns relevant context to personalize the current run.

# Retrieval
memories = retrieve_memory(user_query)  # β†’ List[Document]

# Storage (after summarizer)
save_memory(f"User Query:\n{query}\n\nFinal Response:\n{response}")

πŸ‘€ Profile Agent

Model: llama-3.1-8b-instant

Extracts traveler preferences from the query and merges them into the persistent profile. Fields are deduplicated on lists and overwritten on scalars.

class UserProfile(BaseModel):
    budget_style:          str       # "budget" | "mid-range" | "luxury"
    preferred_transport:   str       # "train" | "flight" | "car"
    climate_preference:    str       # "cold" | "hot" | "temperate"
    travel_style:          str       # "adventure" | "backpacker" | "luxury"
    favorite_destinations: list[str] # ["Japan", "Italy"]
    food_preferences:      list[str] # ["local", "sushi"]

🌐 Research Workers (Parallel)

Model: llama-3.3-70b-versatile

Each worker independently searches Tavily + SerpAPI and synthesizes results into a ResearchResult with findings: list[str] and sources: list[Source]. Results are automatically merged via the operator.add LangGraph reducer β€” no manual aggregation needed.

Why 70B here? Smaller models (8B) fail to reliably call nested structured output schemas (ResearchResult containing List[Source]). The 70B model is essential for reliable tool-call generation.


🧭 Supervisor Agent

Model: llama-3.1-8b-instant

Quality-gates the research. Outputs approve or retry. Retry routes back to the Profile node for context re-enrichment. Hard cap at 2 retries prevents infinite loops.

class SupervisorDecision(BaseModel):
    decision: str   # "approve" | "retry"
    feedback: str   # Explanation for retry, or approval note

πŸ“… Itinerary Agent

Model: llama-3.3-70b-versatile

Generates a detailed day-by-day markdown itinerary from the merged research findings. Each day includes Morning / Afternoon / Evening / Food / Transport / Budget sections.


πŸ“ Summarizer Agent

Model: llama-3.3-70b-versatile

Synthesizes research findings, memories, itinerary, and sources into the final comprehensive travel report with all sections: Overview, Weather, Attractions, Food, Budget, Transport, Tips, Itinerary, and Sources. Saves the response to RAG memory for future sessions.


πŸ› οΈ Tools

Tool Description API
tavily_search AI-optimized semantic web search, returns clean structured results Tavily
serp_search Google organic search results + snippets via SerpAPI SerpAPI
maps_tool Geolocation, distance, and place data Geopy
weather_tool Weather context for destination planning β€”
budget_tool Budget estimation context β€”
clothing_tool Climate-based clothing recommendations β€”

πŸ“ Project Structure

ReActFlow-Agent/
β”‚
β”œβ”€β”€ app.py                    # Gradio dashboard + streaming runner
β”‚
β”œβ”€β”€ graph/
β”‚   └── workflow.py           # LangGraph StateGraph definition
β”‚
β”œβ”€β”€ agents/
β”‚   β”œβ”€β”€ planner_agent.py      # Task decomposition
β”‚   β”œβ”€β”€ profile_agent.py      # Preference extraction
β”‚   β”œβ”€β”€ research_agent.py     # Web research + synthesis
β”‚   β”œβ”€β”€ supervisor_agent.py   # Quality control + routing
β”‚   β”œβ”€β”€ itinerary_agent.py    # Day-by-day schedule generation
β”‚   β”œβ”€β”€ summarizer_agent.py   # Final report synthesis
β”‚   └── react_agent.py        # ReAct reasoning agent (base)
β”‚
β”œβ”€β”€ memory/
β”‚   β”œβ”€β”€ rag_memory.py         # Save + retrieve from ChromaDB
β”‚   β”œβ”€β”€ vector_store.py       # ChromaDB client initialization
β”‚   β”œβ”€β”€ profile_memory.py     # JSON profile load/save
β”‚   └── user_profile.json     # Persisted traveler profile
β”‚
β”œβ”€β”€ schemas/
β”‚   β”œβ”€β”€ research_schema.py    # ResearchResult + Source models
β”‚   β”œβ”€β”€ user_profile.py       # UserProfile Pydantic model
β”‚   └── state.py              # Shared state types
β”‚
β”œβ”€β”€ tools/
β”‚   β”œβ”€β”€ tavily_search.py      # Tavily web search tool
β”‚   β”œβ”€β”€ serp_search.py        # SerpAPI Google search tool
β”‚   β”œβ”€β”€ maps_tool.py          # Geolocation tool
β”‚   β”œβ”€β”€ browser_tool.py       # Web scraping (deprecated)
β”‚   β”œβ”€β”€ weather_tool.py       # Weather context tool
β”‚   β”œβ”€β”€ budget_tool.py        # Budget estimation tool
β”‚   └── clothing_tool.py      # Clothing recommendations
β”‚
β”œβ”€β”€ config/
β”‚   └── langsmith_config.py   # LangSmith tracing setup
β”‚
β”œβ”€β”€ prompts/
β”‚   └── prompts.py            # Shared prompt templates
β”‚
β”œβ”€β”€ images/                   # README assets
β”œβ”€β”€ .env                      # API keys (see below)
β”œβ”€β”€ .env.example              # Template
└── requirements.txt

πŸš€ Quick Start

1. Clone the Repository

git clone https://github.com/Dakshin10/ReActFlow-Agent.git
cd ReActFlow-Agent

2. Create Virtual Environment

python -m venv venv

# Windows
venv\Scripts\activate

# macOS / Linux
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure API Keys

Copy the example environment file and fill in your keys:

cp .env.example .env
# .env
GROQ_API_KEY=gsk_...           # https://console.groq.com
TAVILY_API_KEY=tvly-...        # https://tavily.com
SERPAPI_API_KEY=...            # https://serpapi.com
LANGCHAIN_API_KEY=lsv2_...     # https://smith.langchain.com (optional tracing)
LANGCHAIN_TRACING_V2=true
LANGCHAIN_PROJECT=ReActFlow-Agent

5. Launch the App

python app.py

Open http://127.0.0.1:7860 in your browser.


βš™οΈ Configuration

Model Strategy

Agent Model Reason
Planner llama-3.1-8b-instant Simple list output, fast
Profile llama-3.1-8b-instant Flat Pydantic schema, fast
Research llama-3.3-70b-versatile Nested structured output reliability
Supervisor llama-3.1-8b-instant Binary decision, fast
Itinerary llama-3.3-70b-versatile Long-form quality markdown
Summarizer llama-3.3-70b-versatile Comprehensive report quality

All agents have max_retries=6 for automatic Groq rate-limit backoff.

Tuning Parallelism

The planner is capped at 3 parallel research tasks by default to stay within Groq's free-tier TPM limits. Upgrade your Groq plan to increase this:

# graph/workflow.py β€” planner_node
tasks = result.tasks[:3]  # ← increase for paid tiers

🧩 LangGraph State Design

class GraphState(TypedDict):
    user_query:         str
    tasks:              list
    # operator.add reducer β€” safe parallel merge
    research_results:   Annotated[list, operator.add]
    sources:            Annotated[list, operator.add]
    agent_logs:         Annotated[list, operator.add]
    retrieved_memories: list
    supervisor_feedback:str
    retry_count:        int
    decision:           str
    itinerary:          str
    user_profile:       dict
    final_response:     str

Critical: Annotated[list, operator.add] is required on any key that receives writes from parallel Send() branches. Without it, LangGraph will deadlock or silently overwrite results.


πŸ› Known Issues & Fixes Applied

Issue Root Cause Fix
Graph freezes after research Missing operator.add reducer on research_results Added Annotated[list, operator.add] to all parallel keys
UserProfile 400 BadRequest Groq returning list[str] fields as plain str Added Field(description="MUST be an array...") to schema
Router state mutation state["retry_count"] += 1 inside a read-only router Moved to supervisor_node return dict
413 Request Too Large Browser scraping 15,000+ chars into LLM context Eliminated scraping; condensed to title+url+snippet only
429 TPM Rate Limit 17 parallel workers hitting Groq simultaneously Capped planner at 3 tasks
Model decommissioned llama3-8b-8192 removed from Groq Migrated to llama-3.1-8b-instant
Nested schema tool-call failure 8B model can't call ResearchResult + List[Source] reliably Research agent uses 70B model exclusively

πŸ—ΊοΈ Example Queries

Plan a 10-day budget winter trip to Japan for a solo college student who loves food and hiking
7-day luxury honeymoon in Maldives with underwater dining and spa experiences
3-day weekend budget city break in Amsterdam for two people who love museums and cycling
2-week backpacking route through Southeast Asia (Thailand, Vietnam, Cambodia) under $1500

πŸ“¦ Requirements

gradio
langchain
langgraph
langchain-core
langchain-community
langchain-groq
langchain-tavily
langsmith
tavily-python
python-dotenv
google-search-results
beautifulsoup4
requests
chromadb
langchain-chroma
sentence-transformers
langchain-huggingface
geopy
pydantic

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


Built with ❀️ using LangGraph · Groq · Gradio · ChromaDB

If you find this project useful, please consider giving it a ⭐

About

Autonomous multi-agent AI travel intelligence platform powered by LangGraph, Groq, RAG memory, parallel research agents, and real-time web intelligence.a

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages