Inspiration

In every software company, when a production system breaks at 2 AM, an engineer has to manually check logs, metrics, and deployments — taking 60 to 90 minutes every single time. The same incidents repeat because there is no institutional memory. We built OpsPilot AI to eliminate this completely.

What it does

OpsPilot AI is a self-learning autonomous incident commander. When a production alert fires:

  1. Recalls past incidents from Elasticsearch memory using semantic search
  2. Analyzes live logs using ES|QL queries via Elastic Agent Builder MCP tools
  3. Correlates CPU, memory, and latency metrics using ES|QL
  4. Investigates recent deployments as potential root causes
  5. Reasons over all evidence using Gemini 2.5 Flash to identify root cause
  6. Executes remediation automatically — rollback, scale-up, or restart
  7. Notifies the team via real Slack alert with full incident details
  8. Creates a Jira ticket automatically with root cause and actions taken
  9. Stores learnings back into Elasticsearch so future incidents resolve faster

What takes an engineer 60-90 minutes manually, OpsPilot completes autonomously in under 2 minutes — with zero human intervention.

How we built it

Frontend: Next.js 14 + TailwindCSS — live reasoning trace dashboard with WebSocket streaming

Backend: FastAPI (Python) — orchestration, REST API, and WebSocket server

AI Engine: Gemini 2.5 Flash with function calling — autonomous multi-step reasoning

MCP Integration: Elastic Agent Builder MCP Server — all data retrieval goes through verified MCP tools:

  • platform_core_search — semantic search using ELSER
  • platform_core_generate_esql — converts plain English to ES|QL
  • platform_core_execute_esql — runs queries against live Elasticsearch data

Database + Memory: Elasticsearch Serverless — stores logs, metrics, incidents, and agent learnings

Real Integrations: Slack webhooks for real-time alerts, Jira REST API for automatic ticket creation

Challenges we ran into

  • Elastic Cloud Serverless rejects number_of_shards and number_of_replicas in index mappings — had to remove all index settings
  • MCP server requires Accept: application/json header specifically — text/event-stream alone returns 406
  • Ensuring all decisions come from Gemini reasoning rather than hardcoded if/else logic — rewrote all agents to return raw data and let Gemini interpret it
  • Gemini free tier rate limits — switched to models/gemini-2.5-flash with proper model path format

Accomplishments that we're proud of

  • Truly autonomous — zero human input from alert to resolution
  • Self-learning memory — every resolved incident stored in Elasticsearch, recalled by future incidents
  • All retrieval through MCP — agents never query Elasticsearch directly, always through Elastic Agent Builder MCP tools
  • Real integrations — Slack messages and Jira tickets created automatically, not simulated
  • Live reasoning trace — dashboard streams every Gemini thought and tool call in real time via WebSocket
  • Decision transparency — every root cause and remediation choice is made by Gemini, visible on dashboard

What we learned

  • How to build truly autonomous agents using Gemini function calling
  • How Elastic Agent Builder MCP server exposes enterprise data to AI agents
  • How ES|QL enables AI agents to query structured data using natural language
  • How Elasticsearch serves as persistent agent memory, not just a log store
  • The difference between a chatbot that answers questions and an agent that takes actions

What's next

  • Connect to real Kubernetes cluster for actual rollback execution
  • Add Security Agent and Cost Optimization Agent as additional subagents
  • Deploy on Google Cloud Run for production use
  • Integration with PagerDuty for automated on-call escalation
  • Multi-tenant support for enterprise deployments

Built With

  • elastic-agent-builder
  • elastic-mcp-server
  • elasticsearch-serverless
  • es|ql
  • fastapi
  • gemini-2.5-flash
  • google-ai-studio
  • jira-rest-api
  • next.js
  • python
  • slack-api
  • tailwindcss
  • typescript
  • websocket
Share this project:

Updates