CubeCortex: The AI Brain for Microservices on Kubernetes

Inspiration

The inspiration for CubeCortex came from two places: the human brain and the challenges of modern cloud applications. Microservices give flexibility and scalability, but they are often reactive rather than intelligent. Each service works in isolation, without the ability to adapt, learn, or collaborate beyond static APIs.

We asked ourselves:

  • What if microservices could think?
  • What if services could anticipate failures, optimize resource usage, and enhance user experience autonomously?

This thought inspired CubeCortex, where each microservice is augmented by AI agents—like neurons in a brain—that collaborate to make the entire system smarter. We wanted to celebrate 10 years of GKE by showing how the next 10 years could look: intelligent, agentic, adaptive microservices at scale.


What it does

CubeCortex is a distributed AI layer that runs on Google Kubernetes Engine (GKE) and enhances existing microservice applications—without touching their core code.

Here’s what it does:

  • AI-Enhanced Microservices → Each AI agent connects to an existing service API and provides intelligence (fraud detection, anomaly detection, personalization, resource optimization).
  • Distributed Agent Brain → Agents communicate using Agent2Agent (A2A), forming a “cognitive mesh” across microservices.
  • Context Awareness → Uses Gemini AI models to understand requests and generate intelligent responses.
  • Smart Kubernetes Operations → With kubectl-ai, developers can ask natural language questions like “Scale checkout service to handle peak load” and get automatic Kubernetes actions.
  • Unified Dashboard → Visualizes decisions, anomalies detected, and optimizations applied by agents in real time.

In short: CubeCortex turns microservices into an AI-driven nervous system, capable of adapting, scaling, and thinking.


How we built it

We built CubeCortex by combining Kubernetes scalability with Google’s AI power:

  1. Base Application

    • Deployed Bank of Anthos on GKE as the foundational microservice app.
    • This gave us a real-world, production-style microservice environment.
  2. AI Agents

    • Created containerized AI agents powered by Gemini models.
    • Each agent plugs into a specific microservice (payments, checkout, fraud detection).
    • Agents run independently but communicate through APIs and the Model Context Protocol (MCP).
  3. Protocols

    • Used MCP for agents to fetch context from microservices.
    • Used A2A protocol so agents could collaborate on multi-step workflows.
  4. Tools and Workflows

    • Kubectl-ai → to manage Kubernetes clusters using natural language.
    • Gemini CLI → for AI-assisted workflows during development and testing.
    • Cloud Monitoring → tracked metrics of both agents and services.
  5. Architecture

    • Each agent runs in a separate Kubernetes pod.
    • Agents form a distributed brain layer over the microservices.
    • The system is modular: adding a new agent = plugging in a new “cube” into the CubeCortex.

Challenges we ran into

  • API Integration: Ensuring agents could interact with APIs without modifying core services.
  • Latency: Running AI inference in real time without slowing down user requests.
  • Scalability: Designing agents to scale horizontally with Kubernetes while keeping resource usage efficient.
  • Inter-Agent Communication: Making A2A protocols robust enough for complex workflows.
  • Observability: Ensuring we could monitor not just microservices, but also the decisions made by agents.

Accomplishments that we're proud of

  • Built a plug-and-play AI intelligence layer for microservices on GKE.
  • Created distributed agents that function like a “neural cortex” for applications.
  • Achieved real-time anomaly detection in the Bank of Anthos payments service.
  • Designed a clean architecture diagram + dashboard that makes our system understandable to both developers and judges.
  • Proved that agentic AI can enhance cloud-native systems without rewriting legacy code.

What we learned

  • How to effectively deploy AI agents at scale on Kubernetes.
  • The power of Gemini models for context understanding and workflow generation.
  • The importance of protocols like MCP and A2A for interoperability between agents.
  • New ways to simplify Kubernetes operations with kubectl-ai.
  • That hackathon speed requires clean modular architecture—agents as building blocks worked beautifully.

Mathematically, we modeled CubeCortex as:

[ \text{CubeCortex} = \sum_{i=1}^{n} A_i \cdot S_i ]

Where:

  • (A_i) = intelligence of agent i
  • (S_i) = corresponding microservice i

Together, the system behaves like a cognitive mesh, scaling intelligence as services and agents grow.


What's next for CubeCortex: The AI Brain for Microservices on Kubernetes

  • Multi-cloud expansion: Run CubeCortex seamlessly across AWS, Azure, and GCP.
  • Reinforcement learning: Let agents improve their decision-making automatically over time.
  • Production-ready use cases:
    • Fraud detection and smart credit scoring in Bank of Anthos.
    • Personalized recommendations in Online Boutique.
  • Open-source release: Share CubeCortex with the Kubernetes + AI community.
  • Ecosystem vision: Build a marketplace of “plug-in agents” that developers can add to any microservice app like Lego blocks.

Built With

  • agent2agent-(a2a)
  • cloud-monitoring
  • code
  • docker
  • gemini-ai-models
  • gemini-cli
  • github
  • google-kubernetes-engine-(gke)
  • kubectl-ai
  • kubernetes
  • model-context-protocol-(mcp)
  • node.js
  • python
  • rest-apis
  • vs
Share this project:

Updates