From adk-agent-builder
Use this skill to subclass google.adk.agents.BaseAgent and implement a custom agent with full control over the run loop, event emission, and state transitions. Triggers on: "custom ADK agent", "subclass BaseAgent", "extend ADK with my own agent class", "non-LLM agent in ADK", "deterministic agent with custom logic", "ADK agent without an LLM call". Generates a class that overrides _run_async_impl and yields Events, ready to drop into a workflow or coordinator hierarchy.
How this skill is triggered — by the user, by Claude, or both
Slash command
/adk-agent-builder:custom-agent-scaffoldThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Build a custom ADK 2.0 agent by subclassing `BaseAgent`. Use when an `LlmAgent`
Build a custom ADK 2.0 agent by subclassing BaseAgent. Use when an LlmAgent
is overkill (deterministic transformations, API calls, data validation) or when
you need full control over the event stream.
from typing import AsyncIterator
from google.adk.agents import BaseAgent
from google.adk.events import Event
from google.adk.agents.invocation_context import InvocationContext
class CsvExportAgent(BaseAgent):
"""Reads state['rows'], writes CSV to state['csv_path'], emits one Event."""
name: str = "csv_exporter"
async def _run_async_impl(
self, ctx: InvocationContext
) -> AsyncIterator[Event]:
rows = ctx.session.state.get("rows", [])
if not rows:
yield Event(
author=self.name,
content="No rows to export.",
)
return
import csv
from pathlib import Path
out = Path("/tmp") / f"{ctx.session.id}.csv"
with out.open("w", newline="") as f:
writer = csv.DictWriter(f, fieldnames=rows[0].keys())
writer.writeheader()
writer.writerows(rows)
ctx.session.state["csv_path"] = str(out)
yield Event(
author=self.name,
content=f"Exported {len(rows)} rows to {out}",
)
from google.adk.agents import LlmAgent, SequentialAgent
extractor = LlmAgent(
name="extractor",
model="gemini-2.5-flash",
instruction="Extract rows from the user input into state['rows'].",
output_key="rows",
)
root_agent = SequentialAgent(
name="extract_then_export",
sub_agents=[extractor, CsvExportAgent()],
)
name (str class attr or constructor)_run_async_impl must be async def and return AsyncIterator[Event]Event so the run UI shows the stepctx.session.state for downstream agents to consumenpx claudepluginhub healthcare-ai-consulting-llc/adk-2-toolkit --plugin adk-agent-builderGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.