Help us shape the future of Go! Take the 2026 Go Developer Survey

steps

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentResolver added in v1.6.0

type AgentResolver interface {
	ResolveAgent(ctx context.Context, agentID string) (agent.Agent, error)
}

type AgentStep

type AgentStep struct {
	AgentID string
	Agent   core.AgentExecutor
	// contains filtered or unexported fields
}

AgentStep 通过 AgentExecutor 抽象执行 agent。

func NewAgentStep

func NewAgentStep(id string, agent core.AgentExecutor) *AgentStep

NewAgentStep 创建 agent 步骤。

func (*AgentStep) Execute

func (s *AgentStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*AgentStep) ID

func (s *AgentStep) ID() string

func (*AgentStep) Type

func (s *AgentStep) Type() core.StepType

func (*AgentStep) Validate

func (s *AgentStep) Validate() error

type ChainStep added in v1.6.0

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

func NewChainStep added in v1.6.0

func NewChainStep(id string, chain tools.ToolChain, executor *tools.ChainExecutor) *ChainStep

func (*ChainStep) Execute added in v1.6.0

func (s *ChainStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*ChainStep) ID added in v1.6.0

func (s *ChainStep) ID() string

func (*ChainStep) Type added in v1.6.0

func (s *ChainStep) Type() core.StepType

func (*ChainStep) Validate added in v1.6.0

func (s *ChainStep) Validate() error

type CodeHandler

type CodeHandler func(ctx context.Context, input core.StepInput) (map[string]any, error)

CodeHandler CodeStep 执行函数签名。

type CodeStep

type CodeStep struct {
	Handler CodeHandler
	// contains filtered or unexported fields
}

CodeStep 执行自定义代码逻辑。

func NewCodeStep

func NewCodeStep(id string, handler CodeHandler) *CodeStep

NewCodeStep 创建代码步骤。

func (*CodeStep) Execute

func (s *CodeStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*CodeStep) ID

func (s *CodeStep) ID() string

func (*CodeStep) Type

func (s *CodeStep) Type() core.StepType

func (*CodeStep) Validate

func (s *CodeStep) Validate() error

type HumanStep

type HumanStep struct {
	Prompt    string
	InputType string
	Options   []string
	Timeout   time.Duration
	Handler   core.HumanInputHandler
	// contains filtered or unexported fields
}

HumanStep 通过 HumanInputHandler 请求人工输入。

func NewHumanStep

func NewHumanStep(id string, handler core.HumanInputHandler) *HumanStep

NewHumanStep 创建人工步骤。

func (*HumanStep) Execute

func (s *HumanStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*HumanStep) ID

func (s *HumanStep) ID() string

func (*HumanStep) Type

func (s *HumanStep) Type() core.StepType

func (*HumanStep) Validate

func (s *HumanStep) Validate() error

type HybridRetrieveStep

type HybridRetrieveStep struct {
	Query     string
	Retriever HybridRetriever
	// contains filtered or unexported fields
}

HybridRetrieveStep executes a hybrid retrieval node in DAG.

func NewHybridRetrieveStep

func NewHybridRetrieveStep(id string, retriever HybridRetriever) *HybridRetrieveStep

func (*HybridRetrieveStep) Execute

func (*HybridRetrieveStep) ID

func (s *HybridRetrieveStep) ID() string

func (*HybridRetrieveStep) Type

func (s *HybridRetrieveStep) Type() core.StepType

func (*HybridRetrieveStep) Validate

func (s *HybridRetrieveStep) Validate() error

type HybridRetriever

type HybridRetriever interface {
	Retrieve(ctx context.Context, query string, queryEmbedding []float64) ([]types.RetrievalRecord, error)
}

HybridRetriever abstracts hybrid retrieval execution. Uses types.RetrievalRecord to avoid coupling to rag layer implementation.

type LLMStep

type LLMStep struct {
	Model       string
	Prompt      string
	Temperature float64
	MaxTokens   int
	Gateway     core.GatewayLike
	// contains filtered or unexported fields
}

LLMStep 通过 GatewayLike 抽象调用 LLM。

func NewLLMStep

func NewLLMStep(id string, gateway core.GatewayLike) *LLMStep

NewLLMStep 创建 LLM 步骤。

func (*LLMStep) Execute

func (s *LLMStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*LLMStep) ID

func (s *LLMStep) ID() string

func (*LLMStep) Type

func (s *LLMStep) Type() core.StepType

func (*LLMStep) Validate

func (s *LLMStep) Validate() error

type MultiHopReasoner

type MultiHopReasoner interface {
	Reason(ctx context.Context, query string) (*rag.ReasoningChain, error)
}

MultiHopReasoner abstracts multi-hop retrieval reasoning. Note: ReasoningChain is rag-layer specific and kept as-is.

type MultiHopRetrieveStep

type MultiHopRetrieveStep struct {
	Query    string
	Reasoner MultiHopReasoner
	// contains filtered or unexported fields
}

MultiHopRetrieveStep executes multi-hop retrieval and flattens hop results.

func NewMultiHopRetrieveStep

func NewMultiHopRetrieveStep(id string, reasoner MultiHopReasoner) *MultiHopRetrieveStep

func (*MultiHopRetrieveStep) Execute

func (*MultiHopRetrieveStep) ID

func (s *MultiHopRetrieveStep) ID() string

func (*MultiHopRetrieveStep) Type

func (*MultiHopRetrieveStep) Validate

func (s *MultiHopRetrieveStep) Validate() error

type OrchestrationStep added in v1.6.0

type OrchestrationStep struct {
	Mode      string
	AgentIDs  []string
	MaxRounds int
	Timeout   time.Duration
	// contains filtered or unexported fields
}

func NewOrchestrationStep added in v1.6.0

func NewOrchestrationStep(id string, resolver AgentResolver, registry *multiagent.ModeRegistry, logger *zap.Logger) *OrchestrationStep

func (*OrchestrationStep) Execute added in v1.6.0

func (s *OrchestrationStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*OrchestrationStep) ID added in v1.6.0

func (s *OrchestrationStep) ID() string

func (*OrchestrationStep) Type added in v1.6.0

func (s *OrchestrationStep) Type() core.StepType

func (*OrchestrationStep) Validate added in v1.6.0

func (s *OrchestrationStep) Validate() error

type RerankStep

type RerankStep struct {
	Query    string
	Reranker RetrievalReranker
	// contains filtered or unexported fields
}

RerankStep re-orders retrieval results in DAG.

func NewRerankStep

func NewRerankStep(id string, reranker RetrievalReranker) *RerankStep

func (*RerankStep) Execute

func (s *RerankStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*RerankStep) ID

func (s *RerankStep) ID() string

func (*RerankStep) Type

func (s *RerankStep) Type() core.StepType

func (*RerankStep) Validate

func (s *RerankStep) Validate() error

type RetrievalReranker

type RetrievalReranker interface {
	Rerank(ctx context.Context, query string, results []types.RetrievalRecord) ([]types.RetrievalRecord, error)
}

RetrievalReranker abstracts retrieval rerank behavior. Uses types.RetrievalRecord to avoid coupling to rag layer implementation.

type SubgraphExecutor added in v1.6.0

type SubgraphExecutor interface {
	ExecuteSubgraph(ctx context.Context, input any) (any, error)
}

SubgraphExecutor executes a subgraph workflow DAG and returns the result.

type SubgraphTool added in v1.6.0

type SubgraphTool struct {
	Name        string
	Description string
	InputSchema map[string]any
	// contains filtered or unexported fields
}

SubgraphTool wraps a subgraph DAG as a tool that agents can invoke.

func NewSubgraphTool added in v1.6.0

func NewSubgraphTool(name, description string, executor SubgraphExecutor) *SubgraphTool

NewSubgraphTool creates a tool backed by a subgraph executor.

func (*SubgraphTool) Execute added in v1.6.0

func (t *SubgraphTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)

Execute runs the subgraph with the provided JSON arguments and returns the result as JSON.

func (*SubgraphTool) ToolSchema added in v1.6.0

func (t *SubgraphTool) ToolSchema() map[string]any

ToolSchema returns the tool schema for agent registration.

func (*SubgraphTool) WithInputSchema added in v1.6.0

func (t *SubgraphTool) WithInputSchema(schema map[string]any) *SubgraphTool

WithInputSchema sets a custom JSON Schema for the tool's input parameters.

type ToolStep

type ToolStep struct {
	ToolName string
	Params   map[string]any
	Registry core.ToolRegistry
	// contains filtered or unexported fields
}

ToolStep 通过 ToolRegistry 执行工具调用。

func NewToolStep

func NewToolStep(id string, toolName string, registry core.ToolRegistry) *ToolStep

NewToolStep 创建工具步骤。

func (*ToolStep) Execute

func (s *ToolStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*ToolStep) ID

func (s *ToolStep) ID() string

func (*ToolStep) Type

func (s *ToolStep) Type() core.StepType

func (*ToolStep) Validate

func (s *ToolStep) Validate() error

Jump to

Keyboard shortcuts

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