agent

package
v0.1.0-pre Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package agent provides the bucket-1 shim over ADK v2's runner and llmagent primitives. It hides the llmagent.Config boilerplate behind mast-shaped constructors and encodes the mode conventions the design corpus uses (Task-mode specialists, SingleTurn classifiers, Chat-mode coordinators).

Index

Constants

View Source
const DefaultChatInstruction = `` /* 751-byte string literal not displayed */

DefaultChatInstruction is the fallback system prompt for Chat-mode agents (NewCoordinator). Chat mode fronts an interactive operator — an attach-mode terminal or a mast-web session — so the framing is conversational rather than autonomous (docs/positioning.md, "Change shape" -> DefaultInstruction: "Chat-mode gets conversational framing for attach-mode / mast-web operators").

View Source
const DefaultSingleTurnInstruction = `` /* 334-byte string literal not displayed */

DefaultSingleTurnInstruction is the fallback system prompt for SingleTurn-mode agents (NewSingleTurnAgent). SingleTurn agents are classifier-shaped — one model call, no tool loop — so the default is deliberately minimal (docs/positioning.md, "Change shape" -> DefaultInstruction: "SingleTurn-mode gets minimal framing (used by LLM-as-router classifiers)").

View Source
const DefaultTaskInstruction = `` /* 1270-byte string literal not displayed */

DefaultTaskInstruction is the fallback system prompt for Task-mode agents (NewTaskAgent). Task mode is mast's unattended workhorse, so the default encodes the unattended-loop discipline from docs/positioning.md ("Change shape" -> DefaultInstruction): conservative defaults; explicit state persistence to the eventlog; fail-fast on ambiguity; structured tool preference; plan-before-act; subagents over open-ended search.

Variables

This section is empty.

Functions

func NewCoordinator

func NewCoordinator(cfg CoordinatorConfig) (adkagent.Agent, error)

NewCoordinator constructs a Chat-mode LlmAgent with the given sub-agents and tools. The coordinator drives the top-level conversation; sub-agents handle delegated tasks.

When cfg.Instruction is empty, DefaultChatInstruction is used. A non-empty Instruction is used verbatim — callers with a bundle-specific prompt (e.g. router.Build's per-workload coordinator default) keep full control.

func NewEchoModel

func NewEchoModel(name string) model.LLM

NewEchoModel returns a model.LLM that responds to any request with a canned "acknowledged" reply summarising the last user message. It makes no network calls and requires no credentials, so it lets the runtime wiring be smoke-tested end-to-end without ADK-model dependencies.

This is a spike-only helper; it will be replaced by google.golang.org/adk/v2/model/gemini.NewModel once the real Gemini wiring lands (spike step 6).

func NewSingleTurnAgent

func NewSingleTurnAgent(cfg SingleTurnAgentConfig) (adkagent.Agent, error)

NewSingleTurnAgent constructs a SingleTurn-mode agent.

When cfg.Instruction is empty, DefaultSingleTurnInstruction is used. A non-empty Instruction is used verbatim — specialists keep full control of their prompt; nothing is prepended.

func NewTaskAgent

func NewTaskAgent(cfg TaskAgentConfig) (adkagent.Agent, error)

NewTaskAgent constructs a Task-mode agent. Suitable for per-failure-mode specialists (diagnose, remediate, return a structured digest).

When cfg.Instruction is empty, DefaultTaskInstruction is used. A non-empty Instruction is used verbatim — specialists keep full control of their prompt; nothing is prepended.

Types

type CoordinatorConfig

type CoordinatorConfig struct {
	Name        string
	Description string
	Instruction string
	Model       model.LLM
	SubAgents   []adkagent.Agent
	Tools       []tool.Tool
	Toolsets    []tool.Toolset
}

CoordinatorConfig bundles the parameters for constructing a Chat-mode coordinator with Task or SingleTurn sub-agents. ADK auto-installs a task tool for each Task sub-agent and a single_turn tool for each SingleTurn sub-agent — the coordinator's LLM invokes sub-agents by calling those tools. No explicit agenttool.New call is required for this dispatch pattern.

type SingleTurnAgentConfig

type SingleTurnAgentConfig struct {
	Name         string
	Description  string
	Instruction  string
	Model        model.LLM
	InputSchema  *genai.Schema
	OutputSchema *genai.Schema
}

SingleTurnAgentConfig bundles the parameters for constructing a SingleTurn-mode LlmAgent. SingleTurn agents run exactly one model call; no finish_task loop. Cheap and predictable — the shape behind LLM-as-router classifiers.

type TaskAgentConfig

type TaskAgentConfig struct {
	Name         string
	Description  string
	Instruction  string
	Model        model.LLM
	Tools        []tool.Tool
	Toolsets     []tool.Toolset
	OutputSchema *genai.Schema
}

TaskAgentConfig bundles the parameters for constructing a Task-mode LlmAgent. Task-mode agents auto-install the ADK-provided finish_task helper; the value the agent passes to finish_task becomes the agent's output.

Jump to

Keyboard shortcuts

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