Skip to main content

Sequential Agent

A composite agent that runs multiple sub-agents in a defined sequence, where each agent's output is made available to the next agent through session state.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.

Inputs

  • Session ID (optional) - (string) A unique identifier for this specific conversation thread, essential for retrieving it later.
  • Name - (string) Name of the agent.
  • Description - (string) Description of the sequential agent's purpose and workflow.
  • Query - (string) User query to the agent, which will be processed by the first agent in the sequence.

Options

  • Sub-Agents Order - (array) Defines the execution order of connected sub-agents. Each entry specifies a Sub-Agent Name.
  • Timeout (seconds) - (number) Maximum wait time in seconds for agent operations to finish. Default: 300.

Outputs

  • Response - (string) Final response from the last agent in the sequence.

Ports

  • sub-agents - (output) Connect to agents (LLM Agent, Sequential Agent, Parallel Agent, Loop Agent) that will execute in sequence.
  • callbacks - (output) Connect to Callback In nodes to monitor sequential agent execution.

How It Works

The Sequential Agent node orchestrates a pipeline of agents:

  1. Initialization - Creates a sequential agent with the specified name and description
  2. Sub-Agent Connection - Connects to all agents on the sub-agents port
  3. Ordering - Orders the sub-agents according to the Sub-Agents Order configuration
  4. Sequential Execution - Executes each agent in order:
    • The first agent processes the initial query
    • Each subsequent agent has access to the previous agents' outputs via session state
    • Results accumulate in the session state as the pipeline progresses
  5. Response - Returns the final response from the last agent in the sequence

Common Use Cases

  • Multi-Stage Processing - Break complex tasks into specialized steps (e.g., research, analysis, summary)
  • Validation Workflows - Chain agents for data extraction, validation, and formatting
  • Progressive Refinement - Use multiple agents to iteratively improve results
  • Specialized Pipelines - Create workflows where each agent has a specific expertise or role
  • Handoff Patterns - Implement agent handoffs where one agent prepares data for the next

Error Handling

The node will return errors in the following cases:

  • Initialization timeout (30 seconds) - "Agent initialization timed out, cannot process message"
  • Invalid sub-agent order - "Order name not found in agent names"
  • Sub-agent execution failure - Error from the failing agent is propagated
  • Timeout during execution - Operation is terminated after the specified timeout

When Continue On Error is enabled, the workflow will continue even if a sub-agent fails, allowing subsequent nodes to execute.

Usage Notes

  • Ordering is Required - All connected sub-agents must be specified in the Sub-Agents Order configuration
  • State Sharing - Sub-agents share state through the session, enabling data flow between agents
  • Callbacks - Before and after callbacks can be connected to monitor the sequential agent's execution
  • Nested Agents - Sequential agents can contain other sequential, parallel, or loop agents for complex workflows
  • Session Management - Provide a Session ID to maintain conversation context across multiple executions
  • Performance - Execution time is the sum of all sub-agents' execution times
  • Output Access - Each agent can access previous agents' outputs via session state keys

Example Workflow

A typical sequential agent workflow might look like:

  1. Research Agent - Searches for relevant information
  2. Analysis Agent - Analyzes the gathered data
  3. Summary Agent - Creates a concise summary

Each agent builds upon the work of the previous agent, with results flowing through the session state.