graph

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package graph assembles the workload's triage flow as an explicit ADK v2 workflow graph — the LLM-as-router shape from docs/workflow-scaffolding-design.md (#7), as sketched in docs/triage-demo-plan.md:

START → classify (SingleTurn AgentNode) → route_by_reason
          ├─ StringRoute(<reason>) → run_<reason> (DynamicNode → Task specialist)
          └─ Default              → run__fallback

Spike-2 finding (supersedes the spike-1 comment in pkg/router): runner.Runner does NOT require the root agent to be a Chat-mode LlmAgent. The Chat-mode check applies only when the root IS an LlmAgent; a workflowagent-wrapped graph takes the runner's generic (non-LlmAgent) root path and works as a root agent directly. See adk/v2 runner/runner.go (isLlmAgent branch) and examples/workflow/routing/llm, which uses a workflowagent root.

Task-mode specialists cannot be static graph nodes, so each routed branch is a DynamicNode whose body invokes the specialist's AgentNode via workflow.RunNode — the sanctioned dynamic-invocation pattern (see adk/v2 examples/workflow/dynamic/llm).

Index

Constants

View Source
const FallbackName = "_fallback"

FallbackName is the specialist that handles reasons the classifier can't map to a per-failure-mode specialist. Required in graph mode.

Variables

This section is empty.

Functions

func Build

func Build(cfg Config) (adkagent.Agent, error)

Build assembles the graph and wraps it as a runnable root agent via workflowagent.New.

Types

type Config

type Config struct {
	// Bundle is the workload definition; used for naming and roster
	// ordering.
	Bundle workload.Bundle

	// Classifier is the SingleTurn routing agent. Its one-shot output
	// is normalized into a route key by the route node.
	Classifier adkagent.Agent

	// Specialists is the roster of Task-mode specialists indexed by
	// spec name. Must contain FallbackName.
	Specialists map[string]Specialist
}

Config describes how to assemble the workflow-graph dispatch shape for a workload.

type Specialist

type Specialist struct {
	// Agent is the built specialist.
	Agent adkagent.Agent

	// Budget is the specialist's declared budget block. Only
	// MaxWallclockSeconds is consumed here (→ NodeConfig.Timeout);
	// see nodeConfig for where the other fields are enforced.
	Budget specialists.Budget
}

Specialist pairs a built Task-mode agent with the budget bounds declared on its Spec, so Build can map per-specialist ceilings onto per-node ADK config without re-reading spec files.

Jump to

Keyboard shortcuts

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