orchestrator

package
v0.411.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package orchestrator coordinates agent tasks and dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	StorePath   string
	LogDir      string
	MaxParallel int
	// DefaultMCPConfig is an optional explicit override for the MCP config file
	// passed to subagents. When empty (the default), pando builds a dynamic
	// config at spawn time that includes pando itself as an MCP server plus all
	// configured MCP servers.
	DefaultMCPConfig string
	DefaultEngine    string
	PersonaPath      string
	AppConfig        *mesnadaconfig.Config // Full app config for passing to managers
	// MCPServers lists the MCP servers configured in pando that should be
	// forwarded to subagents. Populated from the pando application config.
	MCPServers []agent.PandoMCPServerEntry
	// GatewayExposeEnabled indicates that MCPGateway re-exports all configured
	// MCP servers through pando's own MCP server. When true, the individual
	// MCPServers entries are not forwarded separately (they are already
	// accessible via the "pando" MCP server entry).
	GatewayExposeEnabled bool
	// ModelResolver converts a model ID (possibly empty or shorthand) into the
	// full "provider.model" string expected by the pando CLI's -m flag.
	// When nil, model IDs are forwarded as-is to the pando CLI spawner.
	ModelResolver func(string) string
}

Config holds orchestrator configuration.

type Orchestrator

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

Orchestrator coordinates the execution of CLI agents.

func New

func New(cfg Config) (*Orchestrator, error)

New creates a new Orchestrator.

func (*Orchestrator) ACPSessionControl

func (o *Orchestrator) ACPSessionControl(taskID, action, message, mode string) (interface{}, error)

ACPSessionControl sends a control command to an active ACP session. This delegates to the agent manager's ACP session control.

func (*Orchestrator) Cancel

func (o *Orchestrator) Cancel(taskID string) error

Cancel cancels a running task.

func (*Orchestrator) Delete

func (o *Orchestrator) Delete(taskID string) error

Delete removes a task from the store. If the task is running, it will attempt to cancel it first. If the process is already dead or doesn't exist, the task will be deleted anyway.

func (*Orchestrator) GetStats

func (o *Orchestrator) GetStats() Stats

GetStats returns orchestrator statistics.

func (*Orchestrator) GetTask

func (o *Orchestrator) GetTask(taskID string) (*models.Task, error)

GetTask retrieves a task by ID.

func (*Orchestrator) ListPersonas

func (o *Orchestrator) ListPersonas() []string

ListPersonas returns a list of available persona names.

func (*Orchestrator) ListTasks

func (o *Orchestrator) ListTasks(req models.ListRequest) ([]*models.Task, error)

ListTasks lists tasks matching the filter.

func (*Orchestrator) Pause

func (o *Orchestrator) Pause(taskID string) (*models.Task, error)

Pause pauses a running or pending task. Pausing stops the underlying Copilot process (if any) and marks the task as paused.

func (*Orchestrator) Purge

func (o *Orchestrator) Purge(taskID string) error

Purge stops a running task (if needed), deletes its log file (if any), and removes it from the store. This operation is intentionally idempotent: purging a missing task returns nil.

func (*Orchestrator) Relaunch added in v0.294.1

func (o *Orchestrator) Relaunch(ctx context.Context, taskID string, opts RelaunchOptions) (*models.Task, error)

Relaunch resets an existing task (of any status) back to pending and re-runs it. Unlike Retry (which creates a new task), Relaunch reuses the same task ID so that any dependent tasks automatically benefit from the new execution without needing their dependency arrays updated.

Optional fields in opts override the stored task configuration; zero values keep the original values.

func (*Orchestrator) Resume

func (o *Orchestrator) Resume(ctx context.Context, taskID string, opts ResumeOptions) (*models.Task, error)

Resume creates a new task to continue work from a previously paused task.

func (*Orchestrator) Retry

func (o *Orchestrator) Retry(ctx context.Context, taskID string, opts RetryOptions) (*models.Task, error)

Retry relaunches a failed task or reactivates a pending task. For failed tasks, it creates a new task reusing the same log file (append mode) with the original prompt plus a retry notice. For pending tasks, it checks dependencies and starts the task if ready.

func (*Orchestrator) SetProgress

func (o *Orchestrator) SetProgress(taskID string, percentage int, description string) error

SetProgress updates the progress of a running task.

func (*Orchestrator) Shutdown

func (o *Orchestrator) Shutdown() error

Shutdown gracefully shuts down the orchestrator.

func (*Orchestrator) Spawn

Spawn creates and optionally starts a new agent task.

func (*Orchestrator) Wait

func (o *Orchestrator) Wait(ctx context.Context, taskID string, timeout time.Duration) (*models.Task, error)

Wait waits for a task to complete.

func (*Orchestrator) WaitMultiple

func (o *Orchestrator) WaitMultiple(ctx context.Context, taskIDs []string, waitAll bool, timeout time.Duration) (map[string]*models.Task, error)

WaitMultiple waits for multiple tasks.

type RelaunchOptions added in v0.294.1

type RelaunchOptions struct {
	// Prompt overrides the original prompt when non-empty.
	Prompt string
	// Engine overrides the engine when non-zero.
	Engine models.Engine
	// Model overrides the model when non-empty.
	Model string
	// Timeout overrides the timeout when non-empty.
	Timeout string
	// Background controls whether the relaunch runs in the background.
	Background bool
}

RelaunchOptions controls how a task is relaunched in-place.

type ResumeOptions

type ResumeOptions struct {
	Prompt     string
	Model      string
	Background bool
	Timeout    string
	Tags       *[]string
}

ResumeOptions controls how a paused task is resumed.

type RetryOptions

type RetryOptions struct {
	Background bool
}

RetryOptions controls how a failed or pending task is retried.

type Stats

type Stats struct {
	Total           int                         `json:"total"`
	Pending         int                         `json:"pending"`
	Running         int                         `json:"running"`
	Paused          int                         `json:"paused"`
	Completed       int                         `json:"completed"`
	Failed          int                         `json:"failed"`
	Cancelled       int                         `json:"cancelled"`
	RunningProgress map[string]TaskProgressInfo `json:"running_progress,omitempty"`
}

Stats holds orchestrator statistics.

type TaskProgressInfo

type TaskProgressInfo struct {
	TaskID      string    `json:"task_id"`
	Percentage  int       `json:"percentage"`
	Description string    `json:"description"`
	UpdatedAt   time.Time `json:"updated_at"`
}

TaskProgressInfo holds progress information for a task.

Jump to

Keyboard shortcuts

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