Explain all the agent types in Google ADK (LlmAgent, SequentialAgent, ParallelAgent, LoopAgent, CustomAgent) with flow diagrams.

#google-adk#agents#sequential#parallel#loop#custom#workflow

Answer

Agent Types in Google ADK

Agent Types
Agent Types

Google ADK provides 5 agent types organized into 3 categories: LLM Agents, Workflow Agents, and Custom Agents.


Agent Type Hierarchy


1. LLM Agent (
text
LlmAgent
/
text
Agent
)

The primary agent type - powered by an LLM for reasoning, tool use, and delegation.

python
from google.adk.agents import Agent

research_agent = Agent(
    name="research_agent",
    model="gemini-2.5-flash",
    instruction="You are a research assistant. Use tools to find information.",
    description="Researches topics and provides detailed answers",
    tools=[google_search, summarize_doc],
    output_key="research_result",
    sub_agents=[writer_agent],
)
ParameterTypeDescription
text
name
text
str
Unique agent identifier
text
model
text
str
/ Model
LLM to use
text
instruction
text
str
System prompt (supports
text
{variable}
from state)
text
description
text
str
Used by parent agents for delegation
text
tools
text
list
Tools available to this agent
text
output_key
text
str
Save output to session state
text
sub_agents
text
list
Child agents for delegation
text
planner
text
Planner
Planning strategy

2. Sequential Agent

Sequential Agent
Sequential Agent

Executes sub-agents one after another in order. No LLM for flow control.

python
from google.adk.agents import SequentialAgent

rag_pipeline = SequentialAgent(
    name="rag_pipeline",
    sub_agents=[
        loader_agent,      # Step 1: Load documents
        chunker_agent,     # Step 2: Chunk text
        embedder_agent,    # Step 3: Embed
        indexer_agent,     # Step 4: Store in vector DB
    ]
)

Use case: ETL pipelines, RAG ingestion, step-by-step workflows.


3. Parallel Agent

Parallel Agent
Parallel Agent

Executes sub-agents concurrently. Each child gets a distinct branch context.

python
from google.adk.agents import ParallelAgent

multi_search = ParallelAgent(
    name="multi_source_search",
    sub_agents=[
        web_search_agent,
        arxiv_search_agent,
        internal_docs_agent,
    ]
)

Important: Use distinct state keys per agent to avoid race conditions.

Use case: Multi-source search, parallel API calls, fan-out.


4. Loop Agent

Loop Agent
Loop Agent

Executes sub-agents sequentially in a loop until

text
max_iterations
or
text
escalate=True
.

python
from google.adk.agents import LoopAgent

refiner = LoopAgent(
    name="draft_refiner",
    max_iterations=5,
    sub_agents=[
        writer_agent,       # Write a draft
        reviewer_agent,     # Review and provide feedback
    ]
)

Use case: Iterative refinement, polling, self-correcting agents.


5. Custom Agent

Custom Agent Flow
Custom Agent Flow

Extend

text
BaseAgent
for completely custom orchestration logic.

python
from google.adk.agents import BaseAgent
from google.adk.agents.invocation_context import InvocationContext

class ConditionalAgent(BaseAgent):
    def __init__(self, name, tech_agent, general_agent, **kwargs):
        super().__init__(
            name=name,
            sub_agents=[tech_agent, general_agent],
            **kwargs
        )
        self.tech_agent = tech_agent
        self.general_agent = general_agent

    async def _run_async_impl(self, ctx: InvocationContext):
        query = ctx.session.state.get("user_query", "")

        if any(kw in query.lower() for kw in ["code", "api", "bug"]):
            target = self.tech_agent
        else:
            target = self.general_agent

        async for event in target.run_async(ctx):
            yield event

Choosing the Right Agent Type

Summary

Agent TypeFlow ControlLLM Used?Best For
LlmAgentDynamic, LLM-drivenYesReasoning, tool use, delegation
SequentialAgentFixed orderNoPipelines, ETL
ParallelAgentConcurrentNoFan-out, multi-search
LoopAgentRepeatNoIterative refinement
Custom AgentYour logicOptionalConditional routing, complex flows

Learn more at Agent Types and Workflow Agents.