From adk-multi-agent
Use this skill to build ADK 2.0 dynamic workflows — code-defined logic for iterative loops, conditional branching, and runtime-determined agent composition. New in ADK 2.0. Triggers on: "ADK dynamic workflow", "ADK code-driven agent flow", "iterative agent loop with custom logic", "branching ADK workflow", "dynamic agent composition", "runtime agent graph", "ADK 2.0 imperative workflow". Generates a Python orchestration function that decides next steps based on session state.
How this skill is triggered — by the user, by Claude, or both
Slash command
/adk-multi-agent:dynamic-workflow-builderThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Code-defined workflow orchestration introduced in ADK 2.0. The graph topology itself is computed at runtime by your Python code — not declared up-front like `GraphAgent`.
Code-defined workflow orchestration introduced in ADK 2.0. The graph topology itself is computed at runtime by your Python code — not declared up-front like GraphAgent.
graph-workflow-designerSequentialAgentLoopAgentfrom google.adk.agents import BaseAgent, LlmAgent
from google.adk.agents.invocation_context import InvocationContext
from google.adk.events import Event
from typing import AsyncIterator
class DynamicResearchAgent(BaseAgent):
"""Iteratively expands research until coverage threshold is met."""
name: str = "dynamic_researcher"
def __init__(self):
super().__init__()
self.searcher = LlmAgent(
name="searcher",
model="gemini-2.5-flash",
instruction="Search for one specific subtopic and write findings.",
)
self.evaluator = LlmAgent(
name="evaluator",
model="gemini-2.5-flash",
instruction=(
"Score coverage 0-10. If <8, write missing subtopic to "
"state['next_query']. If >=8, set state['done']=True."
),
)
async def _run_async_impl(
self, ctx: InvocationContext
) -> AsyncIterator[Event]:
attempts = 0
max_attempts = 6
while attempts < max_attempts:
attempts += 1
async for ev in self.searcher.run_async(ctx):
yield ev
async for ev in self.evaluator.run_async(ctx):
yield ev
if ctx.session.state.get("done"):
yield Event(author=self.name, content=f"Converged after {attempts} rounds.")
return
yield Event(author=self.name, content=f"Stopped at max_attempts={max_attempts}.")
root_agent = DynamicResearchAgent()
async def _run_async_impl(self, ctx):
# Custom Python: hit your own DB
rows = await my_db.query(ctx.session.state["search_term"])
ctx.session.state["rows"] = rows
# Then run an ADK agent
async for ev in self.summarizer.run_async(ctx):
yield ev
max_attempts) — protect against runaway loopsctx.session.state for cross-step communicationInvocationContextGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub healthcare-ai-consulting-llc/adk-2-toolkit --plugin adk-multi-agent