Repository navigation
Chaining fanouts in workflow #4694
|
How can I add edges behind a fanout workflow step?, e.g. either add another executor which then processes further, or even preferred add additional fanout edges behind it?. var workflow = new WorkflowBuilder(orchestrator)
.AddFanOutEdge(orchestrator, [.. researchAgents])
.AddFanInBarrierEdge([.. researchAgents], collector)
.AddFanOutEdge(collector, [.. summaryAgents])
.AddFanInBarrierEdge([.. summaryAgents], synthesize)
.WithOutputFrom(synthesize).Build();In the example above, the researchAgents are collected in the |
Replies: 1 comment 1 reply
|
Stefan (@Tornhoof) Hope it is not too late. Based on what I found, you can chain fan-outs and fan-ins, but the key is that a So the pattern: .AddFanOutEdge(orchestrator, researchAgents)
.AddFanInBarrierEdge(researchAgents, collector)
.AddFanOutEdge(collector, summaryAgents)works because For your second case, where each research agent should have its own summary fan-out/fan-in path, you would need separate edges for each branch rather than one shared fan-in: The workflow builder supports multiple independent fan-out and fan-in edges, so this structure can be represented directly. I found the edge documentation and concurrent workflow examples useful when working this out. Hope this helps. If this solved your issue, please mark this comment as the solution. It would be highly appreciated. https://learn.microsoft.com/en-us/agent-framework/concepts/workflows/edges?pivots=programming-language-csharp |
Stefan (@Tornhoof) Hope it is not too late. Based on what I found, you can chain fan-outs and fan-ins, but the key is that a
FanInBarrierEdgeis what creates the synchronization point.So the pattern:
works because
collectorreceives the combined results before starting the next fan-out.For your second case, where each research agent should have its own summary fan-out/fan-in path, you would need separate edges for each branch rather than one shared fan-in:
The wor…