orchestration

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAgentTree

func BuildAgentTree(cfg Config) (adk_agent.Agent, error)

BuildAgentTree creates a hierarchical agent tree with an orchestrator root and specialized sub-agents. Sub-agents are created data-driven from agentSpecs. Agents with no tools are skipped unless AlwaysInclude is set (e.g. Planner).

Types

type AgentSpec

type AgentSpec struct {
	// Name is the ADK agent name used for transfer_to_agent delegation.
	Name string
	// Description is a one-line summary for the orchestrator's routing table.
	Description string
	// Instruction is the full system prompt with I/O spec and constraints.
	Instruction string
	// Prefixes are tool name prefixes this agent handles.
	Prefixes []string
	// Keywords are routing hints for the orchestrator's decision protocol.
	Keywords []string
	// Accepts describes the expected input format.
	Accepts string
	// Returns describes the expected output format.
	Returns string
	// CannotDo lists things this agent must not attempt (negative constraints).
	CannotDo []string
	// AlwaysInclude creates this agent even with zero tools (e.g. Planner).
	AlwaysInclude bool
}

AgentSpec defines a sub-agent's identity, routing metadata, and prompt structure.

type Config

type Config struct {
	// Tools is the full set of available tools.
	Tools []*agent.Tool
	// Model is the primary LLM model adapter.
	Model model.LLM
	// SystemPrompt is the base system instruction.
	SystemPrompt string
	// AdaptTool converts an internal tool to an ADK tool.
	// Callers should pass adk.AdaptTool.
	AdaptTool ToolAdapter
	// RemoteAgents are external A2A agents to include as sub-agents.
	RemoteAgents []adk_agent.Agent
	// MaxDelegationRounds limits the number of orchestrator→sub-agent
	// delegation rounds per user turn. Zero means use default (10).
	MaxDelegationRounds int
	// SubAgentPrompt builds the final system prompt for each sub-agent.
	// When nil, the original spec.Instruction is used unchanged.
	SubAgentPrompt SubAgentPromptFunc
}

Config holds orchestration configuration.

type RoleToolSet

type RoleToolSet struct {
	Operator   []*agent.Tool
	Navigator  []*agent.Tool
	Vault      []*agent.Tool
	Librarian  []*agent.Tool
	Automator  []*agent.Tool
	Planner    []*agent.Tool // Always empty — LLM-only reasoning.
	Chronicler []*agent.Tool
	Unmatched  []*agent.Tool // Tools matching no prefix — tracked separately.
}

RoleToolSet defines which tools belong to each sub-agent role.

func PartitionTools

func PartitionTools(tools []*agent.Tool) RoleToolSet

PartitionTools splits tools into role-specific sets based on tool name prefixes. Matching order: Librarian → Chronicler → Automator → Navigator → Vault → Operator → Unmatched. Unlike the previous implementation, unmatched tools are NOT assigned to any agent.

type SubAgentPromptFunc

type SubAgentPromptFunc func(agentName, defaultInstruction string) string

SubAgentPromptFunc builds the final instruction for a sub-agent. agentName is the spec name (e.g. "operator"), defaultInstruction is the hard-coded spec.Instruction. The function returns the assembled system prompt that should replace spec.Instruction. When nil, the original spec.Instruction is used (backward compatible).

type ToolAdapter

type ToolAdapter func(t *agent.Tool) (adk_tool.Tool, error)

ToolAdapter converts an internal agent.Tool to an ADK tool.Tool. This is injected to avoid a direct dependency on the adk package, which carries transitive imports that may cause import cycles.

Jump to

Keyboard shortcuts

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