Skip to main content

Module workflow

Module workflow 

Source
Expand description

Graph-based multi-agent workflow orchestration.

Rust equivalent of agent_framework._workflows. A Workflow is a directed graph of Executor nodes connected by EdgeGroups, executed in supersteps (Pregel/BSP style): messages sent during a superstep are buffered and delivered at its end. Execution runs until no messages remain or max_iterations is hit.

Beyond the core superstep engine this module provides:

Structs§

AgentApprovalExecutor
An Executor that runs an SupportsAgentRun over the incoming conversation, then pauses for human approval of its reply before forwarding it downstream. Rust analogue of AgentApprovalExecutor.
AgentExecutor
An Executor that runs an SupportsAgentRun over the incoming conversation and appends the agent’s reply. Rust analogue of AgentExecutor.
ApprovalRequest
The request_info payload emitted while an agent’s reply awaits human approval: the conversation the agent replied to, plus its pending reply. Round-trips through RequestResponse::original_request so the executor needs no state of its own.
Case
A switch/case branch: if condition matches, route to target.
ConcurrentBuilder
Builder for a concurrent fan-out/fan-in over agents. Rust analogue of ConcurrentBuilder.
Default
The default branch of a switch/case group.
FileCheckpointStorage
File-based checkpoint storage: one JSON file per checkpoint in a directory.
FunctionExecutor
An executor built from an async closure. Rust analogue of @executor.
GroupChatBuilder
Builder for a group chat workflow. Rust analogue of GroupChatBuilder.
GroupChatState
A snapshot of orchestration state handed to a GroupChatManager for its speaker-selection decision. Rust analogue of GroupChatStateSnapshot.
HandoffBuilder
Builder for a handoff workflow. Rust analogue of HandoffBuilder.
HandoffEdgeBuilder
Intermediate builder returned by HandoffBuilder::add_handoff to express add_handoff(source).to([targets]) fluently.
HandoffUserInputRequest
The payload of the request-info event emitted when the workflow needs fresh user input. Rust analogue of Python’s HandoffUserInputRequest.
InMemoryCheckpointStorage
In-memory checkpoint storage for testing and development.
MagenticBuilder
Builder for a Magentic workflow. Rust analogue of MagenticBuilder.
MagenticContext
Mutable state threaded through the Magentic manager and orchestrator. Rust analogue of MagenticContext.
MagenticPlanReviewRequest
The payload of the request-info event emitted when plan review is enabled and the orchestrator needs a human decision on the task ledger. Rust analogue of Python’s _MagenticHumanInterventionRequest narrowed to its kind=PLAN_REVIEW fields (task_text, facts_text, plan_text, round_index).
MagenticProgressLedger
The structured progress ledger produced each round. Rust analogue of _MagenticProgressLedger.
MagenticProgressLedgerItem
A single progress-ledger field: a reason plus a boolean or string answer. Rust analogue of _MagenticProgressLedgerItem.
MagenticStallInterventionRequest
The payload of the request-info event emitted when stall intervention is enabled and the round loop detects a stall. Rust analogue of Python’s _MagenticHumanInterventionRequest narrowed to its kind=STALL fields (stall_count, max_stall_count, task_text, facts_text, plan_text, last_agent, stall_reason), plus round/resets_so_far for context.
MagenticTaskLedger
Facts + plan captured for a run. Rust analogue of _MagenticTaskLedger.
ManagerSelectionResponse
The structured decision an LLM manager returns. Ported from Python’s ManagerSelectionResponse; the orchestrator parses the manager agent’s JSON output into this shape.
PendingRequest
An outstanding request awaiting an external response.
RequestInfoExecutor
A built-in node that surfaces incoming messages as external requests.
RequestResponse
The message delivered back to the requesting executor when a response is supplied. Carries the original request data alongside the response, mirroring Python’s response Message which retains original_request.
RoundRobinManager
The default manager: cycles through participants in registration order.
SequentialBuilder
Builder for a sequential pipeline of agents. Rust analogue of SequentialBuilder. Each participant sees the running conversation and appends its reply; the final conversation is yielded as output.
SharedState
A thread-safe, async, string→JSON store shared by all executors in a run.
StandardMagenticManager
The standard LLM-driven manager. Rust analogue of StandardMagenticManager.
Workflow
A built, runnable workflow graph.
WorkflowAgent
An SupportsAgentRun that wraps a Workflow and exposes it through the agent interface. Rust analogue of WorkflowAgent.
WorkflowBuilder
Fluent builder for a Workflow. Rust equivalent of WorkflowBuilder.
WorkflowCheckpoint
A complete snapshot of a workflow’s execution state.
WorkflowCheckpointSummary
A human-readable summary of a checkpoint. Rust analogue of WorkflowCheckpointSummary.
WorkflowContext
Collects the effects an executor produces while handling a message: messages to send downstream, workflow outputs, custom events, info requests, and access to run-scoped SharedState.
WorkflowExecutor
An Executor that runs a child Workflow, enabling hierarchical composition.
WorkflowMessage
A message routed between executors within the graph.
WorkflowRun
A live workflow run: owns the pending message queue, fan-in buffers, iteration count, shared state, and outstanding requests, so a run can pause (awaiting external input) and later resume.
WorkflowRunStream
A live stream of WorkflowEvents from a running workflow, plus a way to obtain the final WorkflowRun once the stream is exhausted.
WorkflowValidationError
A typed workflow validation error carrying its ValidationType.
WorkflowViz
A visualization helper bound to a built Workflow.

Enums§

EdgeGroup
A group of edges sharing routing semantics. Rust equivalent of the EdgeGroup hierarchy.
GroupChatDirective
An instruction emitted by a GroupChatManager: either route to a participant, or finish the conversation. Rust analogue of GroupChatDirective.
HandoffInteractionMode
Whether the workflow pauses for fresh user input between agent turns.
MagenticPlanReviewDecision
A human’s decision on a MagenticPlanReviewRequest. Rust analogue of Python’s _MagenticHumanInterventionReply narrowed to plan review, with MagenticHumanInterventionDecision.{APPROVE,REVISE} as the two variants.
MagenticStallInterventionDecision
A human’s decision on a MagenticStallInterventionRequest. Rust analogue of Python’s _MagenticHumanInterventionReply narrowed to the stall subset of MagenticHumanInterventionDecision (CONTINUE / REPLAN / GUIDANCE).
ValidationType
The category of a workflow validation failure. Mirrors Python’s ValidationTypeEnum (subset relevant to this engine).
WorkflowEvent
An event observed while a workflow runs.
WorkflowRunState
The run state of a workflow, mirroring Python’s WorkflowRunState.

Constants§

DEFAULT_GROUP_CHAT_MAX_ITERATIONS
Safety bound on manager rounds applied by GroupChatBuilder when no explicit max_rounds is configured.
DEFAULT_MANAGER_INSTRUCTIONS
Default instructions for an LLM group-chat manager. Ported verbatim from Python’s DEFAULT_MANAGER_INSTRUCTIONS.
DEFAULT_MANAGER_STRUCTURED_OUTPUT_PROMPT
The structured-output contract described to an LLM manager. Ported verbatim from Python’s DEFAULT_MANAGER_STRUCTURED_OUTPUT_PROMPT (the ManagerDirectiveModel field naming).
MAGENTIC_MANAGER_NAME
The author name used for orchestrator/manager-generated messages.
ORCHESTRATOR_FINAL_ANSWER_PROMPT
Final-answer synthesis prompt. Placeholder: {task}.
ORCHESTRATOR_PROGRESS_LEDGER_PROMPT
Progress-ledger prompt requesting structured JSON. Placeholders: {task}, {team}, {names}.
ORCHESTRATOR_TASK_LEDGER_FACTS_PROMPT
Facts pre-survey prompt. Placeholder: {task}.
ORCHESTRATOR_TASK_LEDGER_FACTS_UPDATE_PROMPT
Facts-update prompt used on replan. Placeholders: {task}, {old_facts}.
ORCHESTRATOR_TASK_LEDGER_FULL_PROMPT
Combined task-ledger render. Placeholders: {task}, {team}, {facts}, {plan}.
ORCHESTRATOR_TASK_LEDGER_PLAN_PROMPT
Plan prompt. Placeholder: {team}.
ORCHESTRATOR_TASK_LEDGER_PLAN_UPDATE_PROMPT
Plan-update prompt used on replan. Placeholder: {team}.

Traits§

CheckpointStorage
Storage backend for workflow checkpoints.
Executor
A node in a workflow graph.
GroupChatManager
The decision-making interface for a group chat. Implementations pick the next speaker or finish the conversation. Rust analogue of the manager callable / set_manager agent in Python.
MagenticManager
The Magentic manager interface: planning, replanning, progress evaluation, and final-answer synthesis. Rust analogue of MagenticManagerBase.
WorkflowAgentExt
Extension trait adding Workflow::as_agent so a built workflow can be exposed as an SupportsAgentRun fluently.

Functions§

get_checkpoint_summary
Summarize a checkpoint. Rust analogue of get_checkpoint_summary.
handoff_tool_spec
Build the marker tool spec for handing off to target. Rust analogue of Python’s _create_handoff_tool.
validate_workflow_graph
Validate a workflow graph. Rust analogue of validate_workflow_graph.

Type Aliases§

Condition
A predicate deciding whether a message should traverse an edge.
Selection
A runtime target selector for multi-selection / switch edges: given the message and the candidate target ids, return the ids to route to.