coordinator

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: AGPL-3.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package coordinator implements coordinator mode: a top-level agent that decomposes work and delegates each unit to isolated "worker" subagents instead of doing the work itself. It offers two paths: an LLM-driven one (expose AgentTool + SystemSegment so the model spawns workers via the Agent tool) and a programmatic one (RunParallel fans tasks out to workers concurrently and returns their results).

Index

Constants

View Source
const DefaultWorkerPrompt = `` /* 649-byte string literal not displayed */

DefaultWorkerPrompt is the default system prompt for worker subagents.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Provider       llm.Provider
	WorkerTools    *tool.Registry  // tools available to workers (e.g. the core toolset)
	WorkerPrompt   []string        // worker system prompt (default DefaultWorkerPrompt)
	PermissionMode permission.Mode // workers' permission mode (default acceptEdits)
	WorkingDir     string
	MaxTurns       int // per-worker turn cap
	MaxDepth       int // subagent recursion cap (default 3)
	MaxParallel    int // bounded concurrency for RunParallel (default 4)
	CanUseTool     permission.CanUseTool
	Hooks          harness.HookRunner
}

Config configures coordinator mode.

func (*Config) AgentTool

func (c *Config) AgentTool() tool.CoreTool

AgentTool returns the Agent tool the coordinator LLM uses to spawn workers. Add it (and nothing else mutating) to the coordinator session's tools.

func (*Config) RunParallel

func (c *Config) RunParallel(ctx context.Context, tasks []string) []Result

RunParallel fans tasks out to workers concurrently (bounded by MaxParallel) and returns results in task order.

func (*Config) SystemSegment

func (c *Config) SystemSegment() string

SystemSegment returns coordinator guidance to append to the system prompt.

type Result

type Result struct {
	Task   string
	Output string
	Err    error
}

Result is the outcome of one programmatic worker run.

Jump to

Keyboard shortcuts

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