Documentation
¶
Overview ¶
Package orchestration provides patterns for building Eino-based agent workflows.
Index ¶
- type AgentCaller
- type Executor
- type GraphBuilder
- func (gb *GraphBuilder[I, O]) AddEdge(from, to string) error
- func (gb *GraphBuilder[I, O]) AddEndEdge(from string) error
- func (gb *GraphBuilder[I, O]) AddLambdaNodeFunc(name string, lambda *compose.Lambda) error
- func (gb *GraphBuilder[I, O]) AddStartEdge(to string) error
- func (gb *GraphBuilder[I, O]) Build() *compose.Graph[I, O]
- func (gb *GraphBuilder[I, O]) Graph() *compose.Graph[I, O]
- func (gb *GraphBuilder[I, O]) SetClient(client *http.Client) *GraphBuilder[I, O]
- type HTTPHandler
- type QualityDecision
- type State
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 ¶
NewExecutor creates a new graph executor.
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 (*State) GetMetadata ¶
GetMetadata gets a metadata value.
func (*State) SetMetadata ¶
SetMetadata sets a metadata value.