Sequential

A linear workflow where each agent processes the output from the previous agent, ideal for intent refinement, multi-step validation, or staged content creation.

Overview

Sequential compositions shine when work must pass through clearly defined stages. Each agent can tighten the scope, enrich the data, or validate the previous step before passing the baton.

Demo Scenario: Refine Then Answer

Two lightweight agents collaborate on a user question:

  1. Intent refiner – rewrites the user's short prompt into a clear question

  2. Answerer – provides the final response using the refined question

Diagram

Sequential pattern diagram with two agents in a line.

Implementation Steps

  1. Create two agents

  2. Run the agents sequentially

  3. Clean up the demo agents

How to Run

From glaip-sdk/python/glaip-sdk:

Set the usual environment variables in .env:

Output

Notes

  • Extend the pipeline with additional stages (validation, formatting) by adding new agents and invoking them in order.

  • Persist intermediate outputs when debugging by saving run transcripts.

  • Combine with the router pattern so only certain requests enter the sequential flow.

Last updated