ADK Sequential Agent
A SequentialAgent executes its sub-agents in the order specified in the list.
- Sub-agents share state. They don’t directly pass information to one another — they communicate through
output_keywrites that the next agent reads as{key}in its instructions. - A sequential workflow acts like a wrapper around its sub-agents.
from google.adk.agents import SequentialAgent
from .subagents.recommender import action_recommender_agent
from .subagents.scorer import lead_scorer_agent
from .subagents.validator import lead_validator_agent
# Create the sequential agent with minimal callback
root_agent = SequentialAgent(
name="LeadQualificationPipeline",
sub_agents=[lead_validator_agent, lead_scorer_agent, action_recommender_agent],
description="A pipeline that validates, scores, and recommends actions for sales leads",
)First agent — lead_validator_agent
"""
Lead Validator Agent
This agent is responsible for validating if a lead has all the necessary information
for qualification.
"""
from google.adk.agents import LlmAgent
# --- Constants ---
GEMINI_MODEL = "gemini-2.0-flash"
# Create the validator agent
lead_validator_agent = LlmAgent(
name="LeadValidatorAgent",
model=GEMINI_MODEL,
instruction="""You are a Lead Validation AI.
Examine the lead information provided by the user and determine if it's complete enough for qualification.
A complete lead should include:
- Contact information (name, email or phone)
- Some indication of interest or need
- Company or context information if applicable
Output ONLY 'valid' or 'invalid' with a single reason if invalid.
Example valid output: 'valid'
Example invalid output: 'invalid: missing contact information'
""",
description="Validates lead information for completeness.",
output_key="validation_status",
)
# save it to output keySecond agent — lead_scorer_agent
"""
Lead Scorer Agent
This agent is responsible for scoring a lead's qualification level
based on various criteria.
"""
from google.adk.agents import LlmAgent
GEMINI_MODEL = "gemini-2.0-flash"
lead_scorer_agent = LlmAgent(
name="LeadScorerAgent",
model=GEMINI_MODEL,
instruction="""You are a Lead Scoring AI.
Analyze the lead information and assign a qualification score from 1-10 based on:
- Expressed need (urgency/clarity of problem)
- Decision-making authority
- Budget indicators
- Timeline indicators
Output ONLY a numeric score and ONE sentence justification.
Example output: '8: Decision maker with clear budget and immediate need'
Example output: '3: Vague interest with no timeline or budget mentioned'
""",
description="Scores qualified leads on a scale of 1-10.",
output_key="lead_score",
)Third agent — action_recommender_agent
"""
Action Recommender Agent
This agent is responsible for recommending appropriate next actions
based on the lead validation and scoring results.
"""
from google.adk.agents import LlmAgent
GEMINI_MODEL = "gemini-2.0-flash"
action_recommender_agent = LlmAgent(
name="ActionRecommenderAgent",
model=GEMINI_MODEL,
instruction="""You are an Action Recommendation AI.
Based on the lead information and scoring:
- For invalid leads: Suggest what additional information is needed
- For leads scored 1-3: Suggest nurturing actions (educational content, etc.)
- For leads scored 4-7: Suggest qualifying actions (discovery call, needs assessment)
- For leads scored 8-10: Suggest sales actions (demo, proposal, etc.)
Format your response as a complete recommendation to the sales team.
Lead Score:
{lead_score} # the output key from earlier
Lead Validation Status:
{validation_status} # the output key from earlier
""",
description="Recommends next actions based on lead qualification.",
output_key="action_recommendation",
)Key idea
The “magic” is the output_key → {key} interpolation pattern. Each agent writes to a known slot in state, the next one reads from it. No direct message-passing needed.
See next
- ADK-Parallel-Agents — run sub-agents concurrently instead of sequentially
- ADK-Loop-Agents — sequential with iteration + exit condition
- ADK-Structured-Output — fundamentals of
output_key