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:
- a
WorkflowRunhandle that can pause and resume, plus streaming viaWorkflow::run_stream; - human-in-the-loop requests through
RequestInfoExecutorand the run handle’ssend_responses; - run-scoped
SharedStatevisible to every executor; - checkpointing at superstep boundaries with in-memory and file-backed storage;
- graph validation at build time;
- visualization as Mermaid and Graphviz DOT;
- sub-workflow composition via
WorkflowExecutor.
Structs§
- Agent
Approval Executor - An
Executorthat runs anSupportsAgentRunover the incoming conversation, then pauses for human approval of its reply before forwarding it downstream. Rust analogue ofAgentApprovalExecutor. - Agent
Executor - An
Executorthat runs anSupportsAgentRunover the incoming conversation and appends the agent’s reply. Rust analogue ofAgentExecutor. - Approval
Request - The
request_infopayload emitted while an agent’s reply awaits human approval: the conversation the agent replied to, plus its pending reply. Round-trips throughRequestResponse::original_requestso the executor needs no state of its own. - Case
- A switch/case branch: if
conditionmatches, route totarget. - Concurrent
Builder - Builder for a concurrent fan-out/fan-in over agents. Rust analogue of
ConcurrentBuilder. - Default
- The default branch of a switch/case group.
- File
Checkpoint Storage - File-based checkpoint storage: one JSON file per checkpoint in a directory.
- Function
Executor - An executor built from an async closure. Rust analogue of
@executor. - Group
Chat Builder - Builder for a group chat workflow. Rust analogue of
GroupChatBuilder. - Group
Chat State - A snapshot of orchestration state handed to a
GroupChatManagerfor its speaker-selection decision. Rust analogue ofGroupChatStateSnapshot. - Handoff
Builder - Builder for a handoff workflow. Rust analogue of
HandoffBuilder. - Handoff
Edge Builder - Intermediate builder returned by
HandoffBuilder::add_handoffto expressadd_handoff(source).to([targets])fluently. - Handoff
User Input Request - The payload of the request-info event emitted when the workflow needs fresh
user input. Rust analogue of Python’s
HandoffUserInputRequest. - InMemory
Checkpoint Storage - In-memory checkpoint storage for testing and development.
- Magentic
Builder - Builder for a Magentic workflow. Rust analogue of
MagenticBuilder. - Magentic
Context - Mutable state threaded through the Magentic manager and orchestrator. Rust
analogue of
MagenticContext. - Magentic
Plan Review Request - 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
_MagenticHumanInterventionRequestnarrowed to itskind=PLAN_REVIEWfields (task_text,facts_text,plan_text,round_index). - Magentic
Progress Ledger - The structured progress ledger produced each round. Rust analogue of
_MagenticProgressLedger. - Magentic
Progress Ledger Item - A single progress-ledger field: a reason plus a boolean or string answer.
Rust analogue of
_MagenticProgressLedgerItem. - Magentic
Stall Intervention Request - 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
_MagenticHumanInterventionRequestnarrowed to itskind=STALLfields (stall_count,max_stall_count,task_text,facts_text,plan_text,last_agent,stall_reason), plusround/resets_so_farfor context. - Magentic
Task Ledger - Facts + plan captured for a run. Rust analogue of
_MagenticTaskLedger. - Manager
Selection Response - The structured decision an LLM manager returns. Ported from Python’s
ManagerSelectionResponse; the orchestrator parses the manager agent’s JSON output into this shape. - Pending
Request - An outstanding request awaiting an external response.
- Request
Info Executor - A built-in node that surfaces incoming messages as external requests.
- Request
Response - 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
Messagewhich retainsoriginal_request. - Round
Robin Manager - The default manager: cycles through participants in registration order.
- Sequential
Builder - 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. - Shared
State - A thread-safe, async, string→JSON store shared by all executors in a run.
- Standard
Magentic Manager - The standard LLM-driven manager. Rust analogue of
StandardMagenticManager. - Workflow
- A built, runnable workflow graph.
- Workflow
Agent - An
SupportsAgentRunthat wraps aWorkflowand exposes it through the agent interface. Rust analogue ofWorkflowAgent. - Workflow
Builder - Fluent builder for a
Workflow. Rust equivalent ofWorkflowBuilder. - Workflow
Checkpoint - A complete snapshot of a workflow’s execution state.
- Workflow
Checkpoint Summary - A human-readable summary of a checkpoint. Rust analogue of
WorkflowCheckpointSummary. - Workflow
Context - 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. - Workflow
Executor - An
Executorthat runs a childWorkflow, enabling hierarchical composition. - Workflow
Message - A message routed between executors within the graph.
- Workflow
Run - 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.
- Workflow
RunStream - A live stream of
WorkflowEvents from a running workflow, plus a way to obtain the finalWorkflowRunonce the stream is exhausted. - Workflow
Validation Error - A typed workflow validation error carrying its
ValidationType. - Workflow
Viz - A visualization helper bound to a built
Workflow.
Enums§
- Edge
Group - A group of edges sharing routing semantics. Rust equivalent of the
EdgeGrouphierarchy. - Group
Chat Directive - An instruction emitted by a
GroupChatManager: either route to a participant, or finish the conversation. Rust analogue ofGroupChatDirective. - Handoff
Interaction Mode - Whether the workflow pauses for fresh user input between agent turns.
- Magentic
Plan Review Decision - A human’s decision on a
MagenticPlanReviewRequest. Rust analogue of Python’s_MagenticHumanInterventionReplynarrowed to plan review, withMagenticHumanInterventionDecision.{APPROVE,REVISE}as the two variants. - Magentic
Stall Intervention Decision - A human’s decision on a
MagenticStallInterventionRequest. Rust analogue of Python’s_MagenticHumanInterventionReplynarrowed to the stall subset ofMagenticHumanInterventionDecision(CONTINUE/REPLAN/GUIDANCE). - Validation
Type - The category of a workflow validation failure. Mirrors Python’s
ValidationTypeEnum(subset relevant to this engine). - Workflow
Event - An event observed while a workflow runs.
- Workflow
RunState - The run state of a workflow, mirroring Python’s
WorkflowRunState.
Constants§
- DEFAULT_
GROUP_ CHAT_ MAX_ ITERATIONS - Safety bound on manager rounds applied by
GroupChatBuilderwhen no explicitmax_roundsis 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(theManagerDirectiveModelfield 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§
- Checkpoint
Storage - Storage backend for workflow checkpoints.
- Executor
- A node in a workflow graph.
- Group
Chat Manager - The decision-making interface for a group chat. Implementations pick the
next speaker or finish the conversation. Rust analogue of the manager
callable /
set_manageragent in Python. - Magentic
Manager - The Magentic manager interface: planning, replanning, progress evaluation,
and final-answer synthesis. Rust analogue of
MagenticManagerBase. - Workflow
Agent Ext - Extension trait adding
Workflow::as_agentso a built workflow can be exposed as anSupportsAgentRunfluently.
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.