# haeronpereira/acme-customer-support-agent architecture

> Architecture diagram of the GitHub repository haeronpereira/acme-customer-support-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/haeronpereira/acme-customer-support-agent
- Repository: https://github.com/haeronpereira/acme-customer-support-agent
- Video tour (about a minute): https://gitdiagram.com/haeronpereira/acme-customer-support-agent/video

## Overview

ACME Customer Support Agent serves support and sales users through a Streamlit interface and authenticated FastAPI API. The API routes chat requests through intent detection and the LangGraph agent, which selects native or MCP tools; business services retrieve or update customer-support data, and the agent returns a response with conversation state checkpointed in Redis. Separate capabilities include escalation summaries, role-based access, and operational logging. Relationships are based on the excerpts and README; some README-described integrations, including LangSmith, were not shown in source excerpts.

Main entry points: [`app/agent.py`](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/agent.py) (LangGraph agent), [`app/main.py`](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/main.py) (FastAPI API), [`app/skills/escalation_summary.py`](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/skills/escalation_summary.py) (Escalation summary), [`app/services/customer_service.py`](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/services/customer_service.py) (Customer services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_ui["Streamlit UI<br/>[streamlit_app.py]"]
end

subgraph group_api["API and access"]
  node_api_entry["FastAPI API<br/>[main.py]"]
  node_contracts["API schemas<br/>[schemas.py]"]
  node_authentication["JWT authentication<br/>[auth.py]"]
  node_authorization["Role access control<br/>[rbac.py]"]
  node_intent["Intent detection<br/>[intent_router.py]"]
end

subgraph group_agent["Agent workflow"]
  node_agent["LangGraph agent<br/>[agent.py]"]
  node_prompts["Agent prompts<br/>[prompts.py]"]
  node_state["Agent state<br/>[state.py]"]
  node_native_tools["Native tools<br/>[tools.py]"]
  node_mcp_client["MCP client<br/>[mcp_client.py]"]
  node_llm["Language model<br/>[llm.py]"]
end

subgraph group_business["Business capabilities"]
  node_mcp_server["MCP business tools<br/>[server.py]"]
  node_escalation["Escalation summary"]
  node_customer_service["Customer services"]
end

subgraph group_platform["Data and operations"]
  node_models["Business data models<br/>[models.py]"]
  node_database["Database sessions<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
  node_checkpointer["Redis checkpointing<br/>[checkpointer.py]"]
  node_redis[("Redis")]
  node_logging["Structured logging<br/>[logger.py]"]
end

node_user(("Support user"))
node_keycloak["Keycloak"]
node_langsmith["LangSmith"]

node_user -->|"uses"| node_ui
node_ui -->|"sends requests"| node_api_entry
node_api_entry -->|"validates identity"| node_authentication
node_authentication -->|"authenticates users"| node_keycloak
node_api_entry -->|"checks roles"| node_authorization
node_api_entry -->|"uses schemas"| node_contracts
node_api_entry -->|"detects intent"| node_intent
node_api_entry -->|"handles data requests"| node_customer_service
node_api_entry -->|"dispatches chat"| node_agent
node_intent -->|"classifies with"| node_llm
node_agent -->|"invokes"| node_llm
node_agent -->|"uses prompt"| node_prompts
node_agent -->|"tracks messages"| node_state
node_agent -->|"registers tools"| node_native_tools
node_agent -->|"loads tools"| node_mcp_client
node_mcp_client -->|"requests tools"| node_mcp_server
node_agent -->|"checkpoints state"| node_checkpointer
node_native_tools -->|"uses skill"| node_escalation
node_escalation -->|"retrieves support data"| node_customer_service
node_escalation -->|"generates summary"| node_llm
node_escalation -->|"opens session"| node_database
node_mcp_server -->|"calls services"| node_customer_service
node_mcp_server -->|"opens sessions"| node_database
node_customer_service -->|"queries models"| node_models
node_database -->|"connects to"| node_postgres
node_checkpointer -->|"stores checkpoints"| node_redis
node_api_entry -->|"records requests"| node_logging
node_agent -->|"records execution"| node_logging
node_agent -.->|"traces runs"| node_langsmith

click node_ui "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/frontend/streamlit_app.py"
click node_api_entry "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/main.py"
click node_contracts "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/schemas.py"
click node_authentication "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/auth.py"
click node_authorization "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/rbac.py"
click node_intent "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/intent_router.py"
click node_agent "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/agent.py"
click node_prompts "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/prompts.py"
click node_state "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/state.py"
click node_native_tools "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/tools.py"
click node_mcp_client "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/mcp_client.py"
click node_llm "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/llm.py"
click node_mcp_server "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/mcp_server/server.py"
click node_escalation "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/skills/escalation_summary.py"
click node_customer_service "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/services/customer_service.py"
click node_models "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/models.py"
click node_database "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/database.py"
click node_checkpointer "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/checkpointer.py"
click node_logging "https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/logger.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_user toneBlue
class node_api_entry,node_contracts,node_authentication,node_authorization,node_intent toneAmber
class node_agent,node_prompts,node_state,node_native_tools,node_mcp_client,node_llm toneMint
class node_mcp_server,node_escalation,node_customer_service toneRose
class node_models,node_database,node_postgres,node_checkpointer,node_redis,node_logging,node_keycloak,node_langsmith toneIndigo
```

## Components

### User experience

- [Streamlit UI](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/frontend/streamlit_app.py): `frontend/streamlit_app.py`

### API and access

- [FastAPI API](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/main.py): `app/main.py`
- [API schemas](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/schemas.py): `app/schemas.py`
- [JWT authentication](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/auth.py): `app/auth.py`
- [Role access control](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/rbac.py): `app/rbac.py`
- [Intent detection](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/intent_router.py): `app/intent_router.py`

### Agent workflow

- [LangGraph agent](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/agent.py): `app/agent.py`
- [Agent prompts](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/prompts.py): `app/prompts.py`
- [Agent state](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/state.py): `app/state.py`
- [Native tools](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/tools.py): `app/tools.py`
- [MCP client](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/mcp_client.py): `app/mcp_client.py`
- [Language model](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/llm.py): `app/llm.py`

### Business capabilities

- [MCP business tools](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/mcp_server/server.py): `mcp_server/server.py`
- [Escalation summary](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/skills/escalation_summary.py): `app/skills/escalation_summary.py`
- [Customer services](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/services/customer_service.py): `app/services/customer_service.py`

### Data and operations

- [Business data models](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/models.py): `app/models.py`
- [Database sessions](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/database.py): `app/database.py`
- **PostgreSQL**
- [Redis checkpointing](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/checkpointer.py): `app/checkpointer.py`
- **Redis**
- [Structured logging](https://github.com/haeronpereira/acme-customer-support-agent/blob/main/app/logger.py): `app/logger.py`

### Other components

- **Support user**
- **Keycloak**
- **LangSmith**

## Connections

- Support user → Streamlit UI: uses (evidence: `README.md`)
- Streamlit UI → FastAPI API: sends requests (evidence: `README.md`)
- FastAPI API → JWT authentication: validates identity (evidence: `app/main.py`)
- JWT authentication → Keycloak: authenticates users (evidence: `README.md`)
- FastAPI API → Role access control: checks roles (evidence: `app/main.py`)
- FastAPI API → API schemas: uses schemas (evidence: `app/main.py`)
- FastAPI API → Intent detection: detects intent (evidence: `app/main.py`)
- FastAPI API → Customer services: handles data requests (evidence: `app/main.py`)
- FastAPI API → LangGraph agent: dispatches chat (evidence: `app/main.py`)
- Intent detection → Language model: classifies with (evidence: `app/intent_router.py`)
- LangGraph agent → Language model: invokes (evidence: `app/agent.py`)
- LangGraph agent → Agent prompts: uses prompt (evidence: `app/agent.py`)
- LangGraph agent → Agent state: tracks messages (evidence: `app/agent.py`)
- LangGraph agent → Native tools: registers tools (evidence: `app/agent.py`)
- LangGraph agent → MCP client: loads tools (evidence: `app/agent.py`)
- MCP client → MCP business tools: requests tools (evidence: `app/mcp_client.py`)
- LangGraph agent → Redis checkpointing: checkpoints state (evidence: `app/agent.py`)
- Native tools → Escalation summary: uses skill (evidence: `app/tools.py`)
- Escalation summary → Customer services: retrieves support data (evidence: `app/skills/escalation_summary.py`)
- Escalation summary → Language model: generates summary (evidence: `app/skills/escalation_summary.py`)
- Escalation summary → Database sessions: opens session (evidence: `app/skills/escalation_summary.py`)
- MCP business tools → Customer services: calls services (evidence: `mcp_server/server.py`)
- MCP business tools → Database sessions: opens sessions (evidence: `mcp_server/server.py`)
- Customer services → Business data models: queries models (evidence: `app/services/customer_service.py`)
- Database sessions → PostgreSQL: connects to (evidence: `app/database.py`)
- Redis checkpointing → Redis: stores checkpoints (evidence: `app/checkpointer.py`)
- FastAPI API → Structured logging: records requests (evidence: `app/main.py`)
- LangGraph agent → Structured logging: records execution (evidence: `app/agent.py`)
- LangGraph agent → LangSmith: traces runs (evidence: `README.md`)
