# liang6978/enterprise-serviceops-agent architecture

> Architecture diagram of the GitHub repository liang6978/enterprise-serviceops-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/liang6978/enterprise-serviceops-agent
- Repository: https://github.com/liang6978/enterprise-serviceops-agent

## Overview

This repository is a FastAPI backend template for stateful LangGraph agents. Users register or authenticate, create a session, and submit chat messages; the API invokes the agent and returns or streams a response. The graph uses an LLM and tools, persists conversation checkpoints, and schedules long-term memory updates. Separate capabilities provide session naming, evaluation, and production operations. Evidence is limited to the README and the supplied excerpts and source-index references; unsampled subsystem links are omitted or marked unverified.

Main entry points: [`app/core/langgraph/graph.py`](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/langgraph/graph.py) (LangGraph agent), [`app/main.py`](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/main.py) (FastAPI app), [`app/services/database.py`](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/services/database.py) (Database service), [`app/api/v1/api.py`](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/api/v1/api.py) (API router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_app["FastAPI app<br/>[main.py]"]
  node_routes["API router<br/>[api.py]"]
  node_auth["Auth and sessions<br/>[auth.py]"]
  node_auth_schemas["Auth schemas<br/>[auth.py]"]
  node_chat_api["Chat endpoints<br/>[chatbot.py]"]
end

subgraph group_agent["Agent runtime"]
  node_agent_graph["LangGraph agent<br/>[graph.py]"]
  node_tool_registry["Agent tools<br/>[__init__.py]"]
  node_search_tool["Web search tool"]
  node_human_tool["Human-in-loop tool<br/>[ask_human.py]"]
  node_llm_service["LLM service<br/>[service.py]"]
  node_llm_registry["LLM registry<br/>[registry.py]"]
end

subgraph group_state["State and memory"]
  node_database_service["Database service<br/>[database.py]"]
  node_session_model["Session model<br/>[session.py]"]
  node_memory[("Long-term memory<br/>[memory.py]")]
  node_cache[("Cache service<br/>[cache.py]")]
  node_session_naming["Session auto-naming<br/>[session_naming.py]"]
end

subgraph group_operations["Production operations"]
  node_operations["Observability and limits<br/>[observability.py]"]
  node_middleware["Request middleware<br/>[middleware.py]"]
  node_metrics["Prometheus metrics<br/>[metrics.py]"]
  node_logging["Structured logging<br/>[logging.py]"]
  node_limiter["Rate limiting<br/>[limiter.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_evaluation["Evaluation runner<br/>[evaluator.py]"]
  node_eval_entry["Evaluation CLI<br/>[main.py]"]
end

node_user(("API user"))
node_postgres[("PostgreSQL")]
node_llm_provider(("OpenAI-compatible LLM"))

node_user -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_routes
node_routes -->|"routes auth"| node_auth
node_routes -->|"routes chat"| node_chat_api
node_auth -->|"uses schemas"| node_auth_schemas
node_auth -->|"manages users and sessions"| node_database_service
node_database_service -->|"persists sessions"| node_session_model
node_database_service -->|"reads and writes"| node_postgres
node_chat_api -->|"invokes agent"| node_agent_graph
node_chat_api -->|"may name session"| node_session_naming
node_session_naming -->|"requests title"| node_llm_service
node_session_naming -->|"updates session name"| node_database_service
node_agent_graph -->|"requests inference"| node_llm_service
node_llm_service -->|"selects model"| node_llm_registry
node_llm_registry -.->|"calls compatible API"| node_llm_provider
node_agent_graph -->|"binds tools"| node_tool_registry
node_tool_registry -->|"registers tool"| node_search_tool
node_tool_registry -->|"registers tool"| node_human_tool
node_agent_graph -->|"adds conversation memory"| node_memory
node_memory -->|"uses cache"| node_cache
node_memory -.->|"persists vectors"| node_postgres
node_agent_graph -->|"checkpoints state"| node_postgres
node_app -->|"initializes cache"| node_cache
node_app -->|"installs middleware"| node_middleware
node_middleware -->|"records request metrics"| node_metrics
node_middleware -->|"binds request context"| node_logging
node_app -->|"configures limits"| node_limiter
node_agent_graph -.->|"uses tracing"| node_operations
node_eval_entry -->|"runs evaluations"| node_evaluation

click node_app "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/main.py"
click node_routes "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/api/v1/api.py"
click node_auth "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/api/v1/auth.py"
click node_auth_schemas "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/schemas/auth.py"
click node_chat_api "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/api/v1/chatbot.py"
click node_database_service "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/services/database.py"
click node_session_model "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/models/session.py"
click node_agent_graph "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/langgraph/graph.py"
click node_tool_registry "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/langgraph/tools/__init__.py"
click node_search_tool "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/langgraph/tools/duckduckgo_search.py"
click node_human_tool "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/langgraph/tools/ask_human.py"
click node_llm_service "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/services/llm/service.py"
click node_llm_registry "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/services/llm/registry.py"
click node_memory "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/services/memory.py"
click node_cache "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/cache.py"
click node_session_naming "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/services/session_naming.py"
click node_operations "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/observability.py"
click node_middleware "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/middleware.py"
click node_metrics "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/metrics.py"
click node_logging "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/logging.py"
click node_limiter "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/limiter.py"
click node_evaluation "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/evals/evaluator.py"
click node_eval_entry "https://github.com/liang6978/enterprise-serviceops-agent/blob/main/evals/main.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_app,node_routes,node_auth,node_auth_schemas,node_chat_api,node_user toneBlue
class node_agent_graph,node_tool_registry,node_search_tool,node_human_tool,node_llm_service,node_llm_registry,node_postgres toneAmber
class node_database_service,node_session_model,node_memory,node_cache,node_session_naming toneMint
class node_operations,node_middleware,node_metrics,node_logging,node_limiter toneRose
class node_evaluation,node_eval_entry,node_llm_provider toneIndigo
```

## Components

### API and identity

- [FastAPI app](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/main.py): `app/main.py`
- [API router](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/api/v1/api.py): `app/api/v1/api.py`
- [Auth and sessions](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/api/v1/auth.py): `app/api/v1/auth.py`
- [Auth schemas](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/schemas/auth.py): `app/schemas/auth.py`
- [Chat endpoints](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/api/v1/chatbot.py): `app/api/v1/chatbot.py`

### Agent runtime

- [LangGraph agent](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/langgraph/graph.py): `app/core/langgraph/graph.py`
- [Agent tools](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/langgraph/tools/__init__.py): `app/core/langgraph/tools/__init__.py`
- [Web search tool](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/langgraph/tools/duckduckgo_search.py): `app/core/langgraph/tools/duckduckgo_search.py`
- [Human-in-loop tool](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/langgraph/tools/ask_human.py): `app/core/langgraph/tools/ask_human.py`
- [LLM service](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/services/llm/service.py): `app/services/llm/service.py`
- [LLM registry](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/services/llm/registry.py): `app/services/llm/registry.py`

### State and memory

- [Database service](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/services/database.py): `app/services/database.py`
- [Session model](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/models/session.py): `app/models/session.py`
- [Long-term memory](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/services/memory.py): `app/services/memory.py`
- [Cache service](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/cache.py): `app/core/cache.py`
- [Session auto-naming](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/services/session_naming.py): `app/services/session_naming.py`

### Production operations

- [Observability and limits](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/observability.py): `app/core/observability.py`
- [Request middleware](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/middleware.py): `app/core/middleware.py`
- [Prometheus metrics](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/metrics.py): `app/core/metrics.py`
- [Structured logging](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/logging.py): `app/core/logging.py`
- [Rate limiting](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/app/core/limiter.py): `app/core/limiter.py`

### Evaluation

- [Evaluation runner](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/evals/evaluator.py): `evals/evaluator.py`
- [Evaluation CLI](https://github.com/liang6978/enterprise-serviceops-agent/blob/main/evals/main.py): `evals/main.py`

### Other components

- **API user**
- **PostgreSQL**
- **OpenAI-compatible LLM**

## Connections

- API user → FastAPI app: sends requests
- FastAPI app → API router: mounts routes (evidence: `app/main.py`)
- API router → Auth and sessions: routes auth (evidence: `app/api/v1/api.py`)
- API router → Chat endpoints: routes chat (evidence: `app/api/v1/api.py`)
- Auth and sessions → Auth schemas: uses schemas (evidence: `app/api/v1/auth.py`)
- Auth and sessions → Database service: manages users and sessions (evidence: `app/api/v1/auth.py`)
- Database service → Session model: persists sessions (evidence: `app/services/database.py`)
- Database service → PostgreSQL: reads and writes (evidence: `app/services/database.py`)
- Chat endpoints → LangGraph agent: invokes agent (evidence: `app/api/v1/chatbot.py`)
- Chat endpoints → Session auto-naming: may name session (evidence: `app/api/v1/chatbot.py`)
- Session auto-naming → LLM service: requests title (evidence: `app/services/session_naming.py`)
- Session auto-naming → Database service: updates session name (evidence: `app/services/session_naming.py`)
- LangGraph agent → LLM service: requests inference (evidence: `app/core/langgraph/graph.py`)
- LLM service → LLM registry: selects model (evidence: `app/services/llm/service.py`)
- LLM registry → OpenAI-compatible LLM: calls compatible API
- LangGraph agent → Agent tools: binds tools (evidence: `app/core/langgraph/graph.py`)
- Agent tools → Web search tool: registers tool (evidence: `app/core/langgraph/tools/__init__.py`)
- Agent tools → Human-in-loop tool: registers tool (evidence: `app/core/langgraph/tools/__init__.py`)
- LangGraph agent → Long-term memory: adds conversation memory (evidence: `app/core/langgraph/graph.py`)
- Long-term memory → Cache service: uses cache (evidence: `app/services/memory.py`)
- Long-term memory → PostgreSQL: persists vectors
- LangGraph agent → PostgreSQL: checkpoints state (evidence: `app/core/langgraph/graph.py`)
- FastAPI app → Cache service: initializes cache (evidence: `app/main.py`)
- FastAPI app → Request middleware: installs middleware (evidence: `app/main.py`)
- Request middleware → Prometheus metrics: records request metrics (evidence: `app/core/middleware.py`)
- Request middleware → Structured logging: binds request context (evidence: `app/core/middleware.py`)
- FastAPI app → Rate limiting: configures limits (evidence: `app/main.py`)
- LangGraph agent → Observability and limits: uses tracing (evidence: `app/core/langgraph/graph.py`)
- Evaluation CLI → Evaluation runner: runs evaluations (evidence: `evals/main.py`)
