workers

package
v1.66.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CtxKeyAgentName carries the agent type name (e.g., "shell", "coder").
	CtxKeyAgentName ctxKey = "agent_name"
	// CtxKeyAgentTask carries the natural language task description.
	CtxKeyAgentTask ctxKey = "agent_task"
)
View Source
const DefaultMaxWorkers = 4

DefaultMaxWorkers is the default number of concurrent worker goroutines.

View Source
const DefaultWorkerMaxTurns = 10

DefaultWorkerMaxTurns is the default maximum number of ReAct turns per worker.

View Source
const DefaultWorkerTimeout = 5 * time.Minute

DefaultWorkerTimeout is the default timeout for a single worker.

View Source
const MaxWorkerOutputBytes = 30 * 1024

MaxWorkerOutputBytes is the maximum size of worker output to prevent token overflow.

Variables

This section is empty.

Functions

func FormatResults

func FormatResults(results []AgentResult) string

FormatResults formats a slice of AgentResult into a feedback string for injection into the orchestrator's LLM history.

func LoadCustomAgents added in v1.62.0

func LoadCustomAgents(registry *Registry, mgr *persona.Manager, logger *zap.Logger) int

LoadCustomAgents scans the persona system for custom agents and registers them as CustomAgent workers in the registry. Built-in agent types are protected from override — if a custom agent name collides, it is skipped with a warning. Returns the number of agents successfully loaded.

func MapToolsToCommands added in v1.62.0

func MapToolsToCommands(tools []string) []string

MapToolsToCommands converts persona frontmatter tool names (Claude Code-style) to @coder subcommand names used by the worker ReAct loop.

Mapping:

Read  → read
Grep  → search
Glob  → tree
Bash  → exec, test + git commands
Write → write
Edit  → patch
Agent → ignored (meta-tool)

func OrchestratorSystemPrompt

func OrchestratorSystemPrompt(catalog string) string

OrchestratorSystemPrompt returns the enhanced system prompt that teaches the LLM to act as an orchestrator. The catalog string is injected from the Registry. This prompt is APPENDED to the existing CoderSystemPrompt when parallel mode is enabled.

Types

type AgentCall

type AgentCall struct {
	Agent AgentType // which specialized agent to invoke
	Task  string    // natural language task description
	ID    string    // unique call ID for tracking
	Raw   string    // raw XML for logging/debugging
}

AgentCall represents a parsed <agent_call> directive from the orchestrator.

func ParseAgentCalls

func ParseAgentCalls(text string) ([]AgentCall, error)

ParseAgentCalls extracts <agent_call> tags from AI response text. Supports both self-closing and paired tag forms:

<agent_call agent="file" task="read main.go" />
<agent_call agent="coder" task="write new file">optional body</agent_call>

Uses a stateful scanner (same approach as toolcall_parser.go) to handle quoted attributes containing special characters.

type AgentResult

type AgentResult struct {
	CallID        string
	Agent         AgentType
	Task          string
	Output        string
	Error         error
	Duration      time.Duration
	ToolCalls     []ToolCallRecord
	ParallelCalls int // number of tool calls that ran in parallel (0 = sequential)
}

AgentResult is the output of a single agent execution.

func RunWorkerReAct

func RunWorkerReAct(
	ctx context.Context,
	config WorkerReActConfig,
	task string,
	llmClient client.LLMClient,
	lockMgr *FileLockManager,
	skills *SkillSet,
	policyChecker PolicyChecker,
	logger *zap.Logger,
) (*AgentResult, error)

RunWorkerReAct executes a mini ReAct loop for a single worker agent. Each turn: send task to LLM → parse tool_calls → execute via Engine → feedback. If no tool_calls are emitted, the worker is done and returns the final text. Executable skills are short-circuited (executed directly without LLM call).

type AgentType

type AgentType string

AgentType identifies a specialized agent kind.

const (
	AgentTypeFile        AgentType = "file"
	AgentTypeCoder       AgentType = "coder"
	AgentTypeShell       AgentType = "shell"
	AgentTypeGit         AgentType = "git"
	AgentTypeSearch      AgentType = "search"
	AgentTypePlanner     AgentType = "planner"
	AgentTypeReviewer    AgentType = "reviewer"
	AgentTypeTester      AgentType = "tester"
	AgentTypeRefactor    AgentType = "refactor"
	AgentTypeDiagnostics AgentType = "diagnostics"
	AgentTypeFormatter   AgentType = "formatter"
	AgentTypeDeps        AgentType = "deps"
)

type CoderAgent

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

CoderAgent is the specialized agent for writing, patching, and creating code.

func NewCoderAgent

func NewCoderAgent() *CoderAgent

NewCoderAgent creates a CoderAgent with its pre-built skills.

func (*CoderAgent) AllowedCommands

func (a *CoderAgent) AllowedCommands() []string

func (*CoderAgent) Description

func (a *CoderAgent) Description() string

func (*CoderAgent) Execute

func (a *CoderAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*CoderAgent) IsReadOnly

func (a *CoderAgent) IsReadOnly() bool

func (*CoderAgent) Name

func (a *CoderAgent) Name() string

func (*CoderAgent) Skills

func (a *CoderAgent) Skills() *SkillSet

func (*CoderAgent) SystemPrompt

func (a *CoderAgent) SystemPrompt() string

func (*CoderAgent) Type

func (a *CoderAgent) Type() AgentType

type CustomAgent added in v1.62.0

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

CustomAgent adapts a persona.Agent into a WorkerAgent for multi-agent orchestration. It wraps persona expertise content + skills into a full worker with ReAct loop access.

func NewCustomAgent added in v1.62.0

func NewCustomAgent(pa *persona.Agent, personaSkills []*persona.Skill) *CustomAgent

NewCustomAgent creates a CustomAgent from a persona Agent and its resolved skills.

func (*CustomAgent) AllowedCommands added in v1.62.0

func (a *CustomAgent) AllowedCommands() []string

func (*CustomAgent) Description added in v1.62.0

func (a *CustomAgent) Description() string

func (*CustomAgent) Execute added in v1.62.0

func (a *CustomAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*CustomAgent) IsReadOnly added in v1.62.0

func (a *CustomAgent) IsReadOnly() bool

func (*CustomAgent) Name added in v1.62.0

func (a *CustomAgent) Name() string

func (*CustomAgent) Skills added in v1.62.0

func (a *CustomAgent) Skills() *SkillSet

func (*CustomAgent) SystemPrompt added in v1.62.0

func (a *CustomAgent) SystemPrompt() string

func (*CustomAgent) Type added in v1.62.0

func (a *CustomAgent) Type() AgentType

type DepsAgent added in v1.63.0

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

DepsAgent is the specialized agent for dependency management and auditing.

func NewDepsAgent added in v1.63.0

func NewDepsAgent() *DepsAgent

NewDepsAgent creates a DepsAgent with its pre-built skills.

func (*DepsAgent) AllowedCommands added in v1.63.0

func (a *DepsAgent) AllowedCommands() []string

func (*DepsAgent) Description added in v1.63.0

func (a *DepsAgent) Description() string

func (*DepsAgent) Execute added in v1.63.0

func (a *DepsAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*DepsAgent) IsReadOnly added in v1.63.0

func (a *DepsAgent) IsReadOnly() bool

func (*DepsAgent) Name added in v1.63.0

func (a *DepsAgent) Name() string

func (*DepsAgent) Skills added in v1.63.0

func (a *DepsAgent) Skills() *SkillSet

func (*DepsAgent) SystemPrompt added in v1.63.0

func (a *DepsAgent) SystemPrompt() string

func (*DepsAgent) Type added in v1.63.0

func (a *DepsAgent) Type() AgentType

type DiagnosticsAgent added in v1.63.0

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

DiagnosticsAgent is the specialized agent for troubleshooting and investigating issues.

func NewDiagnosticsAgent added in v1.63.0

func NewDiagnosticsAgent() *DiagnosticsAgent

NewDiagnosticsAgent creates a DiagnosticsAgent with its pre-built skills.

func (*DiagnosticsAgent) AllowedCommands added in v1.63.0

func (a *DiagnosticsAgent) AllowedCommands() []string

func (*DiagnosticsAgent) Description added in v1.63.0

func (a *DiagnosticsAgent) Description() string

func (*DiagnosticsAgent) Execute added in v1.63.0

func (a *DiagnosticsAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*DiagnosticsAgent) IsReadOnly added in v1.63.0

func (a *DiagnosticsAgent) IsReadOnly() bool

func (*DiagnosticsAgent) Name added in v1.63.0

func (a *DiagnosticsAgent) Name() string

func (*DiagnosticsAgent) Skills added in v1.63.0

func (a *DiagnosticsAgent) Skills() *SkillSet

func (*DiagnosticsAgent) SystemPrompt added in v1.63.0

func (a *DiagnosticsAgent) SystemPrompt() string

func (*DiagnosticsAgent) Type added in v1.63.0

func (a *DiagnosticsAgent) Type() AgentType

type Dispatcher

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

Dispatcher orchestrates parallel agent execution.

func NewDispatcher

func NewDispatcher(
	registry *Registry,
	llmMgr manager.LLMManager,
	config DispatcherConfig,
	logger *zap.Logger,
) *Dispatcher

NewDispatcher creates a Dispatcher with the given dependencies.

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(ctx context.Context, calls []AgentCall) []AgentResult

Dispatch executes a batch of agent calls, respecting parallelism settings. Independent calls run concurrently (up to MaxWorkers), dependent calls run sequentially. Returns results in the same order as the input calls.

func (*Dispatcher) MaxWorkers added in v1.62.0

func (d *Dispatcher) MaxWorkers() int

MaxWorkers returns the maximum number of concurrent worker goroutines.

func (*Dispatcher) SetPolicyChecker added in v1.64.0

func (d *Dispatcher) SetPolicyChecker(pc PolicyChecker)

SetPolicyChecker sets the policy checker for enforcing security policies on tool calls executed by parallel workers.

func (*Dispatcher) UpdateProviderModel added in v1.64.0

func (d *Dispatcher) UpdateProviderModel(provider, model string)

UpdateProviderModel updates the provider and model used by worker instances. This ensures that runtime provider/model changes are respected by parallel agents.

type DispatcherConfig

type DispatcherConfig struct {
	MaxWorkers    int           // max concurrent worker goroutines
	ParallelMode  bool          // whether parallel dispatch is enabled
	Provider      string        // LLM provider for worker instances
	Model         string        // LLM model for worker instances
	WorkerTimeout time.Duration // timeout per individual worker
}

DispatcherConfig holds configuration for the async dispatcher.

type FileAgent

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

FileAgent is the specialized agent for reading, analyzing, and understanding code.

func NewFileAgent

func NewFileAgent() *FileAgent

NewFileAgent creates a FileAgent with its pre-built skills.

func (*FileAgent) AllowedCommands

func (a *FileAgent) AllowedCommands() []string

func (*FileAgent) Description

func (a *FileAgent) Description() string

func (*FileAgent) Execute

func (a *FileAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*FileAgent) IsReadOnly

func (a *FileAgent) IsReadOnly() bool

func (*FileAgent) Name

func (a *FileAgent) Name() string

func (*FileAgent) Skills

func (a *FileAgent) Skills() *SkillSet

func (*FileAgent) SystemPrompt

func (a *FileAgent) SystemPrompt() string

func (*FileAgent) Type

func (a *FileAgent) Type() AgentType

type FileLockManager

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

FileLockManager provides per-file mutual exclusion for concurrent writes. Read operations do not need locks; only write/patch operations acquire them.

func NewFileLockManager

func NewFileLockManager() *FileLockManager

NewFileLockManager creates a new FileLockManager.

func (*FileLockManager) Lock

func (m *FileLockManager) Lock(path string)

Lock acquires the mutex for a given file path.

func (*FileLockManager) Unlock

func (m *FileLockManager) Unlock(path string)

Unlock releases the mutex for a given file path.

func (*FileLockManager) WithLock

func (m *FileLockManager) WithLock(path string, fn func() error) error

WithLock runs fn while holding the lock for path. The lock is always released, even if fn panics.

type FormatterAgent added in v1.63.0

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

FormatterAgent is the specialized agent for code formatting and style normalization.

func NewFormatterAgent added in v1.63.0

func NewFormatterAgent() *FormatterAgent

NewFormatterAgent creates a FormatterAgent with its pre-built skills.

func (*FormatterAgent) AllowedCommands added in v1.63.0

func (a *FormatterAgent) AllowedCommands() []string

func (*FormatterAgent) Description added in v1.63.0

func (a *FormatterAgent) Description() string

func (*FormatterAgent) Execute added in v1.63.0

func (a *FormatterAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*FormatterAgent) IsReadOnly added in v1.63.0

func (a *FormatterAgent) IsReadOnly() bool

func (*FormatterAgent) Name added in v1.63.0

func (a *FormatterAgent) Name() string

func (*FormatterAgent) Skills added in v1.63.0

func (a *FormatterAgent) Skills() *SkillSet

func (*FormatterAgent) SystemPrompt added in v1.63.0

func (a *FormatterAgent) SystemPrompt() string

func (*FormatterAgent) Type added in v1.63.0

func (a *FormatterAgent) Type() AgentType

type GitAgent

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

GitAgent is the specialized agent for version control operations.

func NewGitAgent

func NewGitAgent() *GitAgent

NewGitAgent creates a GitAgent with its pre-built skills.

func (*GitAgent) AllowedCommands

func (a *GitAgent) AllowedCommands() []string

func (*GitAgent) Description

func (a *GitAgent) Description() string

func (*GitAgent) Execute

func (a *GitAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*GitAgent) IsReadOnly

func (a *GitAgent) IsReadOnly() bool

func (*GitAgent) Name

func (a *GitAgent) Name() string

func (*GitAgent) Skills

func (a *GitAgent) Skills() *SkillSet

func (*GitAgent) SystemPrompt

func (a *GitAgent) SystemPrompt() string

func (*GitAgent) Type

func (a *GitAgent) Type() AgentType

type PlannerAgent

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

PlannerAgent is a pure reasoning agent with NO tool access. It uses an LLM to analyze tasks, create execution plans, and decompose complex tasks.

func NewPlannerAgent

func NewPlannerAgent() *PlannerAgent

NewPlannerAgent creates a PlannerAgent with its pre-built skills.

func (*PlannerAgent) AllowedCommands

func (a *PlannerAgent) AllowedCommands() []string

func (*PlannerAgent) Description

func (a *PlannerAgent) Description() string

func (*PlannerAgent) Execute

func (a *PlannerAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

Execute runs the PlannerAgent — a single LLM call with no tool execution.

func (*PlannerAgent) IsReadOnly

func (a *PlannerAgent) IsReadOnly() bool

func (*PlannerAgent) Name

func (a *PlannerAgent) Name() string

func (*PlannerAgent) Skills

func (a *PlannerAgent) Skills() *SkillSet

func (*PlannerAgent) SystemPrompt

func (a *PlannerAgent) SystemPrompt() string

func (*PlannerAgent) Type

func (a *PlannerAgent) Type() AgentType

type PolicyChecker added in v1.64.0

type PolicyChecker interface {
	// CheckAndPrompt checks the policy for a tool call. If the policy requires
	// user confirmation ("ask"), it prompts the user interactively (serialized
	// across goroutines). Returns (true, "") if allowed, or (false, message)
	// if denied/blocked.
	CheckAndPrompt(ctx context.Context, toolName, args string) (allowed bool, message string)
}

PolicyChecker abstracts security policy enforcement for worker tool calls. Implementations must be safe for concurrent use from multiple goroutines. When a policy action is "ask", the implementation serializes interactive prompts so only one worker blocks on stdin at a time.

type RefactorAgent added in v1.63.0

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

RefactorAgent is the specialized agent for safe structural code transformations.

func NewRefactorAgent added in v1.63.0

func NewRefactorAgent() *RefactorAgent

NewRefactorAgent creates a RefactorAgent with its pre-built skills.

func (*RefactorAgent) AllowedCommands added in v1.63.0

func (a *RefactorAgent) AllowedCommands() []string

func (*RefactorAgent) Description added in v1.63.0

func (a *RefactorAgent) Description() string

func (*RefactorAgent) Execute added in v1.63.0

func (a *RefactorAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*RefactorAgent) IsReadOnly added in v1.63.0

func (a *RefactorAgent) IsReadOnly() bool

func (*RefactorAgent) Name added in v1.63.0

func (a *RefactorAgent) Name() string

func (*RefactorAgent) Skills added in v1.63.0

func (a *RefactorAgent) Skills() *SkillSet

func (*RefactorAgent) SystemPrompt added in v1.63.0

func (a *RefactorAgent) SystemPrompt() string

func (*RefactorAgent) Type added in v1.63.0

func (a *RefactorAgent) Type() AgentType

type Registry

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

Registry holds all registered specialized agents.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty agent registry.

func SetupDefaultRegistry

func SetupDefaultRegistry() *Registry

SetupDefaultRegistry creates a registry with all default specialized agents.

func (*Registry) All

func (r *Registry) All() []WorkerAgent

All returns all registered agents sorted by type name.

func (*Registry) CatalogString

func (r *Registry) CatalogString() string

CatalogString generates the agent catalog text for the orchestrator's system prompt. The catalog describes each agent's expertise and available skills so the LLM can make informed routing decisions.

func (*Registry) Get

func (r *Registry) Get(agentType AgentType) (WorkerAgent, bool)

Get returns a registered agent by type.

func (*Registry) Register

func (r *Registry) Register(a WorkerAgent)

Register adds a specialized agent to the registry.

func (*Registry) Unregister

func (r *Registry) Unregister(agentType AgentType)

Unregister removes a specialized agent from the registry. This allows users to replace built-in agents with custom implementations.

type ReviewerAgent added in v1.63.0

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

ReviewerAgent is the specialized agent for code quality analysis and review.

func NewReviewerAgent added in v1.63.0

func NewReviewerAgent() *ReviewerAgent

NewReviewerAgent creates a ReviewerAgent with its pre-built skills.

func (*ReviewerAgent) AllowedCommands added in v1.63.0

func (a *ReviewerAgent) AllowedCommands() []string

func (*ReviewerAgent) Description added in v1.63.0

func (a *ReviewerAgent) Description() string

func (*ReviewerAgent) Execute added in v1.63.0

func (a *ReviewerAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*ReviewerAgent) IsReadOnly added in v1.63.0

func (a *ReviewerAgent) IsReadOnly() bool

func (*ReviewerAgent) Name added in v1.63.0

func (a *ReviewerAgent) Name() string

func (*ReviewerAgent) Skills added in v1.63.0

func (a *ReviewerAgent) Skills() *SkillSet

func (*ReviewerAgent) SystemPrompt added in v1.63.0

func (a *ReviewerAgent) SystemPrompt() string

func (*ReviewerAgent) Type added in v1.63.0

func (a *ReviewerAgent) Type() AgentType

type SearchAgent

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

SearchAgent is the specialized agent for finding things across the codebase.

func NewSearchAgent

func NewSearchAgent() *SearchAgent

NewSearchAgent creates a SearchAgent with its pre-built skills.

func (*SearchAgent) AllowedCommands

func (a *SearchAgent) AllowedCommands() []string

func (*SearchAgent) Description

func (a *SearchAgent) Description() string

func (*SearchAgent) Execute

func (a *SearchAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*SearchAgent) IsReadOnly

func (a *SearchAgent) IsReadOnly() bool

func (*SearchAgent) Name

func (a *SearchAgent) Name() string

func (*SearchAgent) Skills

func (a *SearchAgent) Skills() *SkillSet

func (*SearchAgent) SystemPrompt

func (a *SearchAgent) SystemPrompt() string

func (*SearchAgent) Type

func (a *SearchAgent) Type() AgentType

type ShellAgent

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

ShellAgent is the specialized agent for executing commands, building, and testing.

func NewShellAgent

func NewShellAgent() *ShellAgent

NewShellAgent creates a ShellAgent with its pre-built skills.

func (*ShellAgent) AllowedCommands

func (a *ShellAgent) AllowedCommands() []string

func (*ShellAgent) Description

func (a *ShellAgent) Description() string

func (*ShellAgent) Execute

func (a *ShellAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*ShellAgent) IsReadOnly

func (a *ShellAgent) IsReadOnly() bool

func (*ShellAgent) Name

func (a *ShellAgent) Name() string

func (*ShellAgent) Skills

func (a *ShellAgent) Skills() *SkillSet

func (*ShellAgent) SystemPrompt

func (a *ShellAgent) SystemPrompt() string

func (*ShellAgent) Type

func (a *ShellAgent) Type() AgentType

type Skill

type Skill struct {
	Name        string
	Description string
	Type        SkillType
	// Script is the executable function for SkillExecutable skills.
	// Nil for SkillDescriptive skills.
	Script SkillFunc
}

Skill represents a pre-built compound operation (macro) available to an agent.

type SkillFunc

type SkillFunc func(ctx context.Context, input map[string]string, eng *engine.Engine) (string, error)

SkillFunc is the signature for executable skill scripts. It receives context, input parameters, and a fresh Engine for tool execution.

type SkillSet

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

SkillSet is a collection of skills for a single agent.

func NewSkillSet

func NewSkillSet() *SkillSet

NewSkillSet creates an empty SkillSet.

func (*SkillSet) CatalogString

func (s *SkillSet) CatalogString() string

CatalogString generates a skill listing for system prompts.

func (*SkillSet) Execute

func (s *SkillSet) Execute(ctx context.Context, name string, input map[string]string, eng *engine.Engine) (string, error)

Execute runs an executable skill directly, bypassing the LLM. Returns an error if the skill is not found or is not executable.

func (*SkillSet) Get

func (s *SkillSet) Get(name string) (*Skill, bool)

Get looks up a skill by name.

func (*SkillSet) List

func (s *SkillSet) List() []*Skill

List returns all registered skills.

func (*SkillSet) Register

func (s *SkillSet) Register(skill *Skill)

Register adds a skill to the set.

type SkillType

type SkillType int

SkillType distinguishes between executable scripts and descriptive skills.

const (
	// SkillDescriptive is a skill that informs the LLM about capabilities;
	// the worker agent resolves it via its mini ReAct loop.
	SkillDescriptive SkillType = iota
	// SkillExecutable is a skill with a pre-built script that runs directly,
	// bypassing the LLM for mechanical operations.
	SkillExecutable
)

type TesterAgent added in v1.63.0

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

TesterAgent is the specialized agent for test generation, execution, and coverage analysis.

func NewTesterAgent added in v1.63.0

func NewTesterAgent() *TesterAgent

NewTesterAgent creates a TesterAgent with its pre-built skills.

func (*TesterAgent) AllowedCommands added in v1.63.0

func (a *TesterAgent) AllowedCommands() []string

func (*TesterAgent) Description added in v1.63.0

func (a *TesterAgent) Description() string

func (*TesterAgent) Execute added in v1.63.0

func (a *TesterAgent) Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)

func (*TesterAgent) IsReadOnly added in v1.63.0

func (a *TesterAgent) IsReadOnly() bool

func (*TesterAgent) Name added in v1.63.0

func (a *TesterAgent) Name() string

func (*TesterAgent) Skills added in v1.63.0

func (a *TesterAgent) Skills() *SkillSet

func (*TesterAgent) SystemPrompt added in v1.63.0

func (a *TesterAgent) SystemPrompt() string

func (*TesterAgent) Type added in v1.63.0

func (a *TesterAgent) Type() AgentType

type ToolCallRecord

type ToolCallRecord struct {
	Name   string
	Args   string
	Output string
	Error  error
}

ToolCallRecord logs a tool call executed by a worker.

type WorkerAgent

type WorkerAgent interface {
	// Type returns the agent's type identifier.
	Type() AgentType
	// Name returns a human-readable name.
	Name() string
	// Description returns the agent's capability summary (for orchestrator catalog).
	Description() string
	// SystemPrompt returns the specialized system prompt for this agent.
	SystemPrompt() string
	// Skills returns the skill set available to this agent.
	Skills() *SkillSet
	// AllowedCommands returns the @coder subcommands this agent is permitted to use.
	AllowedCommands() []string
	// IsReadOnly returns true if this agent never writes files.
	IsReadOnly() bool
	// Execute runs the agent on a task with the provided dependencies.
	Execute(ctx context.Context, task string, deps *WorkerDeps) (*AgentResult, error)
}

WorkerAgent is the interface every specialized agent must implement.

type WorkerDeps

type WorkerDeps struct {
	LLMClient     client.LLMClient
	LockMgr       *FileLockManager
	PolicyChecker PolicyChecker // nil = no policy enforcement (all commands allowed)
	Logger        *zap.Logger
}

WorkerDeps holds dependencies injected into each worker at execution time.

type WorkerReActConfig

type WorkerReActConfig struct {
	MaxTurns        int
	SystemPrompt    string
	AllowedCommands []string // which @coder subcommands this worker can use
	ReadOnly        bool     // if true, only read/search/tree/git-read allowed
}

WorkerReActConfig controls the worker's internal ReAct loop.

Jump to

Keyboard shortcuts

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