# thamilarasan777/trip-planner-using-crewai architecture

> Architecture diagram of the GitHub repository thamilarasan777/trip-planner-using-crewai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thamilarasan777/trip-planner-using-crewai
- Repository: https://github.com/thamilarasan777/trip-planner-using-crewai

## Overview

##### Project type and purpose
- This is a Python-based, AI-powered “Trip Planner” application combining three interfaces:
- A command-line interface (cli_app.py)
- A REST API (api_app.py using FastAPI/uvicorn)
- A web UI (streamlit_app.py using Streamlit)
- Under the hood it uses the CrewAI framework (trip_agents.py + trip_tasks.py + tools/*) to orchestrate LLM-driven agents and tools (e.g., browser automation, web search, calculator).

##### File structure
- Top-level interfaces:
- cli_app.py
- api_app.py
- streamlit_app.py
- Core orchestration:
- trip_agents.py (agent creation & management)
- trip_tasks.py (task definitions and prompts)
- tools/ (browser_tools.py, search_tools.py, calculator_tools.py)
- Config & docs:
- .streamlit/config.toml & secrets.toml (for API keys)
- requirements.txt, .env.example, README.md, flow_diagram.txt

##### Key insights from the README
- Users supply trip parameters (origin, destination, dates, preferences).
- CrewAI agents coordinate via defined tasks to build an itinerary.
- External dependencies:
- LLM providers (OpenAI/Gemini, Ollama)
- Browserless (for headless browsing)
- Serper.dev (for web search)

##### Main components
- CLI Client (cli_app.py)
- REST API (api_app.py + uvicorn)
- Streamlit UI (streamlit_app.py)
- TripAgents module
- TripTasks definitions
- Tools library (browser, search, calculator)
- LLM Providers (Gemini/OpenAI API or Ollama local server)
- Browserless.io
- Serper.dev
d. Infrastructure / Platform
- Python runtime & dependencies

##### Relationships & Data Flows
- “User input: trip params”
- From Task Engine / Tool Executor → External Services
- LLM API calls
- Browserless sessions
- Serper search requests
- Responses flow back upstream, culminating in “Itinerary result” → UI / CLI / API response.

##### Architectural patterns & design principles
- Layered architecture:
- Presentation layer (CLI, API, Web UI)
- Business logic layer (CrewAI orchestration)
- Integration layer (tools + external services)
- Separation of concerns: each interface is thin; all planning logic lives in TripAgents + tasks + tools.
- Extensibility: new tools/agents can be dropped into tools/ or trip_tasks.py.

##### Technology callouts
- Python 3.x
- Streamlit for web front end
- FastAPI + uvicorn for REST API
- CrewAI SDK for agent orchestration
- OpenAI/Gemini or Ollama for LLM calls
- Browserless.io + Serper.dev as specialty tool backends

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        direction TB
        CLI["CLI Client"]:::interface
        API["REST API"]:::interface
        Streamlit["Streamlit UI"]:::interface
    end

    subgraph "Business Logic Layer"
        direction TB
        AgentMgr["Agent Manager"]:::core
        TaskEngine["Task Engine"]:::core
        ToolExec["Tool Executor"]:::core

        subgraph "Tools Library"
            direction TB
            BrowserTool["Browser Tool"]:::core
            SearchTool["Search Tool"]:::core
            CalcTool["Calculator Tool"]:::core
        end
    end

    subgraph "External Services"
        direction TB
        LLM["LLM Providers"]:::external
        Browserless["Browserless.io"]:::external
        Serper["Serper.dev"]:::external
    end

    subgraph "Infrastructure / Platform"
        direction TB
        Python["Python Runtime & Deps"]:::infra
        Config[".streamlit/config.toml"]:::infra
        Env[".env.example"]:::infra
        Requirements["requirements.txt"]:::infra
        README["README.md"]:::infra
        FlowDiagram["flow_diagram.txt"]:::infra
    end

    %% Data Flows
    CLI -->|"User input: trip params"| AgentMgr
    API -->|"User input: trip params"| AgentMgr
    Streamlit -->|"User input: trip params"| AgentMgr

    AgentMgr -->|"orchestrates"| TaskEngine
    TaskEngine -->|"dispatch tasks"| ToolExec

    ToolExec -->|"uses"| BrowserTool
    ToolExec -->|"uses"| SearchTool
    ToolExec -->|"uses"| CalcTool

    BrowserTool -->|"browse session"| Browserless
    SearchTool -->|"search query"| Serper
    CalcTool -->|"compute"| Python

    ToolExec --> TaskEngine
    TaskEngine --> AgentMgr

    AgentMgr -->|"Itinerary result"| CLI
    AgentMgr -->|"Itinerary result"| API
    AgentMgr -->|"Itinerary result"| Streamlit

    %% Click Events
    click CLI "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/cli_app.py"
    click API "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/api_app.py"
    click Streamlit "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/streamlit_app.py"
    click AgentMgr "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/trip_agents.py"
    click TaskEngine "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/trip_tasks.py"
    click BrowserTool "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/tools/browser_tools.py"
    click SearchTool "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/tools/search_tools.py"
    click CalcTool "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/tools/calculator_tools.py"
    click Config "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/.streamlit/config.toml"
    click Env "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/.env.example"
    click Requirements "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/requirements.txt"
    click README "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/README.md"
    click FlowDiagram "https://github.com/thamilarasan777/trip-planner-using-crewai/blob/main/flow_diagram.txt"

    %% Styles
    classDef interface fill:#D0E6FF,stroke:#0366d6,stroke-width:1px;
    classDef core fill:#D0FFD0,stroke:#28a745,stroke-width:1px;
    classDef external fill:#FFD8A8,stroke:#d66f00,stroke-width:1px;
    classDef infra fill:#F0F0F0,stroke:#6a737d,stroke-width:1px;
```
