Normandy.Coordination.SequentialOrchestrator
(normandy v2.2.0)
View Source
Runs agents one after another, each on the previous agent's output.
{:ok, results} =
SequentialOrchestrator.execute(
[
%{id: "research", agent: research_agent, transform: &extract_data/1},
%{id: "write", agent: writing_agent}
],
"Summarize the 2026 Elixir survey"
)
results["write"]agents holds %Normandy.Agents.BaseAgentConfig{} structs (keyed "agent_0",
"agent_1", ... in list order) or specs %{id: id, agent: config} with an optional
:transform (fn output -> term end): what it returns is the agent's result and the
next agent's input. The first agent receives input.
Results
{:ok, %{id => output}} when every agent succeeded; the pipeline's output is the last
agent's. Otherwise {:error, %Normandy.OrchestrationError{}} with the outputs of the
agents that succeeded and the exception of each that failed. With on_error: :stop
the agents after the failure did not run and are in neither map.
Summary
Functions
Runs agents in order, the first on input; see "Results".
Runs agent specs with message-based communication. Each agent receives the previous
AgentMessage's payload and answers with a reply, or an error message whose payload
:error is the exception's message. Takes no options.
Functions
@spec execute([Normandy.Coordination.Orchestration.agent()], term(), keyword()) :: Normandy.Coordination.Orchestration.result()
Runs agents in order, the first on input; see "Results".
Options
:on_agent_complete(function of arity 2) -fn agent_id, output -> any end, called after each agent that succeeds (after:transform).:on_error-:stopends the pipeline at the first failure.:continueruns the remaining agents, the next one receiving the last successful output (orinput). Either way a failure makes the result{:error, %Normandy.OrchestrationError{}}. The default value is:stop.
@spec execute_with_messages( [Normandy.Coordination.Orchestration.spec()], Normandy.Coordination.AgentMessage.t(), keyword() ) :: {:ok, [Normandy.Coordination.AgentMessage.t()]}
Runs agent specs with message-based communication. Each agent receives the previous
AgentMessage's payload and answers with a reply, or an error message whose payload
:error is the exception's message. Takes no options.
Example
{:ok, messages} = SequentialOrchestrator.execute_with_messages(specs, initial_message)