Skip to content

Latest commit

 

History

History
91 lines (73 loc) · 3.64 KB

File metadata and controls

91 lines (73 loc) · 3.64 KB

CODEBASE.md

Overview

This repository contains the infrastructure configuration for deploying agentgateway and kagent on a local Kubernetes cluster (Kind) with Anthropic Claude API as the LLM provider.

Architecture

kagent → agentgateway-proxy (Kubernetes) → Anthropic Claude API
  • agentgateway — LLM Gateway that handles routing, authentication, and observability for AI traffic
  • kagent — Kubernetes-native AI agent framework
  • Claude API — Anthropic's LLM (claude-3-haiku-20240307, cheapest model)

Repository Structure

agentgateway-kagent/
├── kind-cluster.yaml              # Kind cluster config (K8s 1.29.2, ARM64)
├── CODEBASE.md                    # This file — codebase documentation
├── REVIEW.md                      # AI PR review guidelines
├── EVALS.md                       # Evaluation criteria for AI reviews
├── README.md                      # Quick start guide
├── .gitignore                     # Excludes secrets and macOS files
├── .github/
│   └── workflows/
│       ├── ai-review.yaml         # AI-powered PR review via Claude API
│       └── ai-review-evals.yaml   # Evaluates quality of AI reviews
└── k8s/
    ├── secret-anthropic.yaml      # Secret template (no real key!)
    ├── gateway.yaml               # Kubernetes Gateway resource
    ├── backend-claude.yaml        # AgentgatewayBackend for Claude
    ├── httproute-llm.yaml         # HTTPRoute for LLM traffic
    ├── kagent-values.yaml         # Helm values for kagent
    └── model-config.yaml          # ModelConfig (kagent → agentgateway)

Key Files Explained

kind-cluster.yaml

Defines a local Kubernetes cluster using Kind (Kubernetes in Docker).

  • Uses kindest/node:v1.29.2 — required for CEL validation in agentgateway CRDs
  • Port mappings: 8080 (API), 8081 (kagent UI), 15000 (agentgateway UI)

k8s/gateway.yaml

Creates a Kubernetes Gateway named agentgateway-proxy.

  • Uses agentgateway GatewayClass (auto-created by the controller)
  • Creates a proxy deployment that handles actual LLM traffic
  • Allows routes from all namespaces

k8s/backend-claude.yaml

Defines the Anthropic Claude backend for agentgateway.

  • Model: claude-3-haiku-20240307 (~$0.25/1M tokens)
  • Auth via Kubernetes Secret (anthropic-secret)
  • Secret key MUST be named Authorization

k8s/httproute-llm.yaml

Routes HTTP traffic from the gateway to the Claude backend.

  • Matches all traffic to the agentgateway-proxy gateway
  • Routes to anthropic AgentgatewayBackend

k8s/kagent-values.yaml

Helm values for deploying kagent.

  • Configured to route through agentgateway (not directly to Anthropic)
  • Uses claude-3-haiku-20240307 model
  • Exposes UI via NodePort 30080

k8s/model-config.yaml

kagent ModelConfig resource connecting kagent to agentgateway.

  • Provider: anthropic
  • BaseURL points to agentgateway-proxy internal service

Security Notes

  • ⚠️ Never commit real API keys — use kubectl create secret with env vars
  • The secret-anthropic.yaml file contains only a placeholder
  • Real secrets are created via: kubectl create secret generic anthropic-secret --from-literal=Authorization="$ANTHROPIC_API_KEY"
  • All sensitive values are stored in Kubernetes Secrets, not in YAML files

Technology Stack

Component Version Purpose
Kind latest Local K8s cluster
Kubernetes 1.29.2 Container orchestration
agentgateway v2.2.1 LLM Gateway
kagent latest AI Agent framework
Helm v3.8+ K8s package manager
Claude 3-haiku-20240307 LLM model