nrunsubflow

package
v0.0.0-...-36d6306 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeRunSubFlow

type NodeRunSubFlow struct {
	FlowNodeID     idwrap.IDWrap
	Name           string
	TargetFlowID   *idwrap.IDWrap
	TargetFlowName string
	Inputs         []mflow.SubFlowInputMapping
	Executor       SubFlowExecutor

	// TargetParams holds the target sub-flow's trigger parameter definitions.
	// Populated by the builder when it can resolve the target flow.
	// Used by GetAIParams() for AI tool integration.
	TargetParams []mflow.SubFlowParam
}

NodeRunSubFlow invokes another flow from the parent flow. It evaluates input expressions, calls the SubFlowExecutor, and writes the sub-flow outputs to the parent VarMap under this node's name.

func New

func New(
	id idwrap.IDWrap,
	name string,
	targetFlowID *idwrap.IDWrap,
	targetFlowName string,
	inputs []mflow.SubFlowInputMapping,
	executor SubFlowExecutor,
) *NodeRunSubFlow

func (*NodeRunSubFlow) GetAIParams

func (n *NodeRunSubFlow) GetAIParams() []nai.AIParam

GetAIParams implements nai.AIParamProvider. When RunSubFlow is connected to an AI node via HandleAiTools, the AI agent can invoke it as a tool. The parameter schema comes from the target flow's SubFlowTrigger params.

func (*NodeRunSubFlow) GetID

func (n *NodeRunSubFlow) GetID() idwrap.IDWrap

func (*NodeRunSubFlow) GetName

func (n *NodeRunSubFlow) GetName() string

func (*NodeRunSubFlow) GetOutputVariables

func (n *NodeRunSubFlow) GetOutputVariables() []string

GetOutputVariables implements node.VariableIntrospector.

func (*NodeRunSubFlow) GetRequiredVariables

func (n *NodeRunSubFlow) GetRequiredVariables() []string

GetRequiredVariables implements node.VariableIntrospector.

func (*NodeRunSubFlow) RunAsync

func (n *NodeRunSubFlow) RunAsync(ctx context.Context, req *node.FlowNodeRequest, resultChan chan node.FlowNodeResult)

func (*NodeRunSubFlow) RunSync

type SubFlowExecutor

type SubFlowExecutor interface {
	// ExecuteSubFlow runs the target flow with the given input variables.
	// It returns the output variables produced by the sub-flow's Return node.
	ExecuteSubFlow(ctx context.Context, targetFlowID *idwrap.IDWrap, targetFlowName string, inputVars map[string]any) (map[string]any, error)
}

SubFlowExecutor loads and runs a target sub-flow. Implementations live in the flowbuilder or CLI packages where they have access to all required services.

Jump to

Keyboard shortcuts

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