Documentation
¶
Overview ¶
Package agentcontroller provides immutable Agent types and a retained host runtime.
Index ¶
- Constants
- Variables
- func NewDurableCandidateExecutor(p *agentpackage.Package, e CandidateExpectations, ...) (_ qualification.Executor, err error)
- func PrepareRunBudget(candidate PreparedCandidate, binding NativeBinding, ...) (qualification.PreparedBudget, error)
- type Agent
- type BindingReference
- type CandidateExecutor
- func (x *CandidateExecutor) Calls() []qualification.BudgetCall
- func (x *CandidateExecutor) Close() error
- func (x *CandidateExecutor) Execute(ctx context.Context, slot string) (qualification.ExecutionJournal, error)
- func (x *CandidateExecutor) Info() qualification.ExecutionInfo
- func (x *CandidateExecutor) Plan() qualification.Plan
- type CandidateExpectations
- type Config
- type Controller
- type DurableExecutionConfig
- type ExecutionConfig
- type NativeBinding
- type PackageReference
- type PreparationSummary
- type PreparedCandidate
- type PreparedCase
- type Source
- type Spec
- type Status
Constants ¶
const RunnerABI = "ada-agent-chat-v1"
RunnerABI changes whenever packaged execution or frozen configuration semantics change.
Variables ¶
var ErrCandidateExecution = errors.New("candidate execution refused")
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 ¶
func NewDurableCandidateExecutor(p *agentpackage.Package, e CandidateExpectations, scope qualification.ExecutionScope, c DurableExecutionConfig) (_ qualification.Executor, err error)
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 ¶
func NewCandidateExecutor(p *agentpackage.Package, e CandidateExpectations, c ExecutionConfig) (*CandidateExecutor, error)
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 (x *CandidateExecutor) Calls() []qualification.BudgetCall
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 ¶
func (x *CandidateExecutor) Execute(ctx context.Context, slot string) (qualification.ExecutionJournal, error)
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 (x *CandidateExecutor) Info() qualification.ExecutionInfo
func (*CandidateExecutor) Plan ¶
func (x *CandidateExecutor) Plan() qualification.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 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.
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.