Add files via upload

This commit is contained in:
公明
2026-07-03 19:36:40 +08:00
committed by GitHub
parent c86825d365
commit 93a600d60e
16 changed files with 2025 additions and 821 deletions
+24
View File
@@ -0,0 +1,24 @@
package workflow
import (
"context"
"github.com/cloudwego/eino/compose"
)
// compileAgentSubgraph wraps an Agent canvas node as an Eino subgraph (AddGraphNode best practice).
func compileAgentSubgraph(_ context.Context, node graphNode) (compose.AnyGraph, error) {
n := node
innerID := n.ID + "__agent"
g := compose.NewGraph[WorkflowNodeOutput, WorkflowNodeOutput]()
_ = g.AddLambdaNode(innerID, compose.InvokableLambda(func(runCtx context.Context, _ WorkflowNodeOutput) (WorkflowNodeOutput, error) {
return runWorkflowNodeLambda(runCtx, n)
}))
if err := g.AddEdge(compose.START, innerID); err != nil {
return nil, err
}
if err := g.AddEdge(innerID, compose.END); err != nil {
return nil, err
}
return g, nil
}