Documentation
¶
Overview ¶
Package compose wires a workload bundle plus its specialist specs into a runnable root agent. It is the shared core behind the two entry points that construct dispatch shapes: cmd/mast (flag-driven) and the top-level mast convenience package (programmatic). Both MUST go through BuildRoot so the dispatch semantics — planner override, graph vs. coordinator, per-mode toolset offering — cannot drift between the binary and the library.
This is runtime glue, not public API (docs/library-api-design.md marks internal/ packages churnable); library consumers reach it via the root mast package or compose the pkg/ subsystems directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildModel ¶
BuildModel constructs the model.LLM for the given name. "echo" builds a fake in-process echo model (no credentials required); anything starting with "gemini-" builds a Vertex/Gemini model via ADK.
func BuildRoot ¶
func BuildRoot(cfg RootConfig) (adkagent.Agent, error)
BuildRoot builds the roster and assembles the dispatch shape:
- bundle.Planner.Enabled → the supervisor-body planner root (pkg/planner); Dispatch is ignored.
- DispatchGraph → the workflow graph (pkg/graph); errors without a SingleTurn classifier.
- DispatchCoordinator → the SubAgents coordinator (pkg/router).
- DispatchAuto/empty → graph when the roster has both a SingleTurn classifier and a graph.FallbackName specialist, else coordinator.
Types ¶
type Dispatch ¶
type Dispatch string
Dispatch selects the root shape BuildRoot assembles.
const ( // DispatchCoordinator is the spike-1 SubAgents pattern: a // Chat-mode coordinator with the roster as SubAgents (pkg/router). DispatchCoordinator Dispatch = "coordinator" // DispatchGraph is the spike-2 workflow-graph LLM-as-router shape // (pkg/graph). Requires a SingleTurn classifier in the roster. DispatchGraph Dispatch = "graph" // DispatchAuto picks the shape from the roster: graph when a // SingleTurn classifier and a graph.FallbackName Task specialist // are both present (the pair graph dispatch needs), coordinator // otherwise. This is the library default — programmatic callers // declare a roster, not a flag. DispatchAuto Dispatch = "auto" )
type RootConfig ¶
type RootConfig struct {
// Bundle is the workload definition (naming, roster order,
// planner/HITL policy).
Bundle workload.Bundle
// Specs is the loaded specialist roster. Specs with an empty Mode
// build as Task-mode (the same default pkg/specialists applies).
Specs []specialists.Spec
// Model drives every built specialist (specs with a model override
// already bound it upstream — the spike binds one model per
// process).
Model model.LLM
// Toolsets are offered to Task-mode specialists (and filtered
// through each spec's allowlist by specialists.Build). SingleTurn
// classifiers never receive toolsets — they run one shot with no
// tool loop.
Toolsets []tool.Toolset
// Dispatch selects the root shape. Empty means DispatchAuto.
Dispatch Dispatch
// Logger, when non-nil, receives the same construction-time notes
// cmd/mast has always logged (e.g. planner overriding dispatch).
Logger *slog.Logger
}
RootConfig carries everything BuildRoot needs to turn a loaded bundle + specs into a root agent. Bundle and Specs use the existing pkg/workload and pkg/specialists vocabulary — file-loaded and programmatic values are indistinguishable here by design (docs/library-api-design.md, "Embeddable config vs. file-loaded config").