How openkruise/agents works
OpenKruise Agents is a Kubernetes platform for provisioning and operating AI-agent sandboxes, exposed through Kubernetes resources and E2B-compatible APIs. Users submit sandbox templates, claims, sets, or E2B requests; controllers reconcile workloads, storage, scaling, identity and lifecycle, while gateways route authenticated traffic. The graph preserves those major capabilities and the internal route, quota, and storage layers. Several subsystem links are documented by the README or SOURCE INDEX; unsampled implementation details are not treated as verified calls.
Main entry points: routes.go E2B API · server.go Sandbox gateway · gateway_controller.go Route registry feed · storages_provider.go Persistent storage
Components 25
Kubernetes API
- Sandbox CRDs
api/v1alpha1/sandbox_types.go - Identity CRDs
api/security/v1alpha1/agentidentity_types.go - Kubernetes SDK
client/clientset/versioned/clientset.go - Admission webhooks
pkg/webhook/server.go
Sandbox orchestration
- Sandbox lifecycle
pkg/controller/sandbox/sandbox_controller.go - Sandbox claims
pkg/controller/sandboxclaim/sandboxclaim_controller.go - Sandbox sets
pkg/controller/sandboxset/sandboxset_controller.go - Pool autoscaling
pkg/controller/poolautoscaler/poolautoscaler_controller.go - Sandbox updates
pkg/controller/sandboxupdateops/sandboxupdateops_controller.go - Sandbox commits
pkg/controller/commit/commit_controller.go - Sandbox manager
cmd/sandbox-manager/main.go - Sandbox infrastructure
pkg/sandbox-manager/infra/sandboxcr/infra.go
API and traffic access
- E2B API
pkg/servers/e2b/routes.go - Sandbox gateway
pkg/sandbox-gateway/server/server.go - Route registry feed
pkg/sandbox-gateway/controller/gateway_controller.go - JWT authentication
pkg/sandbox-gateway/jwtauth/manager.go - Route synchronization
pkg/sandboxroute/refresh/handler.go - Route and peer proxy
pkg/proxy/routes.go
Identity and storage
- Agent identity
pkg/agentidentity/agentidentity_controller.go - Security token refresh
pkg/controller/securitytokenrefresh/token_refresh_controller.go - Persistent storage
pkg/utils/csiutils/storages_provider.go - Storage providers
pkg/agent-runtime/storages/storage_provider.go
Other components
- Platform user
- Kubernetes cluster
- E2B client
Connections 28
- Platform user → Sandbox CRDs: defines resources
README.md - Platform user → E2B API: sends requests
README.md - Platform user → Kubernetes SDK: uses SDK
README.md - E2B client → E2B API: calls API
pkg/servers/e2b/routes.go - Kubernetes SDK → Kubernetes cluster: accesses resources
client/clientset/versioned/clientset.go - Sandbox lifecycle → Kubernetes cluster: reconciles workloads
pkg/controller/sandbox/sandbox_controller.go - Sandbox claims → Kubernetes cluster: reconciles claims
pkg/controller/sandboxclaim/sandboxclaim_controller.go - Sandbox sets → Kubernetes cluster: reconciles sets
pkg/controller/sandboxset/sandboxset_controller.go - Pool autoscaling → Sandbox sets: scales target
pkg/controller/poolautoscaler/poolautoscaler_controller.go - Sandbox updates → Kubernetes cluster: patches resources
pkg/controller/sandboxupdateops/sandboxupdateops_controller.go - Sandbox commits → Kubernetes cluster: reads resources
pkg/controller/commit/commit_controller.go - Sandbox manager → E2B API: starts API
cmd/sandbox-manager/main.go - Sandbox manager → Sandbox infrastructure: configures infrastructure
cmd/sandbox-manager/main.go - E2B API → Sandbox manager: manages sandboxes
README.md - Sandbox gateway → Route registry feed: starts route feed
- Sandbox gateway → Route synchronization: starts peer server
- Sandbox gateway → Route and peer proxy: uses proxy
pkg/sandbox-gateway/server/server.go - Route registry feed → JWT authentication: configures reader
pkg/sandbox-gateway/controller/gateway_controller.go - Route registry feed → Kubernetes cluster: watches sandboxes
pkg/sandbox-gateway/controller/gateway_controller.go - Route synchronization → Route and peer proxy: refreshes routes
- Route and peer proxy → Route synchronization: accepts refreshes
pkg/proxy/routes.go - Agent identity → Identity CRDs: validates identities
pkg/agentidentity/agentidentity_controller.go - Agent identity → Kubernetes cluster: reads config
pkg/agentidentity/agentidentity_controller.go - Security token refresh → Kubernetes cluster: reconciles tokens
pkg/controller/securitytokenrefresh/token_refresh_controller.go - Sandbox lifecycle → Persistent storage: provisions volumes
- Persistent storage → Storage providers: selects provider
pkg/utils/csiutils/storages_provider.go - Persistent storage → Kubernetes cluster: reads volumes
pkg/utils/csiutils/storages_provider.go - Admission webhooks → Kubernetes cluster: registers admission