.agents/skills/adk-sample-creator/SKILL.md
This skill helps you create new samples for the ADK Python repository. You should search for subdirectories under contributing (such as new_workflow_samples, workflow_samples, etc.) and confirm with the user which folder they want to use before creating the sample.
[!TIP]
Before creating samples, you can use the
adk-styleskill to learn about ADK 2.0 architecture knowledge and best practices.
A sample consists of:
agent.py file defining the agent or workflow logic.README.md file explaining the sample.Use snake_case for the folder name (e.g., dynamic_nodes, fan_out_fan_in).
agent.py ContentThe agent.py should focus on demonstrating a specific feature or agent pattern. Use absolute imports for testing convenience.
Choose one of the following patterns:
Use this when you need multiple nodes, routing, or parallel execution.
Imports:
from google.adk import Agent
from google.adk import Context
from google.adk.workflow import node
from google.adk.workflow import JoinNode
from google.adk.workflow._workflow_class import Workflow
Anatomy:
my_agent = Agent(name="my_agent", ...)
@node()
async def my_node(node_input: str):
return "result"
root_agent = Workflow(
name="root_wf",
edges=[("START", my_node)],
)
Use this when you don't need a graph and the agent handles the loop.
Imports:
from google.adk import Agent
from google.adk.tools import google_search # example
Anatomy:
root_agent = Agent(
name="standalone_assistant",
model="gemini-2.5-flash",
instruction="You are a helpful assistant.",
description="An assistant that can help with queries.",
tools=[google_search],
)
README.md ContentEach sample should have a README.md with the following structure:
Overview: What the sample does.
Sample Inputs: Examples of inputs to test with.
Graph: Visualization of the graph flow (Mermaid recommended for workflows).
How To: Explanation of key techniques used (e.g., ctx.run_node).
# ADK Sample Name
## Overview
Brief description.
## Sample Inputs
- input_1
- input_2
## Graph
```mermaid
graph TD
START --> MyNode
```
Explain the details.
## Examples
### Dynamic Nodes
Snippet from `dynamic_nodes/agent.py`:
```python
@node(rerun_on_resume=True)
async def orchestrate(ctx: Context, node_input: str) -> str:
while True:
headline = await ctx.run_node(generate_headline)
# ...
Snippet from fan_out_fan_in/agent.py:
root_agent = Workflow(
name="root_agent",
edges=[("START", (node_a, node_b), join_node, aggregate)],
)