agentcontroller

package
v0.0.0-...-b0b31a8 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 53 Imported by: 0

Documentation

Overview

Package agentcontroller provides immutable Agent types and a retained host runtime.

Index

Constants

View Source
const RunnerABI = "ada-agent-chat-v1"

RunnerABI changes whenever packaged execution or frozen configuration semantics change.

Variables

View Source
var ErrCandidateExecution = errors.New("candidate execution refused")
View Source
var ErrPreparation = errors.New("candidate preparation refused")

ErrPreparation identifies a whole-candidate refusal. Context is fixed and deliberately excludes package contents, host values and filesystem paths.

Functions

func NewDurableCandidateExecutor

NewDurableCandidateExecutor owns one fresh journal backend and one run ledger. It freezes a private manifest before returning an executable handle. The factory/parent path are trusted host inputs, not an OS sandbox or attestation.

func PrepareRunBudget

func PrepareRunBudget(candidate PreparedCandidate, binding NativeBinding, request qualification.BudgetRequest) (qualification.PreparedBudget, error)

PrepareRunBudget anchors the candidate budget tuple to the prepared native model identity. It takes inventory from candidate, not request.Plan. Neither this pure check nor the returned budget authorizes execution or qualification; package-derived judge bindings and the runner remain separate work.

Types

type Agent

type Agent struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata"`
	Spec              Spec   `json:"spec"`
	Status            Status `json:"status,omitempty"`
}

Agent is the namespaced agents.aks-durable-agents.io/v1alpha1 resource.

type BindingReference

type BindingReference struct {
	Name string `json:"name"`
}

type CandidateExecutor

type CandidateExecutor struct {
	// contains filtered or unexported fields
}

func NewCandidateExecutor

NewCandidateExecutor reconstructs the native plan from verified package bytes. It compares only the Policy's own immutable snapshot, not an operator JSON file. Construction performs no journal, credential or provider I/O.

func (*CandidateExecutor) Calls

func (*CandidateExecutor) Close

func (x *CandidateExecutor) Close() error

Close cancels and drains only this executor's work. Its caller must keep the supplied journal backend and shared Policy open until Close has returned.

func (*CandidateExecutor) Execute

Execute admits the next planned call only. A mechanical failure stops this executor even when the provider finished but journal readback was unavailable.

func (*CandidateExecutor) Info

func (*CandidateExecutor) Plan

type CandidateExpectations

type CandidateExpectations struct {
	Workspace, Target, MemberID                      string
	ManifestDigest, CompositionDigest, ProfileDigest string
	Platform                                         core.Platform
	Binding                                          NativeBinding
	ExpiresAt                                        time.Time
}

CandidateExpectations contains only host-selected context, never evaluation inventory. Manifest/member/composition/platform must match the verified package; an optional ProfileDigest must match the exact derived native profile.

type Config

type Config struct {
	Namespace, Directory, Model string
	Binding                     []byte
	Puller                      *agentpackage.Puller
	Source                      Source
}

Config supplies host-owned settings, not fields accepted from an Agent resource. Binding is a canonicalizable non-secret snapshot; callbacks must enforce it.

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func Start

func Start(ctx context.Context, c Config, store *sqlitelog.Store, placements *placement.Registry, model execution.ModelFunc, stream execution.StreamFunc) (out *Controller, err error)

Start owns the registry, including restored retired placers, before reconciling authoritative ownership. No Sessions/admin listener is created here.

func (*Controller) Close

func (c *Controller) Close()

type DurableExecutionConfig

type DurableExecutionConfig struct {
	Directory      string
	Pricing        modeltransport.RunPricing
	MaxInputTokens *int
	Credential     azcore.TokenCredential
	Transport      *http.Transport
}

DurableExecutionConfig is host wiring. Directory must be a NEW run root under a private parent, deterministically derived by the factory from the run ID. This constructor never adopts execution state, repairs it or deletes it.

type ExecutionConfig

type ExecutionConfig struct {
	RunID      string
	Policy     *modeltransport.Policy
	Credential azcore.TokenCredential
	Transport  *http.Transport
	Journal    func(sessionID string) (eventlog.Store, error)
}

ExecutionConfig is trusted host wiring. Journal must return a fresh candidate log, never a log from the serving store. No RPC accepts this configuration. The caller owns Policy and the journal backend; credentials stay host-side.

type NativeBinding

type NativeBinding struct {
	Endpoint, Deployment, Scope string
	Policy                      json.RawMessage
	RunnerABI                   string
}

NativeBinding is the host's frozen, non-secret native binding JSON shape. Field names and encoding are shared with ordinary hosting; they are not a new persisted format. The retained manager canonicalizes these JSON bytes with JCS.

func (NativeBinding) JSON

func (b NativeBinding) JSON() ([]byte, error)

JSON preserves the host's existing json.Marshal encoding, including RawMessage.

type PackageReference

type PackageReference struct {
	Reference string `json:"reference"`
}

type PreparationSummary

type PreparationSummary struct {
	ManifestDigest                              string
	SuiteManifest                               []byte
	Member                                      core.ManifestRef
	MemberBytes                                 []byte
	Instructions                                core.FileRef
	InstructionBytes                            []byte
	Composition                                 core.CompositionRef
	CompositionBytes                            []byte
	Index                                       core.FileRef
	IndexBytes                                  []byte
	Cases                                       []PreparedCase
	AuthoredModel, Model                        string
	NativeConfig, BindingJSON, CanonicalBinding []byte
	SourceDigest                                string
}

PreparationSummary retains verified source bytes and the exact native inputs. It is not qualification, eligibility, publisher trust or execution authority.

type PreparedCandidate

type PreparedCandidate struct {
	Plan    qualification.Plan
	Summary PreparationSummary
}

func PrepareCandidate

func PrepareCandidate(p *agentpackage.Package, expected CandidateExpectations) (PreparedCandidate, error)

PrepareCandidate derives complete inventory from one verified file view. It allocates only returned data: no retained manager, store, listener or dispatch.

type PreparedCase

type PreparedCase struct {
	Ref   core.FileRef
	Bytes []byte
	Input string
}

type Source

type Source interface {
	List(context.Context) ([]Agent, string, error)
	Get(context.Context, string) (Agent, error)
	UpdateStatus(context.Context, Agent, Status) error
	Watch(context.Context, string) (watch.Interface, error)
}

Source reads a complete namespace snapshot and publishes controller-owned status.

func Kubernetes

func Kubernetes(namespace string, config *rest.Config) (Source, error)

Kubernetes uses the official in-cluster credentials when config is nil.

type Spec

type Spec struct {
	Package         PackageReference `json:"package"`
	Member          string           `json:"member"`
	ModelBindingRef BindingReference `json:"modelBindingRef"`
}

type Status

type Status struct {
	AgentUID              string             `json:"agentUID,omitempty"`
	ObservedGeneration    int64              `json:"observedGeneration,omitempty"`
	PackageDigest         string             `json:"packageDigest,omitempty"`
	Member                string             `json:"member,omitempty"`
	ResolvedBindingDigest string             `json:"resolvedBindingDigest,omitempty"`
	RevisionDigest        string             `json:"revisionDigest,omitempty"`
	HarnessName           string             `json:"harnessName,omitempty"`
	ServedDigest          string             `json:"servedDigest,omitempty"`
	Conditions            []metav1.Condition `json:"conditions,omitempty"`
}

Status records last-observed admission, not host or inference availability.

Jump to

Keyboard shortcuts

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