Implementation:Microsoft Agent framework SequentialBuilder Init
| Knowledge Sources | |
|---|---|
| Domains | Agent_Architecture, Multi_Agent_Systems |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
The SequentialBuilder class is the builder for constructing sequential multi-agent workflows in the Microsoft Agent Framework. It accepts an ordered list of agent participants and produces a Workflow that passes a shared conversation through each participant in sequence, where each agent's output becomes part of the input for the next agent.
Description
SequentialBuilder implements the builder pattern for sequential agent orchestration. The constructor accepts the list of participants (agents or executors), optional checkpoint storage for fault tolerance, and a flag controlling whether intermediate outputs are emitted. The build() method wires the participants into a pipeline: input -> _InputToConversation -> participant1 -> ... -> participantN -> _EndWithConversation, and returns a Workflow object ready for execution.
Usage
Import SequentialBuilder from the orchestrations package. Pass an ordered list of agents to the participants parameter. Optionally configure checkpoint storage for resilience and intermediate outputs for streaming progress. Call build() to produce the workflow, then run() to execute it.
Code Reference
Source Location
- Repository: agent-framework
- File: python/packages/orchestrations/agent_framework_orchestrations/_sequential.py
- Lines: L108-278
Signature
class SequentialBuilder:
def __init__(
self,
*,
participants: Sequence[SupportsAgentRun | Executor],
checkpoint_storage: CheckpointStorage | None = None,
intermediate_outputs: bool = False,
) -> None:
def with_request_info(
self,
*,
agents: Sequence[str | SupportsAgentRun] | None = None,
) -> "SequentialBuilder":
def build(self) -> Workflow:
Import
from agent_framework.orchestrations import SequentialBuilder
I/O Contract
Inputs (Constructor Parameters)
| Name | Type | Required | Description |
|---|---|---|---|
| participants | Executor] | Yes | Ordered list of agent participants. Each participant is invoked in sequence, receiving the shared conversation that includes all prior agents' responses. Accepts objects implementing SupportsAgentRun or Executor.
|
| checkpoint_storage | None | No | Optional storage backend for persisting intermediate pipeline state. Enables recovery from failures without restarting the entire sequence. |
| intermediate_outputs | bool |
No | When True, the workflow emits each agent's output as it completes rather than only returning the final result. Defaults to False.
|
Builder Methods
| Method | Returns | Description |
|---|---|---|
with_request_info(agents=...) |
SequentialBuilder |
Attaches request-level metadata specifying which agents should receive request info. Returns self for method chaining.
|
build() |
Workflow |
Wires the participants into a sequential pipeline and returns a Workflow object ready for execution via run().
|
Outputs
| Name | Type | Description |
|---|---|---|
| workflow | Workflow |
A configured workflow that executes the sequential agent pipeline. Call await workflow.run(input) to execute the pipeline and collect results via result.get_outputs().
|
Internal Wiring
The build() method constructs the following pipeline:
input -> _InputToConversation -> participant1 -> participant2 -> ... -> participantN -> _EndWithConversation
- _InputToConversation: Converts the raw user input (string or message) into a conversation object that agents can process.
- participant1..N: Each participant receives the current conversation, generates a response, and appends it to the conversation before passing it to the next participant.
- _EndWithConversation: Collects the final conversation state and packages it as the workflow result.
Usage Examples
Basic Sequential Pipeline
from agent_framework.orchestrations import SequentialBuilder
workflow = SequentialBuilder(participants=[writer, reviewer]).build()
result = await workflow.run("Write a blog post about AI agents")
outputs = result.get_outputs()
Three-Agent Pipeline With Intermediate Outputs
from agent_framework.orchestrations import SequentialBuilder
workflow = SequentialBuilder(
participants=[researcher, writer, editor],
intermediate_outputs=True,
).build()
result = await workflow.run("Create a report on renewable energy trends")
for output in result.get_outputs():
print(output)
Pipeline With Checkpoint Storage
from agent_framework.orchestrations import SequentialBuilder
workflow = SequentialBuilder(
participants=[planner, executor, verifier],
checkpoint_storage=my_checkpoint_store,
).build()
result = await workflow.run("Deploy the staging environment")
outputs = result.get_outputs()
Using Request Info
from agent_framework.orchestrations import SequentialBuilder
workflow = (
SequentialBuilder(participants=[writer, reviewer])
.with_request_info(agents=[writer])
.build()
)
result = await workflow.run("Write a technical specification")
outputs = result.get_outputs()
Related Pages
Implements Principle
- Principle:Microsoft_Agent_framework_Sequential_Orchestration
- Environment:Microsoft_Agent_framework_Python_3_10_Runtime
Sources
| Type | Name | URL |
|---|---|---|
| Repo | Microsoft Agent Framework | https://github.com/microsoft/agent-framework |