Documentation
¶
Overview ¶
Package subagents provides explicit, synchronous child-agent delegation. It never discovers agents, transfers control or starts background work.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrConfig = errors.New("subagents: invalid configuration") ErrUnknown = errors.New("subagents: unknown child") ErrTask = errors.New("subagents: invalid task") ErrBudget = errors.New("subagents: delegation budget exhausted") ErrBusy = errors.New("subagents: a child is already active") ErrNested = errors.New("subagents: nested delegation is not enabled") ErrChildFailed = errors.New("subagents: child run failed") ErrOutput = errors.New("subagents: invalid or excessive child output") )
Functions ¶
This section is empty.
Types ¶
type Child ¶
Child is a caller-reviewed definition. Config is independent of the parent and must explicitly contain every authorized model, tool and verifier. Instructions are trusted application configuration, not discovered data.
type Config ¶
type Config struct {
Children []Child
MaxRuns int
MaxTotalSteps int
MaxTotalToolCalls int
Timeout time.Duration
}
Config sets one delegation scope's lifetime limits. Zero selects four attempts, 16 reserved model steps, 32 reserved tool calls, and 30 seconds per child. Full child limits are charged before execution, even on failure. Counts do not represent tokens, money, or resource isolation.
type Result ¶
type Result struct {
Child string `json:"child"`
Text string `json:"text"`
Steps int `json:"steps"`
ToolCalls int `json:"tool_calls"`
}
Result exposes only a successful child's final text and attempt counts. The text may be untrusted or sensitive; the caller authorizes its sharing.
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope is a one-turn, non-resettable delegation budget with immutable child definitions. It is safe for concurrent calls, but permits only one active child. Do not copy a Scope. No background work or resources require Close.
func New ¶
New validates all child configurations before returning a scope. It does not invoke models or handlers. Child limits default to four model steps and eight tool attempts; hard ceilings are 16 and 32 respectively.
func (*Scope) Run ¶
Run synchronously executes one independent child turn. The caller must pass a context and supply cooperating models/tools. Cancellation does not roll back effects. Failed runs return no child transcript or raw error.