Documentation
¶
Overview ¶
Package engine is the deterministic orchestrator core for RFC 0010 workflow compositions. It resolves ${...} references against a scope, evaluates the constrained predicate language, merges parallel outputs, and walks the step DAG. Step side-effects run through an injected StepExecutor, so this package imports neither runtime/pipeline nor runtime/providers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the deterministic composition scheduler.
func NewWithRecorder ¶
func NewWithRecorder(exec StepExecutor, rec Recorder) *Engine
NewWithRecorder builds an Engine that records step observations via rec. A nil rec is equivalent to calling New(exec).
func (*Engine) Execute ¶
func (e *Engine) Execute( ctx context.Context, comp *composition.Composition, input json.RawMessage, ) (json.RawMessage, error)
Execute walks the composition's step DAG to completion and returns the bound output (comp.Output, or the last output-producing step). The scope map is not safe for concurrent mutation; parallel branches (Task 7) read it during fan-out and their merged result is written back only at the join.
type NamedOutput ¶
NamedOutput pairs a parallel branch id with its decoded output, in branch order.
type Recorder ¶
type Recorder interface {
RecordStepStarted(stepID, kind string, input json.RawMessage)
RecordStepCompleted(stepID, kind string, input, output json.RawMessage, attempt int, err error)
RecordBranch(stepID string, takenTarget string)
RecordParallel(stepID string, branches []NamedOutput)
}
Recorder observes step execution for observability (Arena testability). Methods are called during Execute; a nil Recorder disables recording. RecordStepStarted and RecordStepCompleted may be called concurrently from parallel branches — implementations must be safe.
type Scope ¶
Scope holds the composition input plus each completed step's output, shaped for ${input.X} and ${stepID.output.X} resolution.
type StepExecutor ¶
type StepExecutor func(ctx context.Context, step *composition.Step, input json.RawMessage) (json.RawMessage, error)
StepExecutor runs one leaf step (prompt|agent|tool) and returns its raw output. input is the step's resolved Input (prompt/agent) or resolved Args (tool), marshaled to JSON. Injected so the orchestrator core is testable without a pipeline; Plan 2b supplies the production implementation. For an arg-less tool (nil Args) or nil Input, input is the JSON literal `null`; production executors must treat `null` as "no input/args".