Documentation
¶
Index ¶
- Constants
- Variables
- func ActorHost(actorID string, suffix string) string
- func ActorID(ah *v1alpha2.AgentHarness) string
- func ActorStatusLabel(status ateapipb.Actor_Status) string
- func GatewayRouterTarget(routerURL, actorID string) (*url.URL, string, error)
- func HarnessNameFromLabels(labels map[string]string) string
- func ResolveGatewayToken(ctx context.Context, kube client.Client, ah *v1alpha2.AgentHarness) (string, error)
- func SandboxAgentActorID(sa *v1alpha2.SandboxAgent) string
- func SandboxAgentActorTemplateName(sa *v1alpha2.SandboxAgent) string
- func SandboxAgentNameFromLabels(labels map[string]string) string
- func SandboxAgentSessionActorID(sa *v1alpha2.SandboxAgent, sessionID string) string
- type AgentHarnessLifecycle
- type AgentsBackend
- func (b *AgentsBackend) BuildSandbox(ctx context.Context, in sandboxbackend.BuildInput) ([]client.Object, error)
- func (b *AgentsBackend) ComputeReady(ctx context.Context, cl client.Client, nn types.NamespacedName) (metav1.ConditionStatus, string, string)
- func (b *AgentsBackend) GetOwnedResourceTypes() []client.Object
- func (b *AgentsBackend) OwnedResourceTypesFor(_ v1alpha2.AgentObject) ([]client.Object, error)
- type ClawBackend
- func (b *ClawBackend) DeleteAgentHarness(ctx context.Context, h sandboxbackend.Handle) (bool, error)
- func (b *ClawBackend) EnsureAgentHarness(ctx context.Context, ah *v1alpha2.AgentHarness) (sandboxbackend.EnsureResult, error)
- func (b *ClawBackend) GetStatus(ctx context.Context, h sandboxbackend.Handle) (metav1.ConditionStatus, string, string)
- func (b *ClawBackend) Name() v1alpha2.AgentHarnessBackendType
- func (b *ClawBackend) OnAgentHarnessReady(_ context.Context, _ *v1alpha2.AgentHarness, _ sandboxbackend.Handle) error
- type Client
- func (c *Client) Close() error
- func (c *Client) CreateActor(ctx context.Context, actorID, tmplNS, tmplName string) (*ateapipb.Actor, error)
- func (c *Client) DeleteActor(ctx context.Context, actorID string) error
- func (c *Client) GetActor(ctx context.Context, actorID string) (*ateapipb.Actor, error)
- func (c *Client) ListActors(ctx context.Context) ([]*ateapipb.Actor, error)
- func (c *Client) ListWorkers(ctx context.Context) ([]*ateapipb.Worker, error)
- func (c *Client) ResumeActor(ctx context.Context, actorID string) (*ateapipb.Actor, error)
- func (c *Client) SuspendActor(ctx context.Context, actorID string) error
- type Config
- type Lifecycle
- func (p *Lifecycle) ActorTemplateReady(ctx context.Context, key types.NamespacedName) (bool, error)
- func (p *Lifecycle) CleanupGeneratedTemplate(ctx context.Context, ah *v1alpha2.AgentHarness) (bool, error)
- func (p *Lifecycle) CleanupSandboxAgentTemplate(ctx context.Context, sa *v1alpha2.SandboxAgent) (bool, error)
- func (p *Lifecycle) EnsureGeneratedTemplate(ctx context.Context, ah *v1alpha2.AgentHarness) (LifecycleState, error)
- type LifecycleDefaults
- type LifecycleState
- type SandboxAgentActorBackend
- func (b *SandboxAgentActorBackend) DeleteAllSandboxAgentActors(ctx context.Context, sa *v1alpha2.SandboxAgent) (bool, error)
- func (b *SandboxAgentActorBackend) DeleteSandboxAgentActor(ctx context.Context, actorID string) (bool, error)
- func (b *SandboxAgentActorBackend) DeleteSandboxAgentSessionActor(ctx context.Context, sa *v1alpha2.SandboxAgent, sessionID string) (bool, error)
- func (b *SandboxAgentActorBackend) EnsureSessionActor(ctx context.Context, sa *v1alpha2.SandboxAgent, sessionID string) (sandboxbackend.EnsureResult, error)
- func (b *SandboxAgentActorBackend) SuspendSessionActor(ctx context.Context, sa *v1alpha2.SandboxAgent, sessionID string) error
Constants ¶
const DefaultAtenetRouterURL = "http://atenet-router.ate-system.svc:80"
DefaultAtenetRouterURL is the in-cluster HTTP endpoint for Substrate's Envoy router.
const GatewayTokenSecretKey = "token"
GatewayTokenSecretKey is the Secret data key used for per-harness OpenClaw gateway tokens.
const HarnessLabelKey = "kagent.dev/agent-harness"
HarnessLabelKey labels substrate lifecycle managed for an AgentHarness.
const (
SandboxAgentLabelKey = "kagent.dev/sandbox-agent"
)
Variables ¶
var ErrNoFreeWorkers = errors.New("substrate worker pool has no free workers; try again later or increase WorkerPool replicas")
ErrNoFreeWorkers is returned when ate-api cannot assign a WorkerPool worker to resume an actor.
Functions ¶
func ActorID ¶
func ActorID(ah *v1alpha2.AgentHarness) string
ActorID returns a stable DNS-1123 actor id for this harness.
func ActorStatusLabel ¶
func ActorStatusLabel(status ateapipb.Actor_Status) string
ActorStatusLabel returns a stable human-readable actor status.
func GatewayRouterTarget ¶
GatewayRouterTarget returns the atenet-router reverse-proxy URL and Host header for an actor.
func HarnessNameFromLabels ¶
HarnessNameFromLabels returns the AgentHarness name from generated lifecycle labels.
func ResolveGatewayToken ¶
func ResolveGatewayToken(ctx context.Context, kube client.Client, ah *v1alpha2.AgentHarness) (string, error)
ResolveGatewayToken returns the per-harness gateway token. Token source is validated at admission via AgentHarnessSubstrateSpec CEL rules.
func SandboxAgentActorID ¶
func SandboxAgentActorID(sa *v1alpha2.SandboxAgent) string
SandboxAgentActorID returns the legacy stable actor id prefix for a SandboxAgent.
func SandboxAgentActorTemplateName ¶
func SandboxAgentActorTemplateName(sa *v1alpha2.SandboxAgent) string
SandboxAgentActorTemplateName is the generated ActorTemplate name for a SandboxAgent.
func SandboxAgentNameFromLabels ¶
SandboxAgentNameFromLabels returns the SandboxAgent name from generated lifecycle labels.
func SandboxAgentSessionActorID ¶
func SandboxAgentSessionActorID(sa *v1alpha2.SandboxAgent, sessionID string) string
SandboxAgentSessionActorID returns a stable ate-api actor id for a SandboxAgent chat session.
Types ¶
type AgentHarnessLifecycle ¶
type AgentHarnessLifecycle interface {
EnsureGeneratedTemplate(ctx context.Context, ah *v1alpha2.AgentHarness) (LifecycleState, error)
CleanupGeneratedTemplate(ctx context.Context, ah *v1alpha2.AgentHarness) (bool, error)
}
AgentHarnessLifecycle is the substrate lifecycle surface used by the AgentHarness controller.
type AgentsBackend ¶
AgentsBackend implements sandboxbackend.Backend for declarative/BYO SandboxAgents on Agent Substrate.
func NewAgentsBackend ¶
func NewAgentsBackend(lifecycle *Lifecycle, ate *Client) *AgentsBackend
NewAgentsBackend returns a substrate sandbox backend for SandboxAgent resources.
func (*AgentsBackend) BuildSandbox ¶
func (b *AgentsBackend) BuildSandbox(ctx context.Context, in sandboxbackend.BuildInput) ([]client.Object, error)
func (*AgentsBackend) ComputeReady ¶
func (b *AgentsBackend) ComputeReady(ctx context.Context, cl client.Client, nn types.NamespacedName) (metav1.ConditionStatus, string, string)
func (*AgentsBackend) GetOwnedResourceTypes ¶
func (b *AgentsBackend) GetOwnedResourceTypes() []client.Object
func (*AgentsBackend) OwnedResourceTypesFor ¶
func (b *AgentsBackend) OwnedResourceTypesFor(_ v1alpha2.AgentObject) ([]client.Object, error)
type ClawBackend ¶
type ClawBackend struct {
// contains filtered or unexported fields
}
ClawBackend implements AsyncBackend for OpenClaw/NemoClaw on Agent Substrate.
func NewOpenClawBackend ¶
func NewOpenClawBackend(client *Client, backend v1alpha2.AgentHarnessBackendType, recorder record.EventRecorder) *ClawBackend
NewOpenClawBackend returns a substrate backend for openclaw/nemoclaw harness types.
func (*ClawBackend) DeleteAgentHarness ¶
func (b *ClawBackend) DeleteAgentHarness(ctx context.Context, h sandboxbackend.Handle) (bool, error)
func (*ClawBackend) EnsureAgentHarness ¶
func (b *ClawBackend) EnsureAgentHarness(ctx context.Context, ah *v1alpha2.AgentHarness) (sandboxbackend.EnsureResult, error)
func (*ClawBackend) GetStatus ¶
func (b *ClawBackend) GetStatus(ctx context.Context, h sandboxbackend.Handle) (metav1.ConditionStatus, string, string)
func (*ClawBackend) Name ¶
func (b *ClawBackend) Name() v1alpha2.AgentHarnessBackendType
func (*ClawBackend) OnAgentHarnessReady ¶
func (b *ClawBackend) OnAgentHarnessReady(_ context.Context, _ *v1alpha2.AgentHarness, _ sandboxbackend.Handle) error
type Client ¶
type Client struct {
ateapipb.ControlClient
// contains filtered or unexported fields
}
Client wraps ate-api Control gRPC.
func (*Client) CreateActor ¶
func (*Client) DeleteActor ¶
func (*Client) ListActors ¶
ListActors returns all actors reflected in ate-api.
func (*Client) ListWorkers ¶
ListWorkers returns all workers reflected in ate-api.
func (*Client) ResumeActor ¶
type Config ¶
type Config struct {
// AteAPIEndpoint is a gRPC target (e.g. dns:///api.ate-system.svc:443).
AteAPIEndpoint string
// TokenFile is a path to a file containing a bearer token for ate-api.
TokenFile string
Insecure bool
DialTimeout time.Duration
CallTimeout time.Duration
}
Config holds connection settings for Agent Substrate ate-api.
type Lifecycle ¶
type Lifecycle struct {
Client client.Client
Defaults LifecycleDefaults
AteClient *Client
}
Lifecycle reconciles the Kubernetes lifecycle that kagent owns for a substrate AgentHarness. WorkerPools are externally owned; this helper only resolves the selected WorkerPool.
func NewLifecycle ¶
func NewLifecycle(kube client.Client, defaults LifecycleDefaults, ateClient *Client) *Lifecycle
func (*Lifecycle) ActorTemplateReady ¶
ActorTemplateReady reports whether the ActorTemplate golden snapshot is ready.
func (*Lifecycle) CleanupGeneratedTemplate ¶
func (p *Lifecycle) CleanupGeneratedTemplate(ctx context.Context, ah *v1alpha2.AgentHarness) (bool, error)
CleanupGeneratedTemplate removes external Substrate actors that Kubernetes garbage collection cannot see. The generated ActorTemplate CR is deleted by owner-reference garbage collection after the AgentHarness finalizer is removed. WorkerPools are externally owned and are never deleted here.
func (*Lifecycle) CleanupSandboxAgentTemplate ¶
func (p *Lifecycle) CleanupSandboxAgentTemplate(ctx context.Context, sa *v1alpha2.SandboxAgent) (bool, error)
CleanupSandboxAgentTemplate removes external Substrate actors tied to a generated SandboxAgent ActorTemplate.
func (*Lifecycle) EnsureGeneratedTemplate ¶
func (p *Lifecycle) EnsureGeneratedTemplate(ctx context.Context, ah *v1alpha2.AgentHarness) (LifecycleState, error)
EnsureGeneratedTemplate creates or updates the generated ActorTemplate and reports whether it is Ready.
type LifecycleDefaults ¶
type LifecycleDefaults struct {
PauseImage string
RunscAMD64URL string
RunscAMD64SHA256 string
RunscARM64URL string
RunscARM64SHA256 string
DefaultWorkloadImage string
DefaultWorkerPool types.NamespacedName
}
LifecycleDefaults are cluster-wide defaults for generated ActorTemplate lifecycle.
type LifecycleState ¶
type LifecycleState struct {
ActorTemplateReady bool
}
LifecycleState describes the generated Substrate lifecycle for an AgentHarness.
type SandboxAgentActorBackend ¶
type SandboxAgentActorBackend struct {
// contains filtered or unexported fields
}
SandboxAgentActorBackend manages ate-api actors for SandboxAgent workloads.
func NewSandboxAgentActorBackend ¶
func NewSandboxAgentActorBackend(client *Client, atenetRouterURL string) *SandboxAgentActorBackend
NewSandboxAgentActorBackend returns a backend that ensures SandboxAgent actors on ate-api.
func (*SandboxAgentActorBackend) DeleteAllSandboxAgentActors ¶
func (b *SandboxAgentActorBackend) DeleteAllSandboxAgentActors(ctx context.Context, sa *v1alpha2.SandboxAgent) (bool, error)
DeleteAllSandboxAgentActors deletes legacy per-agent actors and all session actors for a SandboxAgent.
func (*SandboxAgentActorBackend) DeleteSandboxAgentActor ¶
func (b *SandboxAgentActorBackend) DeleteSandboxAgentActor(ctx context.Context, actorID string) (bool, error)
DeleteSandboxAgentActor deletes a substrate actor by id.
func (*SandboxAgentActorBackend) DeleteSandboxAgentSessionActor ¶
func (b *SandboxAgentActorBackend) DeleteSandboxAgentSessionActor(ctx context.Context, sa *v1alpha2.SandboxAgent, sessionID string) (bool, error)
DeleteSandboxAgentSessionActor deletes the actor for a single chat session.
func (*SandboxAgentActorBackend) EnsureSessionActor ¶
func (b *SandboxAgentActorBackend) EnsureSessionActor(ctx context.Context, sa *v1alpha2.SandboxAgent, sessionID string) (sandboxbackend.EnsureResult, error)
EnsureSessionActor creates and resumes the per-session actor for a SandboxAgent chat.
func (*SandboxAgentActorBackend) SuspendSessionActor ¶
func (b *SandboxAgentActorBackend) SuspendSessionActor(ctx context.Context, sa *v1alpha2.SandboxAgent, sessionID string) error
SuspendSessionActor checkpoints and frees the worker for a chat session actor.