custom-agents

Documentation for creating custom agents in Google’s Agent Development Kit, a toolkit for building software agents. It explains how to define your own control flow and notes that newer graph-based workflows may be preferable.

In plain words
What is it for?
Use it when implementing an agent with bespoke sequential, looping, parallel, or other execution logic across the supported programming languages.
Why use it?
It clarifies how custom orchestration works and highlights the extra complexity and newer alternatives before you build one.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/google/adk-docs/custom-agents
Clone the repo
git clone --depth 1 https://github.com/google/adk-docs
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 12,594 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.12594
Opus 5 $0.00000 $0.06297
Sonnet 5 $0.00000 $0.02519
Haiku 4.5 $0.00000 $0.01259

Measured yesterday against content hash c1f6ca880f22, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

custom-agents scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/agents/custom-agents.md · 1,247 lines

How it starts

The opening of the file, as written. The whole thing — 1,247 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Custom agent template workflows

Custom agents and agent-based workflows allow you to define arbitrary orchestration logic by inheriting directly from BaseAgent and implementing your own control flow. This approach allows you to create new execution patterns similar to SequentialAgent, LoopAgent, and ParallelAgent, enabling you to build highly specific and complex agentic workflows.

!!! warning "Alternative: graph-based workflows"

Starting in ADK 2.0, agent-based workflows using
`BaseAgent` have been superseded

by more flexible workflow structures, including
[graph-based workflows](/workflows/graphs/) and
[dynamic workflows](/workflows/dynamic/). You should
evaluate the capabilities of these workflow mechanisms
***before*** building a custom agent for your
target workflow.

!!! warning "Advanced Concept"

Building custom agents by directly implementing `_run_async_impl`, or its
equivalent in other languages, provides powerful control but is more complex
than using the predefined `LlmAgent` or `WorkflowAgent` types. We
recommend understanding those foundational agent types first before tackling
custom orchestration logic.

Overview

A Custom Agent is essentially any class you create that inherits from google.adk.agents.BaseAgent and implements its core execution logic within the _run_async_impl asynchronous method. You have complete control over how this method calls other sub-agents, manages state, and handles events.

intro_components.png

!!! Note

The specific method name for implementing an agent's core asynchronous logic may
vary slightly by SDK language, such as `runAsyncImpl` in Java, `_run_async_impl`
in Python, or `runAsyncImpl` in TypeScript. Refer to the language-specific API
documentation for details.

Read the full file on GitHub · 1,247 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 1,247 lines · 0 tokens per session scan A c1f6ca880f22

Subscribe to this mod's changes

custom-agents is an agent published in the GitHub repository google/adk-docs (1,479 stars, last pushed 3d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 12,594 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.