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

orchestration

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package orchestration provides patterns for building Eino-based agent workflows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentCaller

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

AgentCaller provides methods for calling other agents via HTTP.

func NewAgentCaller

func NewAgentCaller(baseURL, name string) *AgentCaller

NewAgentCaller creates a new agent caller.

func (*AgentCaller) Call

func (ac *AgentCaller) Call(ctx context.Context, endpoint string, request, response interface{}) error

Call calls an agent endpoint with JSON request/response.

func (*AgentCaller) HealthCheck

func (ac *AgentCaller) HealthCheck(ctx context.Context) error

HealthCheck checks if the agent is healthy.

func (*AgentCaller) SetClient

func (ac *AgentCaller) SetClient(client *http.Client) *AgentCaller

SetClient sets a custom HTTP client.

type Executor

type Executor[I, O any] struct {
	// contains filtered or unexported fields
}

Executor executes a compiled Eino graph.

func NewExecutor

func NewExecutor[I, O any](graph *compose.Graph[I, O], name string) *Executor[I, O]

NewExecutor creates a new graph executor.

func (*Executor[I, O]) Execute

func (e *Executor[I, O]) Execute(ctx context.Context, input I) (O, error)

Execute compiles and runs the graph.

func (*Executor[I, O]) SetClient

func (e *Executor[I, O]) SetClient(client *http.Client) *Executor[I, O]

SetClient sets a custom HTTP client.

type GraphBuilder

type GraphBuilder[I, O any] struct {
	// contains filtered or unexported fields
}

GraphBuilder helps construct Eino workflow graphs.

func NewGraphBuilder

func NewGraphBuilder[I, O any](name string) *GraphBuilder[I, O]

NewGraphBuilder creates a new graph builder.

func (*GraphBuilder[I, O]) AddEdge

func (gb *GraphBuilder[I, O]) AddEdge(from, to string) error

AddEdge adds an edge between two nodes.

func (*GraphBuilder[I, O]) AddEndEdge

func (gb *GraphBuilder[I, O]) AddEndEdge(from string) error

AddEndEdge adds an edge from a node to END.

func (*GraphBuilder[I, O]) AddLambdaNodeFunc

func (gb *GraphBuilder[I, O]) AddLambdaNodeFunc(name string, lambda *compose.Lambda) error

AddLambdaNodeFunc adds a lambda node using a function. Note: Due to Go generics limitations, you may need to use Graph() directly for complex type conversions.

func (*GraphBuilder[I, O]) AddStartEdge

func (gb *GraphBuilder[I, O]) AddStartEdge(to string) error

AddStartEdge adds an edge from START to a node.

func (*GraphBuilder[I, O]) Build

func (gb *GraphBuilder[I, O]) Build() *compose.Graph[I, O]

Build returns the completed graph.

func (*GraphBuilder[I, O]) Graph

func (gb *GraphBuilder[I, O]) Graph() *compose.Graph[I, O]

Graph returns the underlying Eino graph for direct manipulation. Use this when you need access to Eino-specific features.

func (*GraphBuilder[I, O]) SetClient

func (gb *GraphBuilder[I, O]) SetClient(client *http.Client) *GraphBuilder[I, O]

SetClient sets a custom HTTP client for agent calls.

type HTTPHandler

type HTTPHandler[I, O any] struct {
	// contains filtered or unexported fields
}

HTTPHandler wraps an executor as an HTTP handler.

func NewHTTPHandler

func NewHTTPHandler[I, O any](executor *Executor[I, O]) *HTTPHandler[I, O]

NewHTTPHandler creates a new HTTP handler for a graph executor.

func (*HTTPHandler[I, O]) ServeHTTP

func (h *HTTPHandler[I, O]) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

type QualityDecision

type QualityDecision struct {
	// Passed indicates if the quality check passed.
	Passed bool `json:"passed"`

	// Score is the quality score (0-100).
	Score int `json:"score"`

	// Target is the target score.
	Target int `json:"target"`

	// Shortfall is how many points short of the target.
	Shortfall int `json:"shortfall"`

	// Message provides a human-readable explanation.
	Message string `json:"message"`
}

QualityDecision represents a quality gate decision in a workflow.

func NewQualityDecision

func NewQualityDecision(score, target int) *QualityDecision

NewQualityDecision creates a new quality decision.

type State

type State struct {
	// StepName tracks the current step in the workflow.
	StepName string `json:"step_name,omitempty"`

	// Error stores any error encountered during processing.
	Error string `json:"error,omitempty"`

	// Metadata stores arbitrary key-value pairs.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

State represents a generic workflow state. Implementations should embed this and add their own fields.

func NewState

func NewState(stepName string) *State

NewState creates a new state with the given step name.

func (*State) GetMetadata

func (s *State) GetMetadata(key string) (interface{}, bool)

GetMetadata gets a metadata value.

func (*State) HasError

func (s *State) HasError() bool

HasError returns true if there is an error.

func (*State) SetError

func (s *State) SetError(err error)

SetError sets the error message.

func (*State) SetMetadata

func (s *State) SetMetadata(key string, value interface{})

SetMetadata sets a metadata value.

Jump to

Keyboard shortcuts

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