Add files via upload

This commit is contained in:
公明 authored and GitHub committed 2026-07-03 19:36:40 +08:00
1 parent c86825d365
commit 93a600d60e
16 files changed
+2025 -821

No files matched your search

+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
}