Documentation
¶
Overview ¶
Package orchestration coordinates multiple Cortex agents working together, in sequence, in parallel, hierarchically, via a router, or in a debate.
It depends on root domain packages, including planning, and reaches host capabilities (running an agent, emitting plugin hooks) through injected interfaces and callbacks, never by importing the engine or plugin packages.
Index ¶
- Constants
- Variables
- func AdaptPlan(cfg Config, req PlanRequest) (planning.Plan, error)
- func CheckCoordinator(ctx context.Context) error
- func ExecutionConfigDigest(cfg Config) (string, error)
- func ExecutionRoster(cfg *Config) ([]string, error)
- func InvocationSlot(ctx context.Context) string
- func IsWaiting(err error) bool
- func RequireCoordinator(ctx context.Context, team id.OrchestrationID) error
- func ReserveCoordinatorChild(ctx context.Context, req execution.ReservationRequest) (execution.Reservation, error)
- type AgentResult
- type AgentRunner
- type Blackboard
- func (b *Blackboard) Append(agentName, content string)
- func (b *Blackboard) Entries() []Entry
- func (b *Blackboard) Handoff(ctx context.Context, from, to, payload string)
- func (b *Blackboard) Handoffs() []Handoff
- func (b *Blackboard) OrchestrationID() id.OrchestrationID
- func (b *Blackboard) Read(key string) (any, bool)
- func (b *Blackboard) Roster() []Participant
- func (b *Blackboard) Snapshot() string
- func (b *Blackboard) Write(key string, val any)
- type BudgetDiscoveryStore
- type BudgetExpiryStore
- type BudgetListRequest
- type BudgetPolicy
- type BudgetSnapshot
- type BudgetStore
- type ChildObserver
- type ChildRunStore
- type Config
- type ConfigListFilter
- type ConfigStore
- type Continuation
- type ContinuationRunStore
- type ContinuationStore
- type CoordinatorClaim
- type CoordinatorLease
- type CoordinatorRequest
- type CoordinatorStore
- type CoordinatorWork
- type Entry
- type Expirer
- type ExpiryStore
- type Handoff
- type HandoffFunc
- type HookEmitter
- type InvalidDelegationPlanError
- type InvocationIntent
- type InvocationRecord
- type InvocationStore
- type Orchestrator
- type Participant
- type PlanRequest
- type ReservedAgentRunner
- type ReservedInvocation
- type Result
- type Run
- type RunListFilter
- type RunOpts
- type RunStore
- type Service
- func NewContinuableService(runner ReservedAgentRunner, observer ChildObserver, runs RunStore, ...) *Service
- func NewCoordinatedService(runner ReservedAgentRunner, observer ChildObserver, runs RunStore, ...) *Service
- func NewReservedService(runner ReservedAgentRunner, runs RunStore, hooks HookEmitter) *Service
- func NewService(runner AgentRunner, configs ConfigStore, runs RunStore, hooks HookEmitter) *Service
- func (s *Service) ResumeContinuation(ctx context.Context, team id.OrchestrationID) (*Run, error)
- func (s *Service) Run(ctx context.Context, name, input string) (*Run, error)
- func (s *Service) RunConfig(ctx context.Context, cfg Config, input string) (*Run, error)
- func (s *Service) RunConfigWithID(ctx context.Context, cfg Config, input string, team id.OrchestrationID) (*Run, error)
- func (s *Service) StartContinuation(ctx context.Context, c Continuation) (*Run, error)
- type Settings
Constants ¶
const ( StrategySequential = "sequential" StrategyParallel = "parallel" StrategyRouter = "router" StrategyHierarchical = "hierarchical" StrategyDebate = "debate" )
Strategy identifiers. A stored Config.Strategy is one of these.
const ( StatusRunning = "running" StatusWaiting = "waiting" StatusCompleted = "completed" StatusFailed = "failed" )
Orchestration run status values.
const PrefixCoordinator id.Prefix = "oclaim"
PrefixCoordinator identifies one host-owned coordinator attempt.
Variables ¶
var ErrUnknownStrategy = errors.New("orchestration: unknown strategy")
ErrUnknownStrategy is returned by Build for an unrecognized strategy name.
Functions ¶
func AdaptPlan ¶
func AdaptPlan(cfg Config, req PlanRequest) (planning.Plan, error)
AdaptPlan maps compatible legacy strategies to immutable task definitions. It never runs an agent, grants a tool, claims work or accepts a task result. Router and debate remain available through Build; they have no static mapping.
func CheckCoordinator ¶
CheckCoordinator checks current acknowledged ownership when a service pass is attached. Independent child resumes retain their existing authorization path.
func ExecutionConfigDigest ¶
ExecutionConfigDigest pins the strategy, participants, settings and scope. Display metadata and timestamps are excluded. A future dispatcher must resolve this exact configuration or explicitly replan before using changed settings.
func ExecutionRoster ¶
ExecutionRoster returns every local agent the configured strategy can invoke, including routing and synthesis agents. It validates the bounded participant list without running a strategy or resolving agent implementations.
func InvocationSlot ¶
InvocationSlot returns the strategy-defined position of this agent call. It distinguishes repeated calls to the same agent and is stable across replay of a frozen config and prior results. It is not caller authentication.
func RequireCoordinator ¶
func RequireCoordinator(ctx context.Context, team id.OrchestrationID) error
RequireCoordinator requires acknowledged ownership of this exact team.
func ReserveCoordinatorChild ¶
func ReserveCoordinatorChild(ctx context.Context, req execution.ReservationRequest) (execution.Reservation, error)
ReserveCoordinatorChild charges and links a child with acknowledged ownership. The caller still checks ownership before activation and each external call.
Types ¶
type AgentResult ¶
type AgentResult = cortex.AgentResult
RunOpts, AgentResult and AgentRunner moved to the root cortex package when a2a came to need the same seam. They are aliased here so every existing caller, every stored strategy and the engine's adapter keep compiling unchanged.
type AgentRunner ¶
type AgentRunner = cortex.AgentRunner
RunOpts, AgentResult and AgentRunner moved to the root cortex package when a2a came to need the same seam. They are aliased here so every existing caller, every stored strategy and the engine's adapter keep compiling unchanged.
type Blackboard ¶
type Blackboard struct {
// contains filtered or unexported fields
}
Blackboard is the shared, mutex-guarded state for a single orchestration run. Every participant can read/write the value map, append contributions, inspect the participant roster (awareness), and record handoffs (communication).
func NewBlackboard ¶
func NewBlackboard(orchID id.OrchestrationID, participants []Participant, onHandoff HandoffFunc) *Blackboard
NewBlackboard creates a blackboard for the given orchestration. participants seed the roster; onHandoff may be nil.
func (*Blackboard) Append ¶
func (b *Blackboard) Append(agentName, content string)
Append records a contribution from an agent into the ordered log.
func (*Blackboard) Entries ¶
func (b *Blackboard) Entries() []Entry
Entries returns a copy of the contribution log.
func (*Blackboard) Handoff ¶
func (b *Blackboard) Handoff(ctx context.Context, from, to, payload string)
Handoff records a from→to→payload handoff and fires the callback (if set).
func (*Blackboard) Handoffs ¶
func (b *Blackboard) Handoffs() []Handoff
Handoffs returns a copy of the recorded handoff log.
func (*Blackboard) OrchestrationID ¶
func (b *Blackboard) OrchestrationID() id.OrchestrationID
OrchestrationID returns the ID of the orchestration this blackboard belongs to.
func (*Blackboard) Read ¶
func (b *Blackboard) Read(key string) (any, bool)
Read returns the value for key and whether it was present.
func (*Blackboard) Roster ¶
func (b *Blackboard) Roster() []Participant
Roster returns a copy of the participant roster.
func (*Blackboard) Snapshot ¶
func (b *Blackboard) Snapshot() string
Snapshot renders the roster and prior contributions into a compact text block that strategies prepend to an agent's input, giving each agent awareness of who else is participating and what has been said so far. Returns "" when empty.
func (*Blackboard) Write ¶
func (b *Blackboard) Write(key string, val any)
Write sets a shared value.
type BudgetDiscoveryStore ¶
type BudgetDiscoveryStore interface {
ListOrchestrationBudgets(context.Context, BudgetListRequest) ([]BudgetPolicy, error)
}
BudgetDiscoveryStore includes closed accounts so interrupted parent cleanup remains discoverable. Listing a budget never grants execution authority.
type BudgetExpiryStore ¶
type BudgetExpiryStore interface {
ExpireOrchestrationBudget(context.Context, id.OrchestrationID) (bool, error)
}
BudgetExpiryStore seals admission only after the stored immutable deadline. True includes an already closed expired account. Errors grant no cleanup authority, including lost acknowledgments. Unknown usage remains reserved.
type BudgetListRequest ¶
type BudgetListRequest struct {
After id.OrchestrationID
Limit int
}
BudgetListRequest bounds exact-scope recovery discovery by immutable identity.
type BudgetPolicy ¶
type BudgetPolicy struct {
SchemaVersion int `json:"schema_version"`
ExecutionID id.OrchestrationID `json:"execution_id"`
PreparedDigest string `json:"prepared_digest"`
Scope cortex.Scope `json:"scope"`
Limits execution.Resources `json:"limits"`
Participants map[string]execution.Resources `json:"participants"`
ParticipantDigests map[string]string `json:"participant_digests,omitempty"`
Deadline time.Time `json:"deadline"`
TokenOnly bool `json:"token_only"`
PricingRevision string `json:"pricing_revision,omitempty"`
}
BudgetPolicy pins one team's shared capacity and per-invocation ceilings. Each participant may run several times, consuming another fan-out slot each time. This account is independent of task plans and grants no execution access.
func (BudgetPolicy) AccountingPolicy ¶
func (p BudgetPolicy) AccountingPolicy() execution.ReservationPolicy
AccountingPolicy adapts the team to shared reservation arithmetic. PlanID is the legacy accounting key; here it contains an orchestration ID, not a plan.
func (BudgetPolicy) Freeze ¶
func (p BudgetPolicy) Freeze() (BudgetPolicy, string, error)
Freeze validates and detaches the immutable policy.
func (BudgetPolicy) ValidateReservation ¶
func (p BudgetPolicy) ValidateReservation(r execution.ReservationRequest) error
ValidateReservation binds a leaf to this team, prepared artifact, participant and reserved agent run. PlanID identifies the team; TaskID identifies the run.
type BudgetSnapshot ¶
type BudgetSnapshot struct {
Policy BudgetPolicy `json:"policy"`
Charged execution.Resources `json:"charged"`
Overflow bool `json:"overflow"`
Reservations int `json:"reservations"`
Closed bool `json:"closed"`
}
BudgetSnapshot includes the admission seal and conservative retained charges.
type BudgetStore ¶
type BudgetStore interface {
CreateOrchestrationBudget(context.Context, BudgetPolicy) error
GetOrchestrationBudget(context.Context, id.OrchestrationID) (BudgetPolicy, error)
ReserveOrchestrationChild(context.Context, execution.ReservationRequest) (execution.Reservation, error)
SettleOrchestrationChild(context.Context, execution.Settlement) error
CloseOrchestrationBudget(context.Context, id.OrchestrationID) error
GetOrchestrationBudgetSnapshot(context.Context, id.OrchestrationID) (BudgetSnapshot, error)
GetReservation(context.Context, id.ID) (execution.Reservation, error)
ListOrchestrationReservations(context.Context, execution.ReservationListRequest) ([]execution.Reservation, error)
}
BudgetStore persists team allocations independently of plan/claim accounting. Settlement requires trusted host usage. Unknown usage remains allocated, even after closure or expiry. A historical reservation is never dispatch authority.
type ChildObserver ¶
type ChildObserver interface {
ObserveOrchestrationChild(context.Context, InvocationRecord) (*AgentResult, error)
}
ChildObserver reads an existing child without starting or resuming it. Return ErrOrchestrationWaiting only for a retained nonterminal child; mixed failures remain failures. The host authenticates child provenance and current authority.
type ChildRunStore ¶
type ChildRunStore interface {
LinkOrchestrationChild(context.Context, id.OrchestrationID, id.AgentRunID) error
}
ChildRunStore atomically links one reserved child while its parent is running. A link is single-use. Duplicate or uncertain acknowledgments never authorize another execution. Implementations preserve linked IDs through later updates.
type Config ¶
type Config struct {
cortex.Entity
ID id.OrchestrationConfigID `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Scope cortex.Scope `json:"scope"`
Strategy string `json:"strategy"`
Participants []Participant `json:"participants"`
Settings Settings `json:"settings,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
Config is a stored, named definition of a multi-agent orchestration: a strategy plus its participant agents and tunables.
type ConfigListFilter ¶
ConfigListFilter controls pagination and filtering for orchestration listing. Scope arrives on the context; Exact narrows to rows stored at precisely that depth instead of everything beneath it.
type ConfigStore ¶
type ConfigStore interface {
CreateOrchestration(ctx context.Context, c *Config) error
GetOrchestration(ctx context.Context, orchID id.OrchestrationConfigID) (*Config, error)
GetOrchestrationByName(ctx context.Context, name string) (*Config, error)
UpdateOrchestration(ctx context.Context, c *Config) error
DeleteOrchestration(ctx context.Context, orchID id.OrchestrationConfigID) error
ListOrchestrations(ctx context.Context, filter *ConfigListFilter) ([]*Config, error)
CountOrchestrations(ctx context.Context, filter *ConfigListFilter) (int64, error)
}
ConfigStore defines persistence for orchestration configs.
type Continuation ¶
type Continuation struct {
SchemaVersion int `json:"schema_version"`
OrchestrationID id.OrchestrationID `json:"orchestration_id"`
Scope cortex.Scope `json:"scope"`
Config Config `json:"config"`
Input string `json:"input"`
Payload []byte `json:"payload"`
}
Continuation freezes the strategy, original input and host execution snapshot. Payload is private host data, not authority. Hosts must revalidate it on resume.
func (Continuation) Freeze ¶
func (c Continuation) Freeze() (Continuation, string, error)
Freeze detaches a bounded continuation and checks the executable roster.
type ContinuationRunStore ¶
type ContinuationRunStore interface {
RunStore
ChildRunStore
ClaimOrchestrationContinuation(context.Context, id.OrchestrationID) (*Run, error)
}
ContinuationRunStore claims a waiting parent once before another strategy pass. A lost acknowledgment requires reconciliation; a read is not a replacement claim.
type ContinuationStore ¶
type ContinuationStore interface {
InvocationStore
PutOrchestrationContinuation(context.Context, Continuation) error
GetOrchestrationContinuation(context.Context, id.OrchestrationID) (Continuation, error)
PutOrchestrationInvocationResult(context.Context, InvocationIntent, AgentResult) error
GetOrchestrationInvocationResult(context.Context, InvocationIntent) (*AgentResult, error)
}
ContinuationStore retains immutable strategy snapshots and completed results. Identical snapshot/result writes may succeed; neither grants dispatch rights.
type CoordinatorClaim ¶
type CoordinatorClaim struct {
Lease CoordinatorLease
Run *Run
}
CoordinatorClaim contains the parent snapshot acknowledged with ownership.
type CoordinatorLease ¶
type CoordinatorLease struct {
SchemaVersion int `json:"schema_version"`
TeamID id.OrchestrationID `json:"team_id"`
Scope cortex.Scope `json:"scope"`
Owner id.ID `json:"owner"`
Generation int64 `json:"generation"`
Revision int64 `json:"revision"`
AcquiredAt time.Time `json:"acquired_at"`
ExpiresAt time.Time `json:"expires_at"`
Released bool `json:"released"`
PreviousDigest string `json:"previous_digest,omitempty"`
}
CoordinatorLease retains immutable ownership history. Renewal advances Revision without changing Generation. A new owner advances both. A read is evidence only; dispatch also needs an acknowledged claim and current checks.
func (CoordinatorLease) Freeze ¶
func (l CoordinatorLease) Freeze() (CoordinatorLease, string, error)
Freeze validates and detaches a bounded ownership observation.
type CoordinatorRequest ¶
type CoordinatorRequest struct {
TeamID id.OrchestrationID
Owner id.ID
ExpectedGeneration int64
Duration time.Duration
Initial bool
}
CoordinatorRequest claims one parent generation. Initial is valid only for a newly created running parent without prior ownership. Repeated requests never grant another execution, even when an acknowledgment was lost.
type CoordinatorStore ¶
type CoordinatorStore interface {
AcquireOrchestrationCoordinator(context.Context, CoordinatorRequest) (CoordinatorClaim, error)
GetOrchestrationCoordinator(context.Context, id.OrchestrationID) (CoordinatorLease, error)
CheckOrchestrationCoordinator(context.Context, CoordinatorLease) (CoordinatorLease, error)
RenewOrchestrationCoordinator(context.Context, CoordinatorLease, time.Duration) (CoordinatorLease, error)
FinishOrchestrationCoordinator(context.Context, CoordinatorLease, *Run) error
BeginCoordinatedInvocation(context.Context, CoordinatorLease, InvocationIntent) error
ReserveCoordinatedChild(context.Context, CoordinatorLease, execution.ReservationRequest) (execution.Reservation, error)
}
CoordinatorStore serializes ownership, parent fences and admission under one account lock. Lost acknowledgments grant no execution. Finish releases a waiting pass or atomically closes a terminal parent's account. The ordinary unowned mutation paths cannot modify a leased parent or admit its children.
type CoordinatorWork ¶
CoordinatorWork reconciles host-owned child work while the coordinator lease is active. Waiting keeps the parent resumable without restarting a child.
type Expirer ¶
type Expirer struct {
// contains filtered or unexported fields
}
Expirer closes expired admission before finalizing prepared parent records. It never executes or resumes children, settles usage, or declares effects absent.
func NewExpirer ¶
func NewExpirer(store ExpiryStore) (*Expirer, error)
NewExpirer validates the explicitly supplied storage capability.
type ExpiryStore ¶
type ExpiryStore interface {
BudgetExpiryStore
GetOrchestrationRun(context.Context, id.OrchestrationID) (*Run, error)
UpdateOrchestrationRun(context.Context, *Run) error
}
ExpiryStore combines atomic budget expiry with fenced parent updates.
type Handoff ¶
type Handoff struct {
From string `json:"from"`
To string `json:"to"`
Payload string `json:"payload,omitempty"`
}
Handoff records one agent passing work to another.
type HandoffFunc ¶
HandoffFunc is invoked whenever an agent hands off to another. The engine wires this to plugin hook emission; tests pass their own.
type HookEmitter ¶
type HookEmitter interface {
OrchestrationStarted(ctx context.Context, orchID id.OrchestrationID, strategy string)
OrchestrationCompleted(ctx context.Context, orchID id.OrchestrationID, elapsed time.Duration)
AgentHandoff(ctx context.Context, orchID id.OrchestrationID, from, to, payload string)
}
HookEmitter receives orchestration lifecycle events. The engine adapts the plugin.Registry to this interface; tests pass a recorder.
type InvalidDelegationPlanError ¶
type InvalidDelegationPlanError struct{ Reason string }
InvalidDelegationPlanError identifies a rejected plan without exposing model text.
func (*InvalidDelegationPlanError) Error ¶
func (e *InvalidDelegationPlanError) Error() string
func (*InvalidDelegationPlanError) Unwrap ¶
func (e *InvalidDelegationPlanError) Unwrap() error
Unwrap supports errors.Is with cortex.ErrInvalidDelegationPlan.
type InvocationIntent ¶
type InvocationIntent struct {
SchemaVersion int `json:"schema_version"`
OrchestrationID id.OrchestrationID `json:"orchestration_id"`
Scope cortex.Scope `json:"scope"`
Slot string `json:"slot"`
AgentName string `json:"agent_name"`
RequestDigest string `json:"request_digest"`
}
InvocationIntent binds one strategy slot to its exact request without storing private input. A retained intent is reconciliation evidence, never permission to reserve or execute the slot again.
func (InvocationIntent) Freeze ¶
func (in InvocationIntent) Freeze() (InvocationIntent, string, error)
Freeze validates and detaches the bounded invocation identity.
func (InvocationIntent) ValidateResult ¶
func (intent InvocationIntent) ValidateResult(result *AgentResult) error
ValidateResult checks the bounded successful result shape before replay storage.
type InvocationRecord ¶
type InvocationRecord struct {
Intent InvocationIntent `json:"intent"`
RunID id.AgentRunID `json:"run_id,omitempty"`
}
InvocationRecord retains admission intent and the identity returned by reserve. A zero RunID means reservation may not have run or its acknowledgment was lost.
type InvocationStore ¶
type InvocationStore interface {
BeginOrchestrationInvocation(context.Context, InvocationIntent) error
BindOrchestrationInvocation(context.Context, InvocationIntent, id.AgentRunID) error
GetOrchestrationInvocation(context.Context, id.OrchestrationID, string) (InvocationRecord, error)
}
InvocationStore admits a slot once and binds its reserved identity once. Even identical repeated writes return an error. Reads grant no dispatch rights. Every operation uses the caller's exact scope.
type Orchestrator ¶
type Orchestrator interface {
Strategy() string
Run(ctx context.Context, input string, bb *Blackboard) (*Result, error)
}
Orchestrator is one multi-agent execution strategy. Implementations live in Plan 2 (sequential.go, parallel.go, router.go, hierarchical.go, debate.go).
func Build ¶
func Build(strategy string, runner AgentRunner, parts []Participant, settings Settings) (Orchestrator, error)
Build constructs the Orchestrator for a strategy name. parts and settings come from the Config.
type Participant ¶
type Participant struct {
AgentName string `json:"agent_name"`
Role string `json:"role,omitempty"` // e.g. "manager", "worker", "critic", "judge"
Skills []string `json:"skills,omitempty"` // advisory; shown in the roster
}
Participant is one agent in an orchestration, with metadata used for awareness: the roster of participants is surfaced to each agent so it knows who else is taking part and in what role.
type PlanRequest ¶
type PlanRequest struct {
Template planning.Plan
Limits planning.Limits
DelegationPlan string
DelegationSource string
}
PlanRequest supplies host-authored task templates with stable IDs and empty dependency lists. Hierarchical input must have a matching captured source in Template.Sources and in every worker's source requirements. The host retains those source bytes in its authorized evidence repository before adaptation.
type ReservedAgentRunner ¶
type ReservedAgentRunner = cortex.ReservedAgentRunner
ReservedAgentRunner reserves bounded capacity and an identity without calling a provider or executing agent tools. Return the invocation alongside an error when its identity needs reconciliation. The service persists that identity before execution and never executes an invocation returned with an error.
type ReservedInvocation ¶
type ReservedInvocation = cortex.ReservedInvocation
ReservedInvocation identifies a child before execution. Execute must start that exact run at most once. An unexecuted reservation retains its allocation until the host can prove that releasing it is safe.
type Result ¶
type Result struct {
OrchestrationID id.OrchestrationID `json:"orchestration_id"`
Strategy string `json:"strategy"`
Output string `json:"output"`
AgentResults []AgentResult `json:"agent_results,omitempty"`
Handoffs []Handoff `json:"handoffs,omitempty"`
Elapsed time.Duration `json:"elapsed"`
Err error `json:"-"`
}
Result is the outcome of an orchestration run.
type Run ¶
type Run struct {
// ContinuationGeneration fences coordinator snapshots across waiting passes.
// It is internal storage state and is not accepted through JSON APIs.
ContinuationGeneration int64 `json:"-"`
cortex.Entity
ID id.OrchestrationID `json:"id"`
ConfigID id.OrchestrationConfigID `json:"config_id,omitempty"` // empty for programmatic runs
Scope cortex.Scope `json:"scope"`
Strategy string `json:"strategy"`
Status string `json:"status"`
Input string `json:"input"`
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
AgentRunIDs []id.AgentRunID `json:"agent_run_ids,omitempty"`
StartedAt time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
Run is the persisted execution record of one orchestration.
type RunListFilter ¶
RunListFilter controls pagination and filtering for orchestration run listing. Scope arrives on the context; Exact narrows to rows stored at precisely that depth instead of everything beneath it.
type RunOpts ¶
RunOpts, AgentResult and AgentRunner moved to the root cortex package when a2a came to need the same seam. They are aliased here so every existing caller, every stored strategy and the engine's adapter keep compiling unchanged.
type RunStore ¶
type RunStore interface {
CreateOrchestrationRun(ctx context.Context, r *Run) error
GetOrchestrationRun(ctx context.Context, runID id.OrchestrationID) (*Run, error)
UpdateOrchestrationRun(ctx context.Context, r *Run) error
ListOrchestrationRuns(ctx context.Context, filter *RunListFilter) ([]*Run, error)
CountOrchestrationRuns(ctx context.Context, filter *RunListFilter) (int64, error)
}
RunStore defines persistence for orchestration run records.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service runs stored orchestration configs end to end.
func NewContinuableService ¶
func NewContinuableService(runner ReservedAgentRunner, observer ChildObserver, runs RunStore, hooks HookEmitter) *Service
NewContinuableService uses reserved execution and durable strategy replay. It requires both continuation capabilities from runs before starting work.
func NewCoordinatedService ¶
func NewCoordinatedService(runner ReservedAgentRunner, observer ChildObserver, runs RunStore, hooks HookEmitter) *Service
NewCoordinatedService adds expiring ownership to durable strategy replay. Its reserved runner must use ReserveCoordinatorChild for atomic admission.
func NewReservedService ¶
func NewReservedService(runner ReservedAgentRunner, runs RunStore, hooks HookEmitter) *Service
NewReservedService builds a service that records child identities before execution. Use RunConfig or RunConfigWithID with a captured configuration.
func NewService ¶
func NewService(runner AgentRunner, configs ConfigStore, runs RunStore, hooks HookEmitter) *Service
NewService builds a Service. hooks may be nil (a no-op emitter is used).
func (*Service) ResumeContinuation ¶
ResumeContinuation replays saved results and admits only previously absent invocation slots. It never invokes an existing reserved child a second time.
func (*Service) Run ¶
Run loads the named config, executes the strategy, persists a Run, and fires lifecycle hooks. The returned run reflects the final state.
func (*Service) RunConfig ¶
RunConfig executes the supplied config without reading ConfigStore. Execution fields are detached before hooks or agents run. The injected runner remains responsible for participant preparation, authorization and shared budgets. Reserved runners persist child identities before execution; ordinary runners persist them when they return. A failed write stops subsequent admission.
func (*Service) RunConfigWithID ¶
func (s *Service) RunConfigWithID(ctx context.Context, cfg Config, input string, team id.OrchestrationID) (*Run, error)
RunConfigWithID executes a fresh team under a host-selected budget account ID. The run store must reject duplicate IDs, including concurrent creation. This method cannot resume or restart an existing team.
func (*Service) StartContinuation ¶
StartContinuation persists the frozen snapshot before creating the parent.
type Settings ¶
type Settings struct {
PlanRepairAttempts int `json:"plan_repair_attempts,omitempty"` // hierarchical: 0 or 1 additional manager call
MaxConcurrency int `json:"max_concurrency,omitempty"` // parallel / hierarchical worker fan-out cap
Rounds int `json:"rounds,omitempty"` // debate rounds
Manager string `json:"manager,omitempty"` // hierarchical: manager agent name
Judge string `json:"judge,omitempty"` // debate: judge agent name
Aggregator string `json:"aggregator,omitempty"` // parallel: optional aggregator agent name
RouterAgent string `json:"router_agent,omitempty"` // router: agent that decides (optional)
RouterRules map[string]string `json:"router_rules,omitempty"` // router: keyword→agent static rules
Model string `json:"model,omitempty"` // model for meta-decisions (router/judge/manager)
}
Settings carries every strategy's tunables in one struct. Fields a given strategy does not use are ignored.