workflow

package
v1.2.13 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DraftFormatYAML = "yaml"
	DraftFormatJSON = "json"
)

Variables

This section is empty.

Functions

func BuildNodePrompt

func BuildNodePrompt(node Node, inputs map[string]NodeResult) string

func Validate

func Validate(def Definition) error

Types

type Definition

type Definition struct {
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Nodes       []Node `json:"nodes" yaml:"nodes"`
}

func LoadFile

func LoadFile(path string) (Definition, error)

func NormalizeDefinition

func NormalizeDefinition(def Definition) Definition

type DraftOptions

type DraftOptions struct {
	Definition Definition
	Format     string
}

type DraftResult

type DraftResult struct {
	Definition  Definition `json:"definition"`
	Format      string     `json:"format"`
	Content     string     `json:"content"`
	Diagnostics []string   `json:"diagnostics,omitempty"`
}

func Draft

func Draft(options DraftOptions) (DraftResult, error)

type Executor

type Executor interface {
	ExecuteNode(ctx context.Context, node Node, inputs map[string]NodeResult) (string, error)
}

type ExecutorFunc

type ExecutorFunc func(ctx context.Context, node Node, inputs map[string]NodeResult) (string, error)

func (ExecutorFunc) ExecuteNode

func (f ExecutorFunc) ExecuteNode(ctx context.Context, node Node, inputs map[string]NodeResult) (string, error)

type Node

type Node struct {
	ID           string   `json:"id" yaml:"id"`
	Kind         string   `json:"kind,omitempty" yaml:"kind,omitempty"`
	Agent        string   `json:"agent,omitempty" yaml:"agent,omitempty"`
	Prompt       string   `json:"prompt" yaml:"prompt"`
	Needs        []string `json:"needs,omitempty" yaml:"needs,omitempty"`
	Routes       []string `json:"routes,omitempty" yaml:"routes,omitempty"`
	MaxTurns     int      `json:"max_turns,omitempty" yaml:"max_turns,omitempty"`
	OutputFormat string   `json:"output_format,omitempty" yaml:"output_format,omitempty"`
}

type NodeResult

type NodeResult struct {
	ID        string        `json:"id"`
	Agent     string        `json:"agent,omitempty"`
	Success   bool          `json:"success"`
	Output    string        `json:"output,omitempty"`
	Error     string        `json:"error,omitempty"`
	StartedAt time.Time     `json:"started_at"`
	EndedAt   time.Time     `json:"ended_at"`
	Duration  time.Duration `json:"duration"`
}

type Options

type Options struct {
	MaxParallel int
}

type Result

type Result struct {
	Name      string                `json:"name"`
	Success   bool                  `json:"success"`
	StartedAt time.Time             `json:"started_at"`
	EndedAt   time.Time             `json:"ended_at"`
	Duration  time.Duration         `json:"duration"`
	Results   map[string]NodeResult `json:"results"`
	Order     []string              `json:"order"`
}

func Run

func Run(ctx context.Context, def Definition, executor Executor, options Options) (Result, error)

Jump to

Keyboard shortcuts

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