loops

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package loops provides REAL/VEAL loop pattern support for multi-agent systems.

Loops are autonomous, bounded execution patterns that run without human intervention until they complete or escalate.

REAL (Read Eval Act Loop) - Mission-driven loops for open-ended tasks VEAL (Validate Eval Act Loop) - State-driven validation loops

Example usage:

// Load loops from directory
loopSet, err := loops.LoadLoopSet("specs/loops")

// Get a specific loop
qaLoop, _ := loopSet.Get("qa-fix")

// Generate loop instructions for an agent
instructions := loops.GenerateLoopInstructions(qaLoop, "validator")

// Enrich an agent with loop participation
enrichedAgent := loops.EnrichAgentWithLoop(agent, qaLoop, "actor")

Index

Constants

View Source
const (
	LoopREAL = core.LoopREAL
	LoopVEAL = core.LoopVEAL
)

Loop type constants.

View Source
const (
	CheckTypeCommand = core.CheckTypeCommand
	CheckTypePattern = core.CheckTypePattern
	CheckTypeFile    = core.CheckTypeFile
	CheckTypeManual  = core.CheckTypeManual
)

Check type constants.

View Source
const (
	EscalationHuman    = core.EscalationHuman
	EscalationAbort    = core.EscalationAbort
	EscalationContinue = core.EscalationContinue
	EscalationFallback = core.EscalationFallback
)

Escalation policy constants.

Variables

This section is empty.

Functions

func AgentsFromLoop

func AgentsFromLoop(loop *Loop) []string

AgentsFromLoop returns the agent names involved in a loop.

func EnrichAgentWithLoop

func EnrichAgentWithLoop(agent *multiagentspec.Agent, loop *Loop, role string) *multiagentspec.Agent

EnrichAgentWithLoop adds loop participation instructions to an agent.

func GenerateCoordinatorInstructions

func GenerateCoordinatorInstructions(loops []*Loop) string

GenerateCoordinatorInstructions generates instructions for a loop coordinator.

func GenerateLoopInstructions

func GenerateLoopInstructions(loop *Loop, role string) string

GenerateLoopInstructions generates loop-aware instructions for an agent.

Types

type CheckType

type CheckType = core.CheckType

CheckType is how a check is executed.

type EscalationPolicy

type EscalationPolicy = core.EscalationPolicy

EscalationPolicy defines what to do when max attempts are reached.

type Loop

type Loop = core.Loop

Loop is the canonical loop type.

func LoadLoopFromFile

func LoadLoopFromFile(path string) (*Loop, error)

LoadLoopFromFile loads a loop from a JSON or YAML file.

func LoadLoopsFromDir

func LoadLoopsFromDir(dir string) ([]*Loop, error)

LoadLoopsFromDir loads all loops from a directory.

func NewLoop

func NewLoop(name string, loopType LoopType) *Loop

NewLoop creates a new loop with the given name and type.

func NewREALLoop

func NewREALLoop(name, actor, mission string) *Loop

NewREALLoop creates a new REAL loop with actor agent and mission.

func NewVEALLoop

func NewVEALLoop(name, validator, actor string) *Loop

NewVEALLoop creates a new VEAL loop with validator and actor agents.

type LoopAgentConfig

type LoopAgentConfig = core.LoopAgentConfig

LoopAgentConfig describes how to generate agents from a loop.

func DefaultLoopAgentConfig

func DefaultLoopAgentConfig() *LoopAgentConfig

DefaultLoopAgentConfig returns the default configuration.

type LoopCheck

type LoopCheck = core.LoopCheck

LoopCheck is a validation check within a loop.

type LoopSet

type LoopSet = core.LoopSet

LoopSet is a collection of loops indexed by name.

func LoadLoopSet

func LoadLoopSet(dir string) (*LoopSet, error)

LoadLoopSet loads a LoopSet from a directory.

func NewLoopSet

func NewLoopSet() *LoopSet

NewLoopSet creates a new empty LoopSet.

type LoopType

type LoopType = core.LoopType

LoopType is the loop execution pattern (REAL or VEAL).

Directories

Path Synopsis
Package core provides core loop types and interfaces for REAL/VEAL loop patterns.
Package core provides core loop types and interfaces for REAL/VEAL loop patterns.

Jump to

Keyboard shortcuts

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