go

module
v0.0.0-...-90b817e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: Apache-2.0

README

Kagent Go

This directory is a single Go module (github.com/kagent-dev/kagent/go) containing four top-level package trees that make up the Go components of Kagent.

Packages

Package Path Description
api go/api/ Shared types: CRD definitions, ADK model types, database models, HTTP client SDK
core go/core/ Infrastructure: Kubernetes controllers, HTTP server, CLI, database implementation
adk go/adk/ Go Agent Development Kit for building and running agents
harness go/harness/ Native Claude and Codex Actor runtimes plus their shared A2A execution support
Dependency graph
go/api  (shared types — no internal kagent deps)
  ^       ^
  |       |
go/core  go/adk

Directory Structure

go/
├── go.mod               # Single Go module file
├── Makefile              # Unified build targets
├── Dockerfile            # Shared multi-stage Docker build
│
├── api/                  # Shared types module
│   ├── v1alpha3/         # Current CRD types
│   ├── adk/              # ADK config & model types
│   ├── database/         # database model structs & Client interface
│   ├── httpapi/          # HTTP API request/response types
│   ├── client/           # REST HTTP client SDK
│   ├── utils/            # Shared utility functions
│   └── config/           # Generated CRD & RBAC manifests
│
├── core/                 # Infrastructure module
│   ├── cmd/              # Controller binary entry point
│   ├── cli/              # kagent CLI application
│   ├── internal/         # Controllers, HTTP server, DB impl, A2A, MCP
│   ├── pkg/              # Auth, env vars, translator plugins
│   ├── hack/             # Development utilities (mock LLM, config gen)
│   └── test/e2e/         # End-to-end tests
│
├── adk/                  # Go Agent Development Kit
│   ├── cmd/              # ADK server entry point
│   ├── pkg/              # Agent runtime, models, MCP, sessions, skills
│   └── examples/         # Example tools (oneshot runner, BYO agent)
│
└── harness/              # Native Harness Actor runtimes
    ├── claude/           # Claude Code adapter and image
    ├── codex/            # Codex App Server adapter and image
    ├── runtime/          # Public event, A2A executor, and continuation APIs
    └── internal/utils/  # Private OS utilities

Building

All commands are run from the go/ directory via the unified Makefile.

# Generate CRD manifests and DeepCopy methods (after changing api/ types)
make generate
make manifests

# Build CLI binaries for all platforms
make build

# Build CLI for local development
make core/bin/kagent-local

# Run the controller locally
make run

Testing

# Run all unit tests across the workspace
make test

# Run end-to-end tests (requires Kind cluster)
make e2e

Code Quality

# Lint all modules
make lint

# Auto-fix lint issues
make lint-fix

# Format all modules
make fmt

# Vet all modules
make vet

Docker

The workspace uses a single Dockerfile parameterized with BUILD_PACKAGE:

# Build controller image (default)
docker build --build-arg BUILD_PACKAGE=core/cmd/controller/main.go -t controller .

# Build Go ADK image
docker build --build-arg BUILD_PACKAGE=adk/cmd/main.go -t golang-adk .

In practice, use the root Makefile targets (make build-controller, make build-golang-adk).

Agent runtime image digests

Published Helm charts contain the matching release's digest-pinned golang-adk, claude-harness, and codex-harness images. Release packaging consumes each image build's final Buildx digest; controller builds run independently and never wait for runtime-image digests. OCI and GitHub releases share the same chart archive.

Package a release with:

make helm-release VERSION=1.0.0-alpha9 \
  RUNTIME_IMAGE_METADATA_DIR=/path/to/buildx-metadata

The directory must contain golang-adk.json, claude-harness.json, and codex-harness.json from those builds. The target validates the digests and packages the catalog with the charts in a temporary directory, then writes the completed archives to dist. It does not modify the chart sources. make helm-publish requires the same metadata input. For local registries, set RUNTIME_IMAGE_REPOSITORY=localhost:5001/kagent-dev/kagent.

The chart supplies typed harnessImages in the mounted controller.yaml file. For built-in Harnesses, workload: {} selects the default image. An explicit workload.image overrides it and must include its @sha256: digest. BYO requires an explicit image and command. This works for inline and referenced Harnesses. Agent.status.workloadImage reports the image selected for its desired revision.

Local installations can set config.harnessImages.kagent, .claude, and .codex to full digest-pinned references. Missing defaults only prevent Agents that need those entries from compiling. global.imageRegistry rewrites the registry of these defaults; it does not rewrite explicit Harness overrides. A supplied config.harnessImages.release must match the controller version; omit it for independently built local images.

The native images use make build-claude-harness and make build-codex-harness. kagent-adk remains available for Python runtime overrides.

Quick Testing with Oneshot

The adk/examples/oneshot tool lets you test agent configs locally:

# Extract config from a running agent
kubectl get secret -n kagent k8s-agent -ojson | jq -r '.data."config.json"' | base64 -d > /tmp/config.json

# Run a single prompt
cd go/adk && go run ./examples/oneshot -config /tmp/config.json -task "Hello"

Directories

Path Synopsis
adk
cmd command
examples/byo command
Package main demonstrates how to build a BYO (Bring Your Own) agent using the Go ADK's pkg/app builder with hardcoded agent configuration and Google ADK's ParallelAgent for concurrent sub-agent execution.
Package main demonstrates how to build a BYO (Bring Your Own) agent using the Go ADK's pkg/app builder with hardcoded agent configuration and Google ADK's ParallelAgent for concurrent sub-agent execution.
examples/oneshot command
Command oneshot runs a single prompt against an agent config and prints the response.
Command oneshot runs a single prompt against an agent config and prints the response.
pkg/config
Package config loads, validates, and adapts ADK runtime configuration.
Package config loads, validates, and adapts ADK runtime configuration.
pkg/fileextract
Package fileextract turns uploaded text-like file blobs into text the model can read.
Package fileextract turns uploaded text-like file blobs into text the model can read.
pkg/internal/azureai
Package azureai contains helpers shared by the Azure providers: credential construction, token acquisition, the bearer-token middleware, and the SDK client constructors.
Package azureai contains helpers shared by the Azure providers: credential construction, token acquisition, the bearer-token middleware, and the SDK client constructors.
pkg/models
Package models: Anthropic model implementing Google ADK model.LLM using genai types.
Package models: Anthropic model implementing Google ADK model.LLM using genai types.
pkg/outputschema
Package outputschema converts kagent's portable output schema into the narrower schema representation used by Go ADK.
Package outputschema converts kagent's portable output schema into the narrower schema representation used by Go ADK.
pkg/sts
Package sts implements OAuth 2.0 Token Exchange (RFC 8693) for the Go ADK.
Package sts implements OAuth 2.0 Token Exchange (RFC 8693) for the Go ADK.
pkg/taskstore
Package taskstore connects the upstream A2A SDK to kagent's private gRPC persistence service.
Package taskstore connects the upstream A2A SDK to kagent's private gRPC persistence service.
api module
a2a
agentplugin
Package agentplugin defines the runtime-neutral configuration for immutable standalone skills and Agent Plugin packages.
Package agentplugin defines the runtime-neutral configuration for immutable standalone skills and Agent Plugin packages.
clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
clientset/versioned/typed/api/v1alpha3
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/api/v1alpha3/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
sandbox
Package sandbox defines routing metadata for sandbox execution APIs.
Package sandbox defines routing metadata for sandbox execution APIs.
scheduledrun
Package scheduledrun contains the scheduling semantics shared by services and transactional reservation.
Package scheduledrun contains the scheduling semantics shared by services and transactional reservation.
v1alpha3
Package v1alpha3 contains API Schema definitions for the api.kagent.dev v1alpha3 API group.
Package v1alpha3 contains API Schema definitions for the api.kagent.dev v1alpha3 API group.
core
cli
cli/cmd/kagent command
cli/internal/commands/db
Package db wires the CLI configuration to the database commands.
Package db wires the CLI configuration to the database commands.
cli/internal/commands/sandbox
Package sandbox implements standalone sandbox commands.
Package sandbox implements standalone sandbox commands.
cli/internal/commands/session
Package session implements Session CLI commands.
Package session implements Session CLI commands.
cli/internal/common/exec
Package exec provides utilities for executing external commands.
Package exec provides utilities for executing external commands.
cli/internal/common/fs
Package fs provides filesystem utilities.
Package fs provides filesystem utilities.
cli/internal/common/generator
Package generator provides shared utilities for project code generation.
Package generator provides shared utilities for project code generation.
cli/internal/common/k8s
Package k8s provides utilities for working with Kubernetes configurations.
Package k8s provides utilities for working with Kubernetes configurations.
cli/internal/common/prompt
Package prompt provides utilities for interactive user input.
Package prompt provides utilities for interactive user input.
cli/internal/config
Package config resolves local CLI settings before command execution.
Package config resolves local CLI settings before command execution.
cli/internal/connection
Package connection owns CLI server connectivity and Kubernetes port-forward fallback.
Package connection owns CLI server connectivity and Kubernetes port-forward fallback.
cli/internal/db
Package db hosts the `kagent db` parent command and its subcommands.
Package db hosts the `kagent db` parent command and its subcommands.
cli/internal/db/migrate
Package migrate provides the database migration commands.
Package migrate provides the database migration commands.
cli/internal/output
Package output owns the CLI's shared machine-output contract.
Package output owns the CLI's shared machine-output contract.
cli/internal/tui/session
Package session renders Session control-plane fields for the terminal.
Package session renders Session control-plane fields for the terminal.
cmd/controller command
hack/mockllm command
internal/a2agateway
Package a2agateway routes public A2A calls to actors and persisted Session state.
Package a2agateway routes public A2A calls to actors and persisted Session state.
internal/controller/remotemcpserver
Package remotemcpserver reconciles the discovered tool catalog published in RemoteMCPServer status.
Package remotemcpserver reconciles the discovered tool catalog published in RemoteMCPServer status.
internal/controller/toolcatalog
Package toolcatalog normalizes and publishes MCP catalog observations.
Package toolcatalog normalizes and publishes MCP catalog observations.
internal/dbtest
Package dbtest provides test helpers for spinning up a Postgres container.
Package dbtest provides test helpers for spinning up a Postgres container.
internal/service/taskstore
Package taskstore owns the private persistence API used by runtime SDKs.
Package taskstore owns the private persistence API used by runtime SDKs.
internal/skillsinit
Package skillsinit fetches skill and plugin artifacts from remote sources.
Package skillsinit fetches skill and plugin artifacts from remote sources.
internal/translator/claude
Package claude compiles resolved v1alpha3 inputs for the native Claude Harness adapter.
Package claude compiles resolved v1alpha3 inputs for the native Claude Harness adapter.
internal/translator/codex
Package codex compiles resolved v1alpha3 inputs for the native Codex Harness adapter.
Package codex compiles resolved v1alpha3 inputs for the native Codex Harness adapter.
pkg/app
Package app boots the kagent controller.
Package app boots the kagent controller.
pkg/config
Package config loads explicit CLI and controller configuration.
Package config loads explicit CLI and controller configuration.
pkg/env
Package env provides a centralized registry for environment variables used throughout kagent.
Package env provides a centralized registry for environment variables used throughout kagent.
pkg/migrations
Package migrations embeds the SQL migration files for the kagent database schema and provides the runner that applies them at startup.
Package migrations embeds the SQL migration files for the kagent database schema and provides the runner that applies them at startup.
pkg/postgres
Package postgres builds kagent's PostgreSQL connection pool configuration.
Package postgres builds kagent's PostgreSQL connection pool configuration.
pkg/postgressetup
Package postgressetup provides the PostgreSQL identity setup for Kagent.
Package postgressetup provides the PostgreSQL identity setup for Kagent.
test/byoa2a command
harness
claude/cmd command
Command kagent-claude runs the Claude Harness runtime adapter.
Command kagent-claude runs the Claude Harness runtime adapter.
claude/config
Package config defines the versioned, non-secret Claude Harness runtime configuration shared by its compiler and Actor entrypoint.
Package config defines the versioned, non-secret Claude Harness runtime configuration shared by its compiler and Actor entrypoint.
claude/executor
Package executor builds the Claude Harness A2A executor for kagent-claude and for binaries that embed the harness elsewhere.
Package executor builds the Claude Harness A2A executor for kagent-claude and for binaries that embed the harness elsewhere.
claude/internal/adapter
Package adapter constructs the Claude runtime from compiler-owned configuration and Actor-owned paths.
Package adapter constructs the Claude runtime from compiler-owned configuration and Actor-owned paths.
claude/internal/driver
Package driver translates Claude Code's streaming process protocol into the runtime-neutral events consumed by the shared A2A executor.
Package driver translates Claude Code's streaming process protocol into the runtime-neutral events consumed by the shared A2A executor.
codex/cmd command
Command kagent-codex runs the Codex Harness runtime adapter.
Command kagent-codex runs the Codex Harness runtime adapter.
codex/config
Package config defines the versioned, non-secret Codex Harness runtime configuration shared by its compiler and Actor entrypoint.
Package config defines the versioned, non-secret Codex Harness runtime configuration shared by its compiler and Actor entrypoint.
codex/executor
Package executor builds the Codex Harness A2A executor for kagent-codex and for binaries that embed the harness elsewhere.
Package executor builds the Codex Harness A2A executor for kagent-codex and for binaries that embed the harness elsewhere.
codex/internal/adapter
Package adapter validates and materializes compiler-owned Codex state.
Package adapter validates and materializes compiler-owned Codex state.
codex/internal/driver
Package driver translates the Codex App Server protocol into the runtime-neutral events consumed by the shared A2A executor.
Package driver translates the Codex App Server protocol into the runtime-neutral events consumed by the shared A2A executor.
internal/utils
Package utils provides small, shared operating-system helpers for Harness runtimes.
Package utils provides small, shared operating-system helpers for Harness runtimes.
runtime
Package runtime defines the minimal turn and event vocabulary shared by Harness runtime adapters.
Package runtime defines the minimal turn and event vocabulary shared by Harness runtime adapters.
runtime/a2a
Package a2a supervises Harness runtime turns behind kagent's private A2A service.
Package a2a supervises Harness runtime turns behind kagent's private A2A service.
runtime/continuation
Package continuation persists the private native conversation identity owned by one Harness Actor.
Package continuation persists the private native conversation identity owned by one Harness Actor.
pkg
telemetry
Package telemetry boots the OpenTelemetry SDK from explicit configuration with standard OTEL environment overrides.
Package telemetry boots the OpenTelemetry SDK from explicit configuration with standard OTEL environment overrides.
telemetry/conv
Package conv holds the attribute and metric names of the kagent telemetry contract.
Package conv holds the attribute and metric names of the kagent telemetry contract.
telemetry/telemetrytest
Package telemetrytest checks the shape of exported telemetry in tests.
Package telemetrytest checks the shape of exported telemetry in tests.
tracing
Package tracing holds the invocation span contract shared by kagent runtimes.
Package tracing holds the invocation span contract shared by kagent runtimes.
sandbox
guest/cmd command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL