executor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package executor provides workflow execution for multi-agent-spec teams.

Package executor provides workflow execution for multi-agent-spec teams.

Package executor provides workflow execution for multi-agent-spec teams.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentSpec

type AgentSpec struct {
	Name         string
	Instructions string
	Model        string
	Tools        []string
}

AgentSpec holds agent definition from multi-agent-spec.

type Config

type Config struct {
	LLM      provider.Provider
	Logger   *slog.Logger
	MaxSteps int
}

Config holds executor configuration.

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor runs multi-agent-spec workflows.

func New

func New(cfg Config) *Executor

New creates a new Executor.

func (*Executor) ExecuteStep

func (e *Executor) ExecuteStep(ctx context.Context, step Step) (*StepResult, error)

ExecuteStep runs a single workflow step.

func (*Executor) GetStepResult

func (e *Executor) GetStepResult(stepName string) (*StepResult, bool)

GetStepResult retrieves a cached step result.

func (*Executor) Reset

func (e *Executor) Reset()

Reset clears the step cache.

type LangChainConfig

type LangChainConfig struct {
	Model       string
	Temperature float64
	MaxTokens   int
}

LangChainConfig holds configuration for LangChainGo integration.

type LangChainExecutor

type LangChainExecutor struct {
	// contains filtered or unexported fields
}

LangChainExecutor wraps omnillm with LangChainGo for advanced agent features.

func NewLangChainExecutor

func NewLangChainExecutor(prov provider.Provider, cfg LangChainConfig) *LangChainExecutor

NewLangChainExecutor creates a new LangChainExecutor using omnillm-langchaingo.

func (*LangChainExecutor) Call

Call implements a simple call interface for agent steps.

func (*LangChainExecutor) GenerateContent

func (e *LangChainExecutor) GenerateContent(ctx context.Context, prompt string) (string, error)

GenerateContent generates content using the LangChainGo model interface.

func (*LangChainExecutor) Model

func (e *LangChainExecutor) Model() llms.Model

Model returns the underlying LangChainGo model for use with chains/agents.

type Port

type Port struct {
	Name string
	Type string
	From string // For inputs: "step_name.output_name"
}

Port represents an input or output of a workflow step.

type Step

type Step struct {
	Name         string
	AgentName    string
	Instructions string
	Inputs       map[string]any
	DependsOn    []string
}

Step represents a workflow step to execute.

type StepResult

type StepResult struct {
	StepName string
	Outputs  map[string]any
	Error    error
}

StepResult holds the output of a workflow step.

type Workflow

type Workflow struct {
	Name  string
	Type  WorkflowType
	Steps []WorkflowStep
}

Workflow represents a multi-agent-spec workflow.

type WorkflowExecutor

type WorkflowExecutor struct {
	// contains filtered or unexported fields
}

WorkflowExecutor runs complete workflows.

func NewWorkflowExecutor

func NewWorkflowExecutor(executor *Executor, agents map[string]AgentSpec) *WorkflowExecutor

NewWorkflowExecutor creates a new WorkflowExecutor.

func (*WorkflowExecutor) Execute

func (w *WorkflowExecutor) Execute(ctx context.Context, workflow Workflow, inputs map[string]any) (map[string]any, error)

Execute runs the workflow and returns results.

type WorkflowStep

type WorkflowStep struct {
	Name      string
	Agent     string
	DependsOn []string
	Inputs    []Port
	Outputs   []Port
}

WorkflowStep represents a step in the workflow.

type WorkflowType

type WorkflowType string

WorkflowType defines the workflow execution pattern.

const (
	WorkflowTypeChain   WorkflowType = "chain"
	WorkflowTypeScatter WorkflowType = "scatter"
	WorkflowTypeGraph   WorkflowType = "graph"
	WorkflowTypeCrew    WorkflowType = "crew"
	WorkflowTypeSwarm   WorkflowType = "swarm"
	WorkflowTypeCouncil WorkflowType = "council"
)

func (WorkflowType) IsDeterministic

func (t WorkflowType) IsDeterministic() bool

IsDeterministic returns true if the workflow is schema-controlled.

func (WorkflowType) IsSelfDirected

func (t WorkflowType) IsSelfDirected() bool

IsSelfDirected returns true if the workflow is agent-controlled.

Jump to

Keyboard shortcuts

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