# langchain-ai/executive-ai-assistant architecture

> Architecture diagram of the GitHub repository langchain-ai/executive-ai-assistant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/langchain-ai/executive-ai-assistant
- Repository: https://github.com/langchain-ai/executive-ai-assistant

## Overview

- Email flow: Gmail → Ingestion → Triage → Response Generation
- Calendar flow: Calendar API → Meeting Time Finder → Response Generation
- Reflection flow: Processing → Reflection System → Memory

- Configuration dependencies
- API service connections
- Authentication flows

##### Key Processing Modules (Orange Rectangles)
- triage.py (Email Classification)
- draft_response.py (Response Generation)
- find_meeting_time.py (Calendar Management)
- rewrite.py (Style/Tone Adjustment)
- fewshot.py (Example-based Learning)

a. Email Processing Flow
1. Email ingestion
2. Triage decision
3. Response drafting
4. Style adjustment
5. Delivery

b. Calendar Management Flow
1. Meeting request detection
2. Availability check
3. Time slot selection
4. Response generation

##### Infrastructure Components (Gray Containers)

a. Development Environment
- Local development server
- Testing infrastructure

b. Production Environment
- LangGraph Cloud deployment
- Cron job system

##### LangGraph integration
- How the system interfaces with LangGraph Cloud
- Cron_graph.py and reflection_graphs.py components

##### Configuration Management
- How config.yaml drives system behavior
- Credential management flow

##### Security Layer
- Where sensitive information is handled
- Authentication boundaries

##### Scalability Points
- Areas where the system can be extended
- Integration points for additional services

This system design should clearly communicate both the operational flow and the architectural decisions made in the EAIA project, while maintaining enough detail to be implementable but not so much as to be overwhelming.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Define styles
    classDef input fill:#a8d1f0,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef config fill:#FFE5B4,stroke:#333
    classDef external fill:#DDA0DD,stroke:#333
    classDef processing fill:#FFA07A,stroke:#333
    classDef infra fill:#D3D3D3,stroke:#333

    %% Input Layer
    subgraph InputLayer
        Gmail["Gmail Integration"]:::input
        Calendar["Calendar Integration"]:::input
        AgentInbox["Agent Inbox Interface"]:::input
    end

    %% Core Processing Layer
    subgraph CoreLayer
        EmailIngest["Email Ingestion System"]:::core
        Triage["Triage Engine"]:::core
        ResponseGen["Response Generation System"]:::core
        CalendarMgmt["Calendar Management System"]:::core
        Reflection["Reflection System"]:::core
    end

    %% Configuration & State Management
    subgraph ConfigLayer
        Config["Configuration System"]:::config
        Credentials["Credentials Management"]:::config
        Memory["Memory/State Management"]:::config
        Schema["Schema Definitions"]:::config
    end

    %% External Services
    subgraph ExternalServices
        OpenAI["OpenAI API"]:::external
        Anthropic["Anthropic API"]:::external
        GoogleServices["Google Services"]:::external
        LangGraph["LangGraph Cloud"]:::external
    end

    %% Processing Modules
    subgraph ProcessingModules
        DraftResponse["Response Drafting"]:::processing
        MeetingTime["Meeting Time Finder"]:::processing
        Rewrite["Style/Tone Adjustment"]:::processing
        FewShot["Example-based Learning"]:::processing
        GraphMgmt["Graph Management"]:::processing
    end

    %% Infrastructure
    subgraph Infrastructure
        CronSystem["Cron Job System"]:::infra
        GmailSetup["Gmail Setup"]:::infra
    end

    %% Relationships
    Gmail --> EmailIngest
    Calendar --> CalendarMgmt
    EmailIngest --> Triage
    Triage --> ResponseGen
    CalendarMgmt --> ResponseGen
    ResponseGen --> Rewrite
    Rewrite --> Gmail
    Config --> CoreLayer
    Credentials --> ExternalServices
    CoreLayer --> Reflection
    Reflection --> Memory
    GraphMgmt --> LangGraph

    %% Click events
    click Gmail "https://github.com/langchain-ai/executive-ai-assistant/blob/main/eaia/gmail.py"
    click AgentInbox "https://github.com/langchain-ai/executive-ai-assistant/blob/main/eaia/main/human_inbox.py"
    click EmailIngest "https://github.com/langchain-ai/executive-ai-assistant/blob/main/scripts/run_ingest.py"
    click Triage "https://github.com/langchain-ai/executive-ai-assistant/blob/main/eaia/main/triage.py"
    click ResponseGen "https://github.com/langchain-ai/executive-ai-assistant/blob/main/eaia/main/draft_response.py"
    click CalendarMgmt "https://github.com/langchain-ai/executive-ai-assistant/blob/main/eaia/main/find_meeting_time.py"
    click Reflection "https://github.com/langchain-ai/executive-ai-assistant/blob/main/eaia/reflection_graphs.py"
    click Config "https://github.com/langchain-ai/executive-ai-assistant/blob/main/eaia/main/config.yaml"
    click GraphMgmt "https://github.com/langchain-ai/executive-ai-assistant/blob/main/eaia/main/graph.py"
    click Rewrite "https://github.com/langchain-ai/executive-ai-assistant/blob/main/eaia/main/rewrite.py"
    click FewShot "https://github.com/langchain-ai/executive-ai-assistant/blob/main/eaia/main/fewshot.py"
    click GmailSetup "https://github.com/langchain-ai/executive-ai-assistant/blob/main/scripts/setup_gmail.py"
    click CronSystem "https://github.com/langchain-ai/executive-ai-assistant/blob/main/scripts/setup_cron.py"
    click Schema "https://github.com/langchain-ai/executive-ai-assistant/blob/main/eaia/schemas.py"

    %% Legend
    subgraph Legend
        Input["Input Layer"]:::input
        Core["Core Processing"]:::core
        Conf["Configuration"]:::config
        Ext["External Services"]:::external
        Proc["Processing Modules"]:::processing
        Inf["Infrastructure"]:::infra
    end
```
