Documentation
¶
Overview ¶
Package goalkeeper builds an ADK workflow for goal-directed work with validation.
A Goalkeeper workflow runs two caller-provided agents in order:
- worker
- validator
The agents run inside one ADK LoopAgent invocation and share the same ADK session. The loop stops when the validator's final visible model response starts exactly with "verdict: pass", or when the configured maximum iteration count is reached. Validator responses that start with "verdict: fail", or responses without a recognized verdict, do not stop the loop.
Thought parts are ignored when checking the validator verdict. Only visible final response text is considered.
Construct workflows with NewOptions and New:
workflow, err := goalkeeper.New(goalkeeper.NewOptions(worker, validator)) workflow, err := goalkeeper.New(goalkeeper.NewOptions( worker, validator, goalkeeper.WithMaxIterations(3), ))
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New creates a Goalkeeper workflow agent from options.
Example ¶
package main
import (
"fmt"
"iter"
"github.com/normahq/norma/pkg/goalkeeper"
"google.golang.org/adk/agent"
"google.golang.org/adk/session"
)
func main() {
worker, _ := agent.New(agent.Config{
Name: "worker",
Description: "does the requested work",
Run: func(agent.InvocationContext) iter.Seq2[*session.Event, error] {
return func(func(*session.Event, error) bool) {}
},
})
validator, _ := agent.New(agent.Config{
Name: "validator",
Description: "checks whether the goal is complete",
Run: func(agent.InvocationContext) iter.Seq2[*session.Event, error] {
return func(func(*session.Event, error) bool) {}
},
})
workflow, _ := goalkeeper.New(goalkeeper.NewOptions(
worker,
validator,
goalkeeper.WithMaxIterations(3),
))
fmt.Println(workflow.Name())
}
Output: Goalkeeper
Types ¶
type OptOptionsSetter ¶
type OptOptionsSetter func(o *Options)
func WithMaxIterations ¶
func WithMaxIterations(opt uint) OptOptionsSetter
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options configures the Goalkeeper workflow agent.