How liang6978/enterprise-serviceops-agent works
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: graph.py LangGraph agent · main.py FastAPI app · database.py Database service · api.py API router
Components 26
API and identity
- FastAPI app
app/main.py - API router
app/api/v1/api.py - Auth and sessions
app/api/v1/auth.py - Auth schemas
app/schemas/auth.py - Chat endpoints
app/api/v1/chatbot.py
Agent runtime
- LangGraph agent
app/core/langgraph/graph.py - Agent tools
app/core/langgraph/tools/__init__.py - Web search tool
app/core/langgraph/tools/duckduckgo_search.py - Human-in-loop tool
app/core/langgraph/tools/ask_human.py - LLM service
app/services/llm/service.py - LLM registry
app/services/llm/registry.py
State and memory
- Database service
app/services/database.py - Session model
app/models/session.py - Long-term memory
app/services/memory.py - Cache service
app/core/cache.py - Session auto-naming
app/services/session_naming.py
Production operations
- Observability and limits
app/core/observability.py - Request middleware
app/core/middleware.py - Prometheus metrics
app/core/metrics.py - Structured logging
app/core/logging.py - Rate limiting
app/core/limiter.py
Evaluation
- Evaluation runner
evals/evaluator.py - Evaluation CLI
evals/main.py
Other components
- API user
- PostgreSQL
- OpenAI-compatible LLM
Connections 29
- API user → FastAPI app: sends requests
- FastAPI app → API router: mounts routes
app/main.py - API router → Auth and sessions: routes auth
app/api/v1/api.py - API router → Chat endpoints: routes chat
app/api/v1/api.py - Auth and sessions → Auth schemas: uses schemas
app/api/v1/auth.py - Auth and sessions → Database service: manages users and sessions
app/api/v1/auth.py - Database service → Session model: persists sessions
app/services/database.py - Database service → PostgreSQL: reads and writes
app/services/database.py - Chat endpoints → LangGraph agent: invokes agent
app/api/v1/chatbot.py - Chat endpoints → Session auto-naming: may name session
app/api/v1/chatbot.py - Session auto-naming → LLM service: requests title
app/services/session_naming.py - Session auto-naming → Database service: updates session name
app/services/session_naming.py - LangGraph agent → LLM service: requests inference
app/core/langgraph/graph.py - LLM service → LLM registry: selects model
app/services/llm/service.py - LLM registry → OpenAI-compatible LLM: calls compatible API
- LangGraph agent → Agent tools: binds tools
app/core/langgraph/graph.py - Agent tools → Web search tool: registers tool
app/core/langgraph/tools/__init__.py - Agent tools → Human-in-loop tool: registers tool
app/core/langgraph/tools/__init__.py - LangGraph agent → Long-term memory: adds conversation memory
app/core/langgraph/graph.py - Long-term memory → Cache service: uses cache
app/services/memory.py - Long-term memory → PostgreSQL: persists vectors
- LangGraph agent → PostgreSQL: checkpoints state
app/core/langgraph/graph.py - FastAPI app → Cache service: initializes cache
app/main.py - FastAPI app → Request middleware: installs middleware
app/main.py - Request middleware → Prometheus metrics: records request metrics
app/core/middleware.py - Request middleware → Structured logging: binds request context
app/core/middleware.py - FastAPI app → Rate limiting: configures limits
app/main.py - LangGraph agent → Observability and limits: uses tracing
app/core/langgraph/graph.py - Evaluation CLI → Evaluation runner: runs evaluations
evals/main.py