This file provides guidance for AI agents working on the agents-api repository.
agents-api is the canonical, read-only location for Kruise Agents API definitions and Go client. It provides stable Go types for serializing/deserializing Kruise Agents resources, intended for direct use by consumers.
Governance: All changes must originate in openkruise/agents (source repo); this repo is synced read-only.
Versioning: Follows v0.x.z scheme — x matches Kruise Agents major/minor; z increments for bugfixes or cherry-picks.
agents-api/
├── agents/v1alpha1/ # Core API type definitions (CRD specs)
├── client/ # Auto-generated Go client (clientset, informers, listers)
├── clients/ # Multi-language client SDKs (Java, Python)
├── sdk/ # Go SDK for E2B API and runtime (proto, sandbox, runtime)
├── examples/ # Usage examples (e.g. SandboxClaim)
├── hack/ # Build scripts and code generation tooling
├── bin/ # Locally downloaded tool binaries (controller-gen, openapi-gen)
├── vendor/ # Go dependencies (vendored)
└── .github/workflows/ # CI workflows
-
agents/v1alpha1/— Hand-written API type definitions. Contains CRD types:sandbox_types.go— Sandbox resourcesandboxset_types.go— SandboxSet resourcesandboxclaim_types.go— SandboxClaim resourcesandboxtemplate_types.go— SandboxTemplate resourcesandboxupdateops_types.go— SandboxUpdateOps resourcecheckpoint_types.go— Checkpoint resourcemount_types.go— Mount typesannotations.go— Shared annotation constantse2b_annotations.go— E2B-specific annotation constantszz_generated.deepcopy.go— Auto-generated deep copy methods (do not edit)groupversion_info.go— Group version registration (agents.kruise.io/v1alpha1)
-
client/— Auto-generated Kubernetes client libraries. Do not edit manually. Regenerated viamake generate.clientset/— Typed client for interacting with Agents API resourcesinformers/— Watch/informer implementationslisters/— Resource lister implementations
-
sdk/— Go SDK for E2B API integration and runtime managementproto/api/— Auto-generated E2B API client (OpenAPI-based, do not edit)proto/envd/— Protobuf-generated envd service clients (do not edit)runtime/— Runtime client and command handlingsandbox/— Sandbox management SDKexample/— SDK usage examples
-
clients/java/— Java client library (CRD-generated models, published to Maven Central) -
clients/python/— Python client library
- Language: Go 1.25.0
- Module:
github.com/openkruise/agents-api - Core Dependencies:
k8s.io/api,k8s.io/apimachinery,k8s.io/client-gov0.35.0k8s.io/code-generatorv0.35.0k8s.io/kube-openapiv0.0.0-20250910181357-589584f1c912sigs.k8s.io/controller-runtimev0.21.0connectrpc.com/connectv1.19.2github.com/go-bindata/go-bindatav3.1.2google.golang.org/protobufv1.36.9
- Code Generation Tools:
controller-genv0.16.5 (downloaded to./bin/)openapi-gen(version derived from go.mod)
All commands should be run from the project root directory.
# Run go vet across all packages
make vet
# Regenerate client code (clientset, informers, listers, deep-copy)
make generate
# Generate OpenAPI schema
make openapi-gen
# Generate CRD schema only
make gen-schema-only
# Generate OpenAPI schema (full pipeline)
make gen-openapi-schema-
make generaterunshack/generate_client.sh, which:- Runs
go mod vendor - Uses
kube::codegen::gen_helpersto generate deep-copy and helper methods - Uses
kube::codegen::gen_clientto generate clientset/informers/listers - Copies generated output back into
./client/
- Runs
-
make openapi-gendownloadsopenapi-genbinary to./bin/if not present
The following files/directories are auto-generated and must not be edited by hand:
agents/v1alpha1/zz_generated.deepcopy.goclient/(entire directory — regenerated bymake generate)sdk/proto/api/(generated from E2B OpenAPI spec)sdk/proto/envd/(generated from protobuf definitions)
When modifying CRD types in agents/v1alpha1/*_types.go:
- Edit only the hand-written type files (not
zz_generated.deepcopy.go) - After changes, run
make generateto regenerate deep-copy methods and client code - Run
make vetto verify no issues - For OpenAPI schema changes, run
make gen-openapi-schema
- API group:
agents.kruise.io - API version:
v1alpha1 - Types use standard Kubernetes
metav1.TypeMetaandmetav1.ObjectMetaembeddings - Use
+kubebuilder:markers for CRD schema annotations - Use
+k8s:deepcopy-genmarkers for deep-copy generation - Follow Kubernetes API conventions
schema-update.yaml— Automatically runsmake gen-openapi-schemaon push tomasterwhenagents/**files changegenerate-crd.yml— Manual workflow to generate Java CRD models from CRD YAML sourcespublish-maven-central.yml— Manual workflow to publish Java client to Maven Central
# Run go vet (the primary lint tool for this project)
make vet
# Alternatively:
go vet ./...There is no golangci-lint or similar tool configured. Use go vet for validation.
- Default branch:
master - This is a read-only synced repo — changes should originate in
openkruise/agents - The
.gitignoreexcludes:bin/,vendor/,*.test,*.out,.idea/