# mftnakrsu/travel_ai_agent_autogen architecture

> Architecture diagram of the GitHub repository mftnakrsu/travel_ai_agent_autogen, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mftnakrsu/travel_ai_agent_autogen
- Repository: https://github.com/mftnakrsu/travel_ai_agent_autogen

## Overview

##### Project Type & Purpose
- Full-stack Python application with a Streamlit-based UI (frontend) and a modular multi-agent orchestration layer (backend).

##### Key File-Structure Clues
- main3.py / main4.py: Streamlit entrypoints + Autogen orchestration
- agents/: Individual agent modules (User_Proxy, Destination_Expert, Itinerary_Creator, Budget_Analyst, Report_Writer)
- chat/: GroupChat orchestration (group.py, manager.py)
- tools/: External-tool integration (tavily_search.py)
- config/: LLM configuration (llm_config.py)
- Dockerfile / .env: containerization + API-key management

##### Main Components
A. Frontend UI
- Streamlit app (main3.py)
- User input forms & result views (pie chart, download link)
B. Orchestrator Layer
- chat/Manager and chat/Group: builds and manages the multi-agent conversation
1. User_Proxy_Agent
2. Destination_Expert
3. Itinerary_Creator
4. Budget_Analyst
5. Report_Writer
D. Tools Module
- TavilySearch tool (tools/tavily_search.py)
- Matplotlib (for budget pie chart)
E. Configuration
- LLM settings (config/llm_config.py)
- Environment variables (.env)
F. External Services
- OpenAI API
- Tavily (or Bing/SerpAPI)

##### Relationships & Data Flow
1. User → Streamlit UI
2. UI invokes Orchestrator (chat.Manager)
3. Manager instantiates GroupChat, sequences:
User_Proxy → Destination_Expert → Itinerary_Creator → Budget_Analyst → Report_Writer
4. Each agent may call:
- LLM via config
- TavilySearch tool
5. Budget_Analyst generates pie chart (Matplotlib)
6. Report_Writer compiles `.txt` report
7. Final result → UI for display/download

##### Architectural Patterns & Principles
- Modular “pipeline” pattern: sequence of single-responsibility agents
- Dependency-inversion: agents call abstracted LLM and tool interfaces from config/ tools modules
- Separation of concerns: UI vs orchestration vs business-logic agents vs external integrations

##### Essential Elements
- Component labels + source file paths

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend UI Layer
    subgraph "Frontend UI"
        direction TB
        UI["Streamlit App (main3.py)"]:::ui
        UI2["Alternate Entrypoint (main4.py)"]:::ui
    end

    %% Backend Layer
    subgraph "Backend"
        direction TB

        subgraph "Orchestrator"
            direction TB
            M["Manager (chat/manager.py)"]:::orch
            G["GroupChat (chat/group.py)"]:::orch
        end

        subgraph "Agents Pipeline"
            direction TB
            UP["User_Proxy (agents/user_proxy.py)"]:::agent
            DE["Destination_Expert (agents/destination_expert.py)"]:::agent
            IC["Itinerary_Creator (agents/itinerary_creator.py)"]:::agent
            BA["Budget_Analyst (agents/budget_analyst.py)"]:::agent
            RW["Report_Writer (agents/report_writer.py)"]:::agent
        end

        MP["Matplotlib (chart)"]:::tool
        T["TavilySearch Tool (tools/tavily_search.py)"]:::tool
        C["LLM Config (config/llm_config.py)"]:::tool
        Env[".env + Dockerfile"]:::tool
    end

    %% External Services Layer
    subgraph "External Services"
        direction TB
        OAI["OpenAI API"]:::ext
        Tav["Tavily / Bing / SerpAPI"]:::ext
    end

    %% Data Flows
    UI -->|"start planning"| M
    UI2 -->|"start planning"| M
    M -->|"init pipeline"| G
    G --> UP
    UP --> DE
    DE --> IC
    IC --> BA
    BA --> RW
    RW -->|"report output"| UI

    %% Agent calls to config and tools
    UP -.->|"LLM request"| C
    DE -.->|"LLM request"| C
    IC -.->|"LLM request"| C
    BA -.->|"LLM request"| C
    RW -.->|"LLM request"| C

    DE -.->|"search query"| T
    IC -.->|"search query"| T
    BA -.->|"search query"| T

    BA -->|"renders chart"| MP
    C -.->|"uses"| OAI
    T -.->|"external search"| Tav
    Env -->|"provides keys"| C

    %% Click events
    click UI "https://github.com/mftnakrsu/travel_ai_agent_autogen/blob/main/main3.py"
    click UI2 "https://github.com/mftnakrsu/travel_ai_agent_autogen/blob/main/main4.py"
    click M "https://github.com/mftnakrsu/travel_ai_agent_autogen/blob/main/chat/manager.py"
    click G "https://github.com/mftnakrsu/travel_ai_agent_autogen/blob/main/chat/group.py"
    click UP "https://github.com/mftnakrsu/travel_ai_agent_autogen/blob/main/agents/user_proxy.py"
    click DE "https://github.com/mftnakrsu/travel_ai_agent_autogen/blob/main/agents/destination_expert.py"
    click IC "https://github.com/mftnakrsu/travel_ai_agent_autogen/blob/main/agents/itinerary_creator.py"
    click BA "https://github.com/mftnakrsu/travel_ai_agent_autogen/blob/main/agents/budget_analyst.py"
    click RW "https://github.com/mftnakrsu/travel_ai_agent_autogen/blob/main/agents/report_writer.py"
    click T "https://github.com/mftnakrsu/travel_ai_agent_autogen/blob/main/tools/tavily_search.py"
    click C "https://github.com/mftnakrsu/travel_ai_agent_autogen/blob/main/config/llm_config.py"
    click Env "https://github.com/mftnakrsu/travel_ai_agent_autogen/tree/main/Dockerfile"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0B69D5,color:#000
    classDef orch fill:#DFFFE0,stroke:#28A745,color:#000
    classDef agent fill:#DFFFE0,stroke:#28A745,color:#000
    classDef tool fill:#FFF2CC,stroke:#FF8C00,color:#000
    classDef ext fill:#E0E0E0,stroke:#6E6E6E,color:#000
```
