Skip to content

Kagent: Declarative Kubernetes Resources for Multi-Agent AI Systems

The intersection of AI agents and cloud-native infrastructure is rapidly evolving. Kagent, a Cloud Native Computing Foundation (CNCF) sandbox project, represents a significant step forward in this space: it brings Kubernetes-native declarative configuration to AI agent orchestration.

What is Kagent?

Kagent is a Kubernetes-native framework for building, deploying, and managing AI agents. Created by Solo.io and contributed to the CNCF, it leverages Kubernetes Custom Resource Definitions (CRDs) to define AI agents and workflows declaratively—the same way you'd define Deployments, Services, or any other Kubernetes resource.

The core philosophy is straightforward: if Kubernetes is your orchestration platform for workloads, why not use it to orchestrate AI agents too?

Declarative Agent Configuration

Kagent introduces several CRDs that allow you to define agents as YAML manifests:

  • Agent: The main building block—a system prompt, tools, and LLM configuration
  • ModelConfig: Defines which LLM provider and model to use
  • ToolServer: Connects agents to MCP (Model Context Protocol) servers for tools

Here's an example of defining an Agent resource:

yaml
apiVersion: kagent.dev/v1alpha2
kind: Agent
metadata:
  name: k8s-diagnostic-agent
  namespace: kagent
spec:
  description: "Kubernetes diagnostics and troubleshooting assistant"
  type: Declarative
  declarative:
    modelConfig: default-model-config
    systemMessage: |
      You are a Kubernetes expert assistant.
      Help users diagnose issues with their clusters.
      Use available tools to inspect resources and provide recommendations.
    tools:
      - type: McpServer
        mcpServer:
          name: kagent-tool-server
          kind: RemoteMCPServer
          toolNames:
            - k8s_get_resources
            - k8s_get_available_api_resources

Agents can also reference custom MCP servers. Here's how you define an MCPServer for external tools:

yaml
apiVersion: kagent.dev/v1alpha1
kind: MCPServer
metadata:
  name: mcp-website-fetcher
  namespace: kagent
spec:
  deployment:
    args:
      - mcp-server-fetch
    cmd: uvx
    port: 3000
  stdioTransport: {}
  transportType: stdio

Multi-Agent Architectures

Kagent supports building multi-agent systems where agents can use other agents as tools via the A2A (Agent-to-Agent) protocol. This enables sophisticated workflows where specialized agents collaborate:

yaml
apiVersion: kagent.dev/v1alpha2
kind: Agent
metadata:
  name: sre-coordinator
  namespace: kagent
spec:
  description: "SRE coordinator that delegates to specialized agents"
  type: Declarative
  declarative:
    modelConfig: default-model-config
    systemMessage: |
      You coordinate SRE tasks by delegating to specialized agents.
      Use the kubernetes-agent for cluster issues.
      Use the observability-agent for metrics and alerting.
    tools:
      - type: McpServer
        mcpServer:
          name: slack-notifications
          kind: MCPServer
          toolNames:
            - send_message
      - type: A2A
        a2a:
          name: kubernetes-agent
      - type: A2A
        a2a:
          name: observability-agent

The controller watches these resources and creates the necessary infrastructure to run the agents, using Google's ADK (Agent Development Kit) as the underlying engine.

Kagent and Cagent: A Shared Philosophy

It's worth comparing Kagent to Cagent, Docker's open-source agent framework. Both projects share a remarkably similar philosophy: declarative YAML-based configuration for AI agents. This convergence from two major players (CNCF/Solo.io and Docker) suggests a clear direction for the industry.

Key Similarities

Both frameworks embrace the same core principles:

FeatureKagentCagent
Configuration formatYAMLYAML
Multi-agent supportYes (A2A protocol)Yes (sub_agents)
MCP tool integrationYes (MCPServer CRD)Yes (toolsets)
System promptssystemMessage fieldinstruction field
Model configurationSeparate ModelConfigInline or models section

Here's a Cagent multi-agent configuration for comparison:

yaml
# Cagent example
agents:
  root:
    model: openai/gpt-4o
    description: "Main coordinator agent"
    instruction: |
      You coordinate SRE tasks by delegating to specialized agents.
    sub_agents: ["kubernetes-agent", "observability-agent"]
    toolsets:
      - type: mcp
        ref: docker:slack

Different Target Environments

While sharing the declarative approach, they target different deployment scenarios:

AspectKagentCagent
PlatformKubernetes-native (CRDs)Docker/local runtime
DeploymentCluster operators, GitOpsCLI, cagent run
DistributionHelm chartsDocker Hub (cagent push/pull)
ScalingKubernetes-managedManual
Best forProduction, platform teamsDevelopment, prototyping

Cagent also offers features like built-in RAG (Retrieval-Augmented Generation) with hybrid search strategies, and a cagent new command that uses AI to generate agent configurations from natural language descriptions.

The Broader Trend: Infrastructure-as-Code for AI Agents

The parallel evolution of Kagent and Cagent represents an emerging pattern: applying infrastructure-as-code principles to AI systems. This mirrors the evolution we saw in Kubernetes with deployments: from manual configuration to Helm charts to GitOps. AI agents are following the same path, with both Kubernetes-native and Docker-native approaches emerging as complementary solutions for different stages of the development lifecycle.