How youngming044/skala-ai-service works
This is an ICT operations incident-support chat service. A user request enters the FastAPI backend, which selects a supervisor path: v2 routes ordinary chat directly or plans incident research, gathers monitoring/runbook information, may replan or analyze, then drafts and validates a response; v1 is a selectable legacy path. The backend also streams progress and stores conversation history in SQLite. MCP supplies monitoring, runbook, and diagnostic-prompt capabilities, while fake, Ollama, and OpenAI models provide interchangeable backends. Edges reflect the shown excerpts and explicit module documentation; unsampled details are omitted.
Main entry points: server.py FastAPI backend · mcp_client.py MCP client · graph.py Research tasks · deps.py Supervisor dependencies
Components 27
Chat service
- FastAPI backend
server.py
Supervisor workflow
- V2 graph
agent/graph.py - Route request
agent/graph.py - Direct chat
agent/graph.py - Plan incident
agent/graph.py - Task gate
agent/graph.py - Research tasks
agent/graph.py - Replan check
agent/graph.py - Pattern analysis
agent/graph.py - Draft answer
agent/graph.py - Validate draft
agent/graph.py - Finalize response
agent/graph.py - V1 supervisor
agent/supervisor_v1.py
Models and MCP
- Supervisor dependencies
agent/deps.py - Fake LLMs
agent/fake_llm.py - Ollama models
agent/ollama_llm.py - OpenAI models
agent/openai_llm.py - MCP client
agent/mcp_client.py - Operations MCP server
mcp_server.py - Docs MCP server
mcp_server_docs.py - Monitoring data
data/monitoring.json - Incident runbooks
data/runbooks
Conversation state
- SQLite session store
agent/session_store.py - Session database
agent/session_store.py
Other components
- User
- Ollama service
- OpenAI API
Connections 36
- User → FastAPI backend: sends request
server.py - FastAPI backend → V2 graph: builds graph
server.py - FastAPI backend → V1 supervisor: runs v1
server.py - FastAPI backend → MCP client: starts client
server.py - FastAPI backend → Supervisor dependencies: assembles dependencies
server.py - FastAPI backend → SQLite session store: creates store
server.py - FastAPI backend → Ollama models: selects backend
server.py - FastAPI backend → OpenAI models: selects backend
server.py - FastAPI backend → Fake LLMs: selects backend
server.py - V2 graph → Supervisor dependencies: injects dependencies
agent/graph.py - V2 graph → Route request: starts at
agent/graph.py - Route request → Direct chat: routes chat
agent/graph.py - Route request → Plan incident: routes incident
agent/graph.py - Plan incident → Task gate: checks tasks
agent/graph.py - Task gate → Research tasks: dispatches tasks
agent/graph.py - Research tasks → Replan check: checks coverage
agent/graph.py - Replan check → Research tasks: adds gap tasks
agent/graph.py - Replan check → Pattern analysis: continues when sufficient
agent/graph.py - Pattern analysis → Draft answer: supplies findings
agent/graph.py - Draft answer → Validate draft: submits draft
agent/graph.py - Validate draft → Draft answer: requests revision
agent/graph.py - Validate draft → Finalize response: accepts draft
agent/graph.py - Direct chat → Finalize response: returns answer
agent/graph.py - Direct chat → Supervisor dependencies: calls fast model
agent/graph.py - Plan incident → MCP client: gets procedure prompt
agent/graph.py - Research tasks → MCP client: finds runbook resource
agent/graph.py - MCP client → Operations MCP server: launches subprocess
agent/mcp_client.py - MCP client → Docs MCP server: launches subprocess
agent/mcp_client.py - Operations MCP server → Monitoring data: reads status data
mcp_server.py - Operations MCP server → Incident runbooks: reads runbook
mcp_server.py - SQLite session store → Session database: reads and writes
agent/session_store.py - FastAPI backend → SQLite session store: loads and appends history
server.py - Ollama models → Ollama service: sends model requests
agent/ollama_llm.py - OpenAI models → OpenAI API: sends API requests
agent/openai_llm.py - V1 supervisor → MCP client: calls monitoring tool
agent/supervisor_v1.py - V1 supervisor → Supervisor dependencies: uses dependencies
agent/supervisor_v1.py