Documentation
¶
Index ¶
Constants ¶
const DefaultMaxInterpolateLen = 4000
DefaultMaxInterpolateLen is the maximum number of characters substituted into a {{task-id.output}} placeholder (DEC-003).
Variables ¶
This section is empty.
Functions ¶
func Interpolate ¶
Interpolate replaces {{task-id.output}} placeholders in msg with the corresponding task output from results. Unknown references are left as-is. Output values are truncated to maxLen characters (0 = DefaultMaxInterpolateLen).
func NoOpProgress ¶
func NoOpProgress(string, string, TaskStatus)
NoOpProgress is a ProgressFunc that does nothing. Used when orchestrator.progressUpdates is false (the default).
Types ¶
type ChatResponse ¶
ChatResponse is an alias for agentapi.Response (kept for backward compatibility).
type Dispatcher ¶
type Dispatcher struct {
// Agents maps agent ID → Chatter.
Agents map[string]Chatter
// MaxConcurrent limits simultaneous subtasks (default 5).
MaxConcurrent int
// Limiter replaces the internal semaphore when set (for global concurrency control).
Limiter Limiter
}
Dispatcher executes a validated TaskGraph by running subtasks in goroutines, respecting dependencies, enforcing max concurrency, and handling partial failures.
func (*Dispatcher) Execute ¶
func (d *Dispatcher) Execute(ctx context.Context, graph TaskGraph, progress ProgressFunc) (ResultSet, error)
Execute validates the graph, topologically sorts it, then runs all tasks using goroutines with dependency tracking and a semaphore for max concurrency. progress is called after each task completes; pass NoOpProgress to disable.
type Limiter ¶
Limiter provides a concurrency-limiting semaphore. When set on Dispatcher, it replaces the internal channel-based semaphore for global concurrency control.
type ProgressFunc ¶
type ProgressFunc func(taskID string, agentID string, status TaskStatus)
ProgressFunc is called after each task completes (or fails) during dispatch. It must be safe to call from multiple goroutines concurrently.
type ResultSet ¶
type ResultSet struct {
Tasks []TaskResult `json:"tasks"`
}
ResultSet is the complete set of results returned by the dispatcher.
func (*ResultSet) ByID ¶
func (rs *ResultSet) ByID(id string) *TaskResult
ByID returns the result for a given task ID, or nil if not found.
func (*ResultSet) FormatAppendix ¶
FormatAppendix renders the result set in the <task-appendix> format expected by the orchestrator response.
type Task ¶
type Task struct {
ID string `json:"id"`
AgentID string `json:"agent_id"`
Message string `json:"message"`
DependsOn []string `json:"depends_on"`
Blocking bool `json:"blocking"`
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
}
Task is a single unit of work in a task graph.
type TaskGraph ¶
type TaskGraph struct {
Tasks []Task `json:"tasks"`
}
TaskGraph is the structured plan produced by the orchestrator LLM.
func ParseTaskGraph ¶
ParseTaskGraph unmarshals a JSON task graph, returning a validation error if the JSON is malformed.
type TaskResult ¶
type TaskResult struct {
ID string `json:"id"`
AgentID string `json:"agent_id"`
Status TaskStatus `json:"status"`
Output string `json:"output"`
Error string `json:"error,omitempty"`
DurationMs int64 `json:"duration_ms"`
Duration time.Duration `json:"-"`
}
TaskResult holds the outcome of a single dispatched task.
type TaskStatus ¶
type TaskStatus string
TaskStatus represents the execution status of a task.
const ( TaskStatusPending TaskStatus = "pending" TaskStatusRunning TaskStatus = "running" TaskStatusSuccess TaskStatus = "success" TaskStatusFailed TaskStatus = "failed" TaskStatusCancelled TaskStatus = "cancelled" TaskStatusTimeout TaskStatus = "timeout" )