How fuzzylabs/sre-agent works
Project type and purpose
• This is an open-source AI-powered Site Reliability Engineer “Agent” built as a collection of small services (Python & Node.js) running in containers.
• It orchestrates LLM calls, queries Kubernetes and GitHub via MCP servers, and pushes notifications into Slack.
• Main use case: you POST a “diagnose” request and the agent runs root-cause analysis across infra, code, and logs.
File structure
• Top-level:
– compose.*.yaml & Dockerfiles → multicloud container orchestration (AWS EKS, GKE).
– sre_agent/
· client, firewall, llm, prompt_server → Python-based “orchestrator” services (FastAPI & MCP orchestrator).
· servers/… → standalone MCP “tool” servers implemented in Node/TypeScript (GitHub, Kubernetes, Slack).
· shared → common schemas, logging utilities.
• docs/agent-architecture.md hints at data flows and service relationships.
• .github/workflows & Makefile → CI/CD pipelines to build and push container images.
README for additional insights
• Orchestrator service listens on port 8003 (FastAPI).
• Kubernetes MCP server listens on port 3001 (SSE for streaming logs).
• The agent uses the Model Context Protocol (MCP) to glide between LLM and tool invocations.
a. Python Orchestrator Layer
– client.py: Entry point, accepts /diagnose and /health via FastAPI.
– llm/main.py: Wraps LLM provider calls (Anthropic, Gemini).
– firewall/firewall.py: (Optional layer for request filtering/security).
– prompt_server/server.py: Generates prompts, context enrichment for LLM.
b. MCP Tool Servers
– GitHub Server (Node/TS): handles repo queries, searches, issues, pulls.
– Kubernetes Server (Node/TS): SSE endpoint for logs, kubectl/helm operations.
– Slack Server (Node/TS): sends messages & updates into Slack channels.
c. Shared Components
– shared/logger.py, shared/schemas.py: type definitions & logging conventions.
d. External Dependencies
– LLM Providers (Anthropic, Gemini) – HTTP APIs.
– AWS EKS or GCP GKE cluster – Kubernetes API.
– GitHub REST/GQL API.
– Slack Webhooks/API.
Relationships & data flow
1. Developer or CI triggers a POST to Orchestrator (/diagnose).
2. Orchestrator calls prompt_server to build the LLM prompt.
3. Orchestrator calls llm service → speaks to LLM provider endpoint.
4. LLM response triggers calls to MCP Tool Servers:
• Kubernetes Server for logs/cluster state (SSE or REST).
• GitHub Server for code search.
• Slack Server to notify team.
5. Responses funnel back into Orchestrator → HTTP response to caller.
6. /health calls go directly to Orchestrator health check logic.
Architectural patterns & design principles
• Microservices: each tool server is independently deployable and containerized.
• Separation of concerns: Orchestrator (FastAPI) vs. prompt generation vs. LLM invocation vs. tool shims.
• Protocol-driven design: Model Context Protocol (MCP) for uniform tool invocation.
• Cloud-agnostic deployment (compose.aws.yaml, compose.gcp.yaml, ECR/GAR).
• CI/CD pipelines: GitHub Actions build & push container images.