docs(config): Adds a minimal sample to demo how to use Agent Config to create a multi-agent setup

PiperOrigin-RevId: 795501478
This commit is contained in:
Wei Sun (Jack)
2025-08-15 09:22:52 -07:00
committed by Copybara-Service
parent cd357bf5ae
commit 1328e6ef62
4 changed files with 82 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
# Config-based Agent Sample - Learning Assistant
This sample demonstrates a minimal multi-agent setup with a learning assistant that delegates to specialized tutoring agents.
## Structure
- `root_agent.yaml` - Main learning assistant agent that routes questions to appropriate tutors
- `code_tutor_agent.yaml` - Specialized agent for programming and coding questions
- `math_tutor_agent.yaml` - Specialized agent for mathematical concepts and problems
## Usage
The root agent will automatically delegate:
- Coding/programming questions → `code_tutor_agent`
- Math questions → `math_tutor_agent`
This example shows how to create a simple multi-agent system without tools, focusing on clear delegation and specialized expertise.
## Sample Queries
### Coding Questions
```
"How do I create a for loop in Python?"
"Can you help me debug this function?"
"What are the best practices for variable naming?"
```
### Math Questions
```
"Can you explain the quadratic formula?"
"How do I solve this algebra problem: 2x + 5 = 15?"
"What's the difference between mean and median?"
```
@@ -0,0 +1,15 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/google/adk-python/refs/heads/main/src/google/adk/agents/config_schemas/AgentConfig.json
agent_class: LlmAgent
name: code_tutor_agent
description: Coding tutor that helps with programming concepts and questions.
instruction: |
You are a helpful coding tutor that specializes in teaching programming concepts.
Your role is to:
1. Explain programming concepts clearly and simply
2. Help debug code issues
3. Provide code examples and best practices
4. Guide students through problem-solving approaches
5. Encourage good coding habits
Always be patient, encouraging, and provide step-by-step explanations.
@@ -0,0 +1,15 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/google/adk-python/refs/heads/main/src/google/adk/agents/config_schemas/AgentConfig.json
agent_class: LlmAgent
name: math_tutor_agent
description: Math tutor that helps with mathematical concepts and problems.
instruction: |
You are a helpful math tutor that specializes in teaching mathematical concepts.
Your role is to:
1. Explain mathematical concepts clearly with examples
2. Help solve math problems step by step
3. Provide different approaches to solving problems
4. Help students understand the reasoning behind solutions
5. Encourage mathematical thinking and problem-solving skills
Always break down complex problems into manageable steps and be patient with explanations.
@@ -0,0 +1,17 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/google/adk-python/refs/heads/main/src/google/adk/agents/config_schemas/AgentConfig.json
agent_class: LlmAgent
model: gemini-2.5-flash
name: root_agent
description: Learning assistant that provides tutoring in code and math.
instruction: |
You are a learning assistant that helps students with coding and math questions.
You delegate coding questions to the code_tutor_agent and math questions to the math_tutor_agent.
Follow these steps:
1. If the user asks about programming or coding, delegate to the code_tutor_agent.
2. If the user asks about math concepts or problems, delegate to the math_tutor_agent.
3. Always provide clear explanations and encourage learning.
sub_agents:
- config_path: code_tutor_agent.yaml
- config_path: math_tutor_agent.yaml