agentlab

command module
v0.141.0-rc.39 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

agentlab

The Giant Swarm agent platform on your laptop: one binary, one throwaway kind cluster, every chain proven end to end.

Release CI Go License


agentlab runs the Giant Swarm agent platform — muster as the MCP gateway, the Kubernetes MCP server, the kagent agents runtime and Giant Swarm's Backstage portal — on a kind cluster on your machine, so the whole platform can be tested and demoed without a management cluster.

Two kinds of client meet at one gateway. MCP clients such as Claude Code talk to muster directly; people use Backstage, the human frontend to the whole platform — servers, workflows, tools, agents, models — with their own token. The agents Backstage creates run on kagent and are MCP clients of muster too, calling tools as the person who invoked them.

The platform needs an identity provider, so the lab bundles its own Dex: users that exist nowhere but this cluster, RBAC driven by the groups claim, and the apiserver, muster and Backstage all trusting the same issuer.

What's in the box

  • One Go binary. agentlab configure asks every option through an interactive form and writes agentlab.yaml; every manifest renders from embedded templates. No YAML to hand-edit, no scripts to source.
  • The agent platform. The agent-platform chart every Giant Swarm management cluster runs, installed in its lab shape: muster behind an agentgateway TLS edge, the single OAuth enforcement point in front of an unauthenticated in-cluster mcp-kubernetes. Per-server sign-in, declared toolsets and a fake multi-cluster fleet are all exercised.
  • Backstage, the human frontend. Giant Swarm's Backstage is how a person works the whole platform: browse and sign in to MCP servers, run workflows, explore tools, create agents and chat with them, manage models. Every call carries the signed-in user's own token, so the portal shows exactly what the platform grants that person.
  • Agents. kagent runs the agents Backstage or agent-manager creates. They are MCP clients of muster like Claude Code is, forwarding the caller's token and bounded further by declared toolsets, so they see the same catalogue under the same rules.
  • Models. An Anthropic default; extra model configs for OpenAI-compatible, Gemini and Ollama endpoints; managed models through model-manager fronting the model servers on the host — an Ollama, a Lemonade Server, an LM Studio; and, with platform.serving, the platform's own serving on llm-d — the KServe llmisvc controller, the well-known runtime configs, the models Gateway with its JWT policy, one CPU preset served on the node.
  • Workspaces. With platform.workspaces, the read-write-many storage a workspace's volume is claimed from: an in-cluster NFS server and the NFS CSI driver, its controller behind an mTLS proxy only Agent Substrate's API server may reach, and the StorageClass agentlab-workspaces; agentlab workspaces-test proves sub-path mounts per Session, read-only mirrors and git on the volume, and a claude Session admitted on it with a workspace grant the workspace-manager's key set verifies. With platform.workspaces.csiCompanion the connectivity chart's CSI companion mounts the volumes for Substrate instead, the lab's path for proving a companion change. The workspace-manager's provider instances are a GitHub App of the lab's own and a GitLab; a person grants the App in a browser.
  • VMs. vm-manager, the platform's VM provisioner, as a pod of the KVM node (the chart's components.vm-manager) registered with muster as x_vm-manager_*: VMs with an instance metadata service, a vTPM and attestation, created by the person or an agent who asked.
  • Swarmgeist. klaus-gateway, the fleet's Slack bridge, on the host against the lab's public gRPC edge and — with platform.klausGateway — as the meta chart's in-cluster component with its OBO link store in a Secret, proven across a pod loss. No Slack workspace, so no real sign-in: the store is proven through the gateway's own package.
  • Observability. A minimal Prometheus plus mcp-prometheus, so PromQL questions about the lab go through MCP too.
  • Identity you can reason about. Three throwaway users, a fixed group vocabulary, one issuer URL valid from the host, the node and every hostNetwork pod, and a lab CA you trust explicitly.
  • Network policies, as an installation runs them. With platform.networkPolicy the platform's own policies enforce (the plain NetworkPolicy flavour kind's kindnetd enforces). muster leaves the host network for it: the policies admit muster by its pod labels, and a host-network pod's traffic carries the node's address instead, so a host-network muster would be cut off from every backend. The lab adds only what its shape needs — the node as the apiserver, its in-cluster Dex and Prometheus as peers, and two stand-ins for gaps of the chart's kubernetes flavour (Network policies) — and platform-test proves the denial.
  • The fleet's admission. Kyverno with the flux-multi-tenancy policy every Giant Swarm management cluster enforces, verbatim and in Enforce, and an org namespace with the fleet's tenant ServiceAccount — a release that an installation would refuse is refused here, with the same message.
  • Proofs, not hope. Headless *-test commands drive every chain — Dex login, muster, MCP tools, agents, toolsets, models, RBAC, Backstage — and fail loudly.

Getting started

Requirements: docker (or Podman >= 4's docker-compatible CLI) — nothing else; go >= 1.26 only to build from source. kind, Helm and the Kubernetes client are built into the binary: the cluster runs the Kubernetes of the embedded kind release's default node image, the platform installs through Helm 4's SDK, and every call to the apiserver goes through client-go. Give docker at least 4 CPUs and 6 GiB for the full lab; agentlab up checks before it touches anything (see Docker resources).

GOBIN=~/.local/bin go install github.com/giantswarm/agentlab@latest   # or a release binary in ~/.local/bin; `agentlab self-update` keeps it there

export ANTHROPIC_API_KEY=sk-ant-...   # optional: powers the agents and Backstage's AI chat
agentlab up                           # one question (the detected defaults, or customize), then certs, kind cluster, Dex, RBAC, the platform — verified
agentlab open portal                  # the portal in your browser (the URL is printed too)
agentlab platform-test                # headless proof: Dex -> muster -> mcp-kubernetes -> apiserver
agentlab oauth-consent-test           # CIMD, consent, resource access tokens and replacement of both replicas
agentlab polex-test                   # the chart's Kyverno PolicyExceptions dry-run against the lab's Kyverno (the fleet's)

Headless (CI, a coding agent), write the lab first with agentlab configure --defaults: nothing asks without a terminal. A new lab is named agentlab, or agentlab-<n> when another lab on this machine holds that name; --cluster-name <name> names it. On a terminal, up ends by asking whether to trust the lab CA (one sudo prompt, so browsers get a green lock) and whether to open the portal — open portal is the command for later, open agents opens the kagent UI and open prometheus the lab Prometheus. agentlab list shows the labs on this machine, agentlab status the chart a lab runs (a dev chart named as such) against the one agentlab.yaml installs, with the drift when they differ, its platform releases and whether Backstage's app-config drifted from the render, and agentlab pods a lab's pods, from any directory (--lab <name> picks one of several).

One binary drives one kagent line: this agentlab drives the labs whose chart installs kagent 1.3 or later (agent-platform 4.121.0 and later, kagent's Session API); a lab on an earlier 4.x chart is driven by agentlab v0.84.6, kept beside this one. agentlab list shows each lab's line, and this agentlab refuses to configure, boot, turn or prove a lab on a line it does not drive. Two labs on two lines, each with its binary, side by side on one machine: One binary per kagent line.

Then point Claude Code at the platform:

agentlab trust                # if you said no above: one sudo prompt, `agentlab untrust` reverts it
export NODE_USE_SYSTEM_CA=1   # Node >= 22.15; older Node: NODE_EXTRA_CA_CERTS=~/.local/state/agentlab/labs/<lab>/certs/ca.crt
claude mcp add --transport http muster https://muster.127.0.0.1.nip.io/mcp
# in Claude Code:  /mcp  ->  authenticate  ->  Dex login page  ->  done

The portal (https://portal.127.0.0.1.nip.io) signs in the default users admin@lab.local, dev@lab.local and viewer@lab.local, password password. agentlab down deletes the cluster.

The full walkthrough, including what configure discovers about your machine, is in Getting started.

Proofs

Every chain the lab stands up has a headless *-test command that drives it end to end, prints a PASS, SKIP or FAIL per stage with the reason, and exits non-zero on a failure. The command reference has every flag and stage.

Command What it proves
platform-test Dex → muster → mcp-kubernetes → apiserver, the fleet's admission, per-server sign-in, the infrastructure families
oauth-consent-test CIMD, consent, resource access tokens, and the replacement of both replicas
polex-test The chart's Kyverno PolicyExceptions against the fleet's Kyverno
agents-test agent-manager through muster as the person: create, Ready on the Harness, a turn, update, delete, its RBAC
agents-gitops-test Editing an agent applied from git, as the portal does it
organizations-test Two Agent Platform organizations and the boundary between them on every surface
toolsets-test Declared toolsets from agent-manager to muster's per-request refusal
signin-test An agent's MCP call pausing on the person's sign-in and resuming after it
egress-test An agent's declared origin reached, an undeclared one denied at the egress gate
skills-test The golden boot of an agent with a git skill under Substrate's egress gate
a2a-test Turns over native gRPC through the edge, with human-in-the-loop approval and cancel
coding-test Coding agents on the claude, codex or omp Harness: the security floor, suspend and resume, egress denial, usage; --step <stage> reruns one stage; --part devctl opens, waits for and merges a pull request through devctl; --part toolchains mounts toolchains into a Session
chatgpt-test Codex on a person's own ChatGPT subscription
harness-matrix-test What each Harness does with Shared subagents and Claude-format plugin parts
models-test Managed models through model-manager's tools
serving-test Model serving on llm-d
vm-manager-test vm-manager as the person, and a VM booted to ready
workspaces-test Workspace storage, Sessions' sub-path mounts and the provider instances
substrate-step-test Conversations and durable volumes across a Substrate release
kagent-step-test Conversations and durable volumes across a kagent step
substrate-tunnel-test gRPC to an HTTP/1.1-only actor failing at once
klaus-gateway-test Swarmgeist through its Slack adapter, the OBO link store
decisions-test klaus-gateway's decisions
beekeeper-decisions-test, beekeeper-central-test, beekeeper-subscriptions-test beekeeper's decisions in Slack, its central resources, resource subscriptions through muster
backstage-test The headless Backstage sign-in and the muster hop with the person's token

Verify a downloaded release

Every release asset agentlab-<os>-<arch> (.exe on Windows) ships next to its Sigstore bundle agentlab-<os>-<arch>.bundle. No checksums file is published: a checksum adds no trust beyond GitHub's own asset digest, while the bundle ties the binary to a CircleCI build of this repository, the same check agentlab self-update runs before it installs anything. Release candidates are signed by the same identity, so the steps below verify them too.

Download the binary and its bundle into one empty directory, then run cosign (v2 or newer) from outside it. Never run the binary before it verified:

mkdir dl && gh release download v0.96.0 --repo giantswarm/agentlab \
  -D dl -p 'agentlab-linux-amd64' -p 'agentlab-linux-amd64.bundle'

cosign verify-blob \
  --bundle dl/agentlab-linux-amd64.bundle \
  --certificate-oidc-issuer https://oidc.circleci.com \
  --certificate-identity-regexp '^https://circleci\.com/api/v2/projects/[a-f0-9-]+/pipeline-definitions/[a-f0-9-]+$' \
  dl/agentlab-linux-amd64

A verified binary prints:

Verified OK

The builds are signed by CircleCI, not by a GitHub workflow: the certificate's identity is a CircleCI pipeline definition and its issuer is https://oidc.circleci.com. Its GitHub workflow repository extension is empty, so --certificate-github-workflow-repository fails on these builds, and no cosign flag pins the source repository. Check it from the bundle: the certificate's source repository URI extension (OID 1.3.6.1.4.1.57264.1.12) must be github.com/giantswarm/agentlab.

jq -r .verificationMaterial.certificate.rawBytes dl/agentlab-linux-amd64.bundle \
  | base64 -d | openssl x509 -inform der -noout -text \
  | grep -A1 '1.3.6.1.4.1.57264.1.12'
            1.3.6.1.4.1.57264.1.12:
                ..github.com/giantswarm/agentlab

A verification that fails exits non-zero and prints Error: with the reason; the binary is not to be used. Pinning another identity (here a GitHub one) fails like this, and the message names the identity the bundle carries:

Error: failed to verify certificate identity: no matching CertificateIdentity found, last error: expected SAN value to match regex "^https://github\.com/giantswarm/", got "https://circleci.com/api/v2/projects/7bdef2bf-7d98-4aca-bf0c-5d3b72cc306b/pipeline-definitions/48087dfd-3bbc-5498-9a9a-f7f1bb77c43d"

A binary that does not match its bundle, or a bundle of another repository's build, fails the same way, either at the identity or with a signature error; a bundle whose source repository is not github.com/giantswarm/agentlab fails the check above.

Documentation

Page What it covers
Getting started Requirements, docker CPU and memory, install, what configure discovers, the first up, connecting Claude Code
Command reference Every agentlab command and flag, the environment variables, keeping the binary current
TLS The lab CA, trust and untrust, Node and browsers, bringing your own certificate
The agent platform muster + mcp-kubernetes: the request path, per-server sign-in, the infrastructure families, toolsets, deviations from a real management cluster, the dev channel (a branch's dev builds), Agent Substrate and the platform Postgres from the chart, Substrate worker nodes (substrateNodes) for node-loss proofs
Agents The kagent runtime, the default ModelConfig and the API key Secret
The migration rehearsal A 3.x lab with the four fleet shapes upgraded in place to the 4.x line: the command sequence, the timings, what the migrate run rewrote, refused and deleted, what an installation's cut-over does differently
Models Extra model configs, model servers on the host, managed models through model-manager, model serving on llm-d in the lab
vm-manager The platform's VM provisioner as a pod of the node: the KVM devices, the image directory, the dev image, the golden PCR recipe, the proof
klaus-gateway Swarmgeist as the meta chart's component: the values, the two lab Secrets, the OBO link store in a Secret across a pod loss, the dev image, what a lab without a Slack workspace cannot prove
Observability Prometheus + mcp-prometheus, and Backstage's metrics views
Backstage The human frontend: the muster plugin, agents and models in the portal, the agent create flow
Identity Users and groups, the shared issuer, the Dex version, wiring another app, trustedPeers
Workspaces The workspace storage switch (the NFS server, the NFS CSI driver behind its mTLS proxy, the read-write-many class, the proof) and the workspace-manager's provider instances, a GitHub App of the lab's own and a GitLab
GitHub sign-in GitHub as a second way into the lab: the App and its callback, the client secret placed as a Secret, what a GitHub user is in the lab
The lab's registries The lab registry and the gsoci mirror every lab on the machine shares (registryMirror), zot following its releases, holding the lab registry back (zotVersion)
Troubleshooting The gotchas that cost time
Usage data The anonymous usage signals — one per command, one per platform install naming the chart line, the lab portal's under the same deployment ID — and how to opt out
Development environment Developing a platform component against the lab: hot reload, dev images, unreleased charts
Development Repository layout, building and testing, the hack journal

Development

make build     # CGO_ENABLED=0 go build -o agentlab .: static, as the lab's containers need it
make test      # go test ./...
make lint      # golangci-lint as CI's pre-commit runs it: its pinned version, linters and config

The lab's end-to-end checks are its own *-test subcommands, not go test. Every hack and workaround, with its status, is recorded in HACKS.md; CLAUDE.md briefs coding agents on the repository. The layout is in Development.

License

Apache 2.0.

Documentation

Overview

agentlab is a local lab for the Giant Swarm agent platform: muster + the Kubernetes MCP (and optionally Backstage) on a throwaway kind cluster, with a bundled Dex as the OIDC provider — users that exist nowhere but this cluster.

The binary embeds every manifest as a template; `agentlab configure` asks for the configuration interactively and persists it to agentlab.yaml, and the lifecycle commands render + apply from there.

Directories

Path Synopsis
internal
config
Package config holds the lab configuration: everything the interactive form asks for, persisted to agentlab.yaml so re-runs are reproducible.
Package config holds the lab configuration: everything the interactive form asks for, persisted to agentlab.yaml so re-runs are reproducible.
forms
Package forms is the interactive face of agentlab: charm.land/huh forms that ask for every configuration option and fill in a config.Config.
Package forms is the interactive face of agentlab: charm.land/huh forms that ask for every configuration option and fill in a config.Config.
lab
labs
Package labs is the registry of the labs on this machine: one entry per cluster name, pointing at the lab directory that holds its agentlab.yaml, certs/ and state/.
Package labs is the registry of the labs on this machine: one entry per cluster name, pointing at the lab directory that holds its agentlab.yaml, certs/ and state/.
telemetry
Package telemetry reports anonymous usage signals to TelemetryDeck, the way kubectl-gs does.
Package telemetry reports anonymous usage signals to TelemetryDeck, the way kubectl-gs does.
telemetry/machineid
Package machineid reads the identifier the operating system keeps for the computer it runs on: `kern.uuid` on macOS, /etc/machine-id on Linux, the registry's MachineGuid on Windows.
Package machineid reads the identifier the operating system keeps for the computer it runs on: `kern.uuid` on macOS, /etc/machine-id on Linux, the registry's MachineGuid on Windows.
update
Package update keeps the agentlab binary current.
Package update keeps the agentlab binary current.
xdg
Package xdg locates agentlab's folders the way the freedesktop XDG Base Directory specification says every program on the machine does: the configuration under $XDG_CONFIG_HOME, the state (labs, CAs, kubeconfigs) under $XDG_STATE_HOME, the cache under $XDG_CACHE_HOME and the binary in ~/.local/bin.
Package xdg locates agentlab's folders the way the freedesktop XDG Base Directory specification says every program on the machine does: the configuration under $XDG_CONFIG_HOME, the state (labs, CAs, kubeconfigs) under $XDG_STATE_HOME, the cache under $XDG_CACHE_HOME and the binary in ~/.local/bin.
pkg
project
Package project carries the build identity of the agentlab binary: its version, git commit and build time.
Package project carries the build identity of the agentlab binary: its version, git commit and build time.

Jump to

Keyboard shortcuts

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