Files
google--adk-python/contributing/workflow_samples/sequence
Wei (Jack) Sun 1c64a41b53 feat: ADK 2.0 alpha
Introduces two major capabilities:
- Workflow runtime: graph-based execution engine for composing
  deterministic execution flows for agentic apps, with support for
  routing, fan-out/fan-in, loops, retry, state management, dynamic
  nodes, human-in-the-loop, and nested workflows
- Task API: structured agent-to-agent delegation with multi-turn
  task mode, single-turn controlled output, mixed delegation
  patterns, human-in-the-loop, and task agents as workflow nodes

Co-Authored-By: Bo Yang <ybo@google.com>
Co-Authored-By: George Weale <gweale@google.com>
Co-Authored-By: Sean Zhou <seanzhougoogle@google.com>
Co-Authored-By: Shangjie Chen <deanchen@google.com>
Co-Authored-By: Swapnil Agarwal <swapnilag@google.com>
Co-Authored-By: Wei Sun <weisun@google.com>
Co-Authored-By: Xuan Yang <xygoogle@google.com>
Co-Authored-By: Yifan Wang <wanyif@google.com>
Change-Id: I35932c50cfe29ff68559e3781713dbb5eb7b3382
2026-03-17 23:24:58 -07:00
..
2026-03-17 23:24:58 -07:00
2026-03-17 23:24:58 -07:00
2026-03-17 23:24:58 -07:00

ADK Workflow Sequence Sample

Overview

This sample demonstrates how to create a simple sequential workflow with ADK Workflows.

It connects two LLM agents in a chain. The first agent (generate_fruit_agent) is instructed to return the name of a random fruit. The output of this agent becomes the input for the second agent (generate_benefit_agent), which then tells a health benefit about that specific fruit.

In a sequence, the execution flows unconditionally from one node to the next in the order they are defined.

Sample Inputs

This sample does not require any input to run.

Graph

       [ START ]
           |
           v
[generate_fruit_agent]
           |
           v
[generate_benefit_agent]

How To

  1. Define the agents or functions that will make up the steps in your sequence.

    generate_fruit_agent = Agent(...)
    generate_benefit_agent = Agent(...)
    
  2. Pass a tuple of three or more elements to edges to define an unconditional sequence starting from the first element and passing through each subsequent node in order.

    Workflow(
        name="root_agent",
        edges=[("START", generate_fruit_agent, generate_benefit_agent)],
    )