Chaima Gharbiai · data
← projects

Sn1tch-AI

mcp · langgraph · faiss · loki · jenkins

Sn1tch-AI was our end-of-year project (PFA) at INSAT, as a team, finished in June 2025. The idea: when something breaks, a DevOps engineer shouldn’t have to jump between Jenkins, Grafana, Prometheus and the database to find out why. They ask one question in a chat, and an AI agent goes and gets the answer from the right tool.

How it works

Chat (Gradio)the engineer asksAgentLangGraph ReAct agent,gpt-4o on Azure,picks the toolsJenkins MCPjobs, builds, console logsLoki MCPquestion → LogQL → logsPrometheus MCPPromQL on metricsDatabase MCPPostgres schema + SQLElasticsearch MCPindices and documentsCorrective RAGdocs, then the web if neededfilled: the parts I built first

One agent, one MCP server per tool. The agent reads the question and decides which tools to call.

Each tool sits behind its own MCP server. MCP (Model Context Protocol) is a standard way to give an AI agent tools: the server says “here are my tools and what they do”, and the agent calls them when it needs them. So adding a new source doesn’t change the agent, you just plug in another server.

Everything runs with Docker Compose: Jenkins, Loki with Alloy to collect the logs, Grafana, Prometheus, Postgres, Elasticsearch and all the MCP servers. Every agent run was traced with LangSmith, so we could see which tools it called and why.

What I built: the Jenkins and Loki servers

I started with these two, then we all worked on the rest together.

Jenkins. Tools to look at jobs, builds and their console output. Questions like “show me the failed builds from today” or “find the deployment pipeline” don’t use the exact job names, so I embed every job and build description (sentence-transformers) and search them by meaning with a FAISS index. For a failed build, the server pulls out a short error summary from the console log, so the agent doesn’t have to read thousands of lines.

Loki. Logs are queried in LogQL, and nobody wants to write LogQL by hand during an incident. So the server turns the question into a LogQL query with an LLM (LLaMA on Groq), with strict rules: only the labels that really exist, error levels as text filters, and a known pattern for “which container has the most errors”. It runs the query on Loki and gives the agent the most relevant log lines.

The corrective RAG

For questions about documentation, we built a corrective RAG together.

Retrievefrom the docsGradeare they relevant?Rewritea better questionWeb searchTavilyAnswerfrom what is leftgood enough: answer directly

If the retrieved documents aren't good enough, it doesn't guess: it rewrites the question and looks on the web.

A normal RAG answers from whatever it retrieved, even if it’s off topic. Here a grader checks the documents first. If they don’t really answer the question, the question gets rewritten and searched on the web (Tavily) before answering.

Result

A teammate compared how long troubleshooting took over several tests, and it was about 30% faster with Sn1tch-AI.