agent-orchestration
Multi-agent orchestration patterns including coordinator agents, LlmAgent vs WorkflowAgent selection, agent-as-tool pattern, and inter-agent communication via session state. PROACTIVELY activate for: (1) multi-agent systems and agent coordination, (2) sub-agent delegation and agent-as-tool implementation, (3) workflow orchestration with LlmAgent and WorkflowAgent. Triggers: "multi-agent", "orchestration", "agent team"
What this skill does
# Agent Orchestration: Multi-Agent System Patterns
## Core Principles
Complex problems often require multiple specialized agents working together. ADK provides robust patterns for orchestrating agent teams, enabling modular, maintainable, and scalable agentic systems.
**Key Insight**: Single monolithic agents with overly complex prompts are harder to maintain and debug than teams of focused specialists coordinated by a simple orchestrator.
## Agent Types: LlmAgent vs WorkflowAgent
### LlmAgent (Dynamic Reasoning)
**Purpose**: For tasks where the next action depends on runtime reasoning and context.
**Characteristics**:
- LLM decides which tool to call and when
- Flexible, adaptive behavior
- Suitable for open-ended problems
- Can handle unexpected inputs
**Use Cases**:
- Conversational assistants
- Complex problem-solving requiring judgment
- Tasks with unpredictable user requests
- Research and analysis workflows
**Example**:
```python
from google import genai
from google.genai import types
async def create_research_agent() -> types.Agent:
"""
Create LlmAgent for research tasks.
The agent dynamically decides whether to search, read, or summarize
based on user questions and intermediate findings.
"""
client = genai.Client(vertexai=True)
# Define tools
search_tool = types.Tool(function_declarations=[...])
read_tool = types.Tool(function_declarations=[...])
summarize_tool = types.Tool(function_declarations=[...])
# LlmAgent with dynamic tool selection
agent = types.LlmAgent(
model="gemini-2.0-flash-exp",
system_instruction="""
You are a research assistant. For each user query:
1. Use search_tool to find relevant sources
2. Use read_tool to examine source content
3. Use summarize_tool to synthesize findings
Adapt your approach based on the query complexity.
""",
tools=[search_tool, read_tool, summarize_tool]
)
return agent
```
### WorkflowAgent (Deterministic Flow)
**Purpose**: For tasks with predictable, repeatable processes where the execution flow is known in advance.
**Characteristics**:
- Hardcoded execution sequence
- Predictable, reliable behavior
- No LLM reasoning overhead for flow control
- Ideal for automation pipelines
**Types**:
- **SequentialAgent**: Execute agents one after another
- **ParallelAgent**: Execute agents concurrently
- **LoopAgent**: Repeat agent execution with conditions
**Use Cases**:
- Data processing pipelines
- Validation workflows
- Multi-stage transformations
- Scheduled automation tasks
**Example - SequentialAgent**:
```python
from google.genai import types
async def create_document_processor() -> types.SequentialAgent:
"""
Sequential workflow for document processing.
Flow: Upload -> Parse -> Validate -> Store (deterministic sequence)
"""
# Define sub-agents for each stage
upload_agent = types.LlmAgent(
model="gemini-2.0-flash-exp",
system_instruction="Validate and upload documents to storage.",
tools=[upload_tool]
)
parse_agent = types.LlmAgent(
model="gemini-2.0-flash-exp",
system_instruction="Extract structured data from documents.",
tools=[parse_tool]
)
validate_agent = types.LlmAgent(
model="gemini-2.0-flash-exp",
system_instruction="Validate extracted data against schema.",
tools=[validate_tool]
)
store_agent = types.LlmAgent(
model="gemini-2.0-flash-exp",
system_instruction="Store validated data in database.",
tools=[store_tool]
)
# Sequential workflow
workflow = types.SequentialAgent(
agents=[upload_agent, parse_agent, validate_agent, store_agent]
)
return workflow
```
**Example - ParallelAgent**:
```python
async def create_parallel_analyzer() -> types.ParallelAgent:
"""
Parallel analysis workflow.
Run sentiment analysis, entity extraction, and summarization
simultaneously for speed.
"""
sentiment_agent = types.LlmAgent(
model="gemini-2.0-flash-exp",
system_instruction="Analyze sentiment of the text.",
tools=[sentiment_tool]
)
entity_agent = types.LlmAgent(
model="gemini-2.0-flash-exp",
system_instruction="Extract named entities from text.",
tools=[entity_tool]
)
summary_agent = types.LlmAgent(
model="gemini-2.0-flash-exp",
system_instruction="Generate concise summary of text.",
tools=[summary_tool]
)
# Parallel execution (faster)
parallel_workflow = types.ParallelAgent(
agents=[sentiment_agent, entity_agent, summary_agent]
)
return parallel_workflow
```
### Decision Matrix: Which Agent Type?
| Scenario | Agent Type | Rationale |
|----------|------------|-----------|
| Answering unpredictable user questions | LlmAgent | Requires dynamic reasoning |
| Processing uploaded files through fixed steps | SequentialAgent | Deterministic pipeline |
| Running multiple independent analyses | ParallelAgent | No dependencies, gain speed |
| Customer support with varying needs | LlmAgent | Adaptive to user situation |
| Daily report generation | LoopAgent | Repeatable schedule |
| Code review (lint -> test -> analyze) | SequentialAgent | Fixed validation sequence |
## Coordinator Pattern (Recommended Architecture)
### Root Coordinator with Specialist Sub-Agents
**Architecture**: Single coordinator agent dispatches tasks to specialized agents based on request type.
**Benefits**:
- Clear separation of concerns
- Easy to add new specialists
- Simple routing logic
- Improved debuggability
**Implementation**:
```python
from google import genai
from google.genai import types
from pydantic import BaseModel, ConfigDict, Field
# Specialist agents
async def create_code_specialist() -> types.LlmAgent:
"""Agent specialized in code generation and review."""
return types.LlmAgent(
model="gemini-2.0-flash-exp",
system_instruction="""
You are a senior software engineer specializing in Python.
Your responsibilities:
- Generate production-ready code with type hints
- Review code for bugs and improvements
- Suggest optimal algorithms and data structures
Always follow PEP 8 and include comprehensive docstrings.
""",
tools=[code_analyzer_tool, code_formatter_tool]
)
async def create_architecture_specialist() -> types.LlmAgent:
"""Agent specialized in system architecture."""
return types.LlmAgent(
model="gemini-2.0-flash-exp",
system_instruction="""
You are a principal architect with 15+ years experience.
Your responsibilities:
- Design scalable system architectures
- Evaluate trade-offs between approaches
- Create architecture decision records (ADRs)
Focus on maintainability, scalability, and security.
""",
tools=[diagram_tool, adr_tool]
)
async def create_test_specialist() -> types.LlmAgent:
"""Agent specialized in testing."""
return types.LlmAgent(
model="gemini-2.0-flash-exp",
system_instruction="""
You are a test automation engineer.
Your responsibilities:
- Generate comprehensive test suites
- Design test strategies (unit, integration, e2e)
- Achieve 80%+ code coverage
Use pytest patterns and AAA structure.
""",
tools=[test_generator_tool, coverage_tool]
)
# Coordinator agent
async def create_coordinator() -> types.LlmAgent:
"""
Root coordinator that delegates to specialists.
Analyzes user requests and routes to appropriate specialist.
"""
# Create specialist agents
code_agent = await create_code_specialist()
arch_agent = await create_architecture_specialist()
test_agent = await create_test_specialist()
# Wrap specialists as tools (agent-as-tool pRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.