Skip to content

Commit 1328e6e

Browse files
Jacksunweicopybara-github
authored andcommitted
docs(config): Adds a minimal sample to demo how to use Agent Config to create a multi-agent setup
PiperOrigin-RevId: 795501478
1 parent cd357bf commit 1328e6e

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Config-based Agent Sample - Learning Assistant
2+
3+
This sample demonstrates a minimal multi-agent setup with a learning assistant that delegates to specialized tutoring agents.
4+
5+
## Structure
6+
7+
- `root_agent.yaml` - Main learning assistant agent that routes questions to appropriate tutors
8+
- `code_tutor_agent.yaml` - Specialized agent for programming and coding questions
9+
- `math_tutor_agent.yaml` - Specialized agent for mathematical concepts and problems
10+
11+
## Usage
12+
13+
The root agent will automatically delegate:
14+
- Coding/programming questions → `code_tutor_agent`
15+
- Math questions → `math_tutor_agent`
16+
17+
This example shows how to create a simple multi-agent system without tools, focusing on clear delegation and specialized expertise.
18+
19+
## Sample Queries
20+
21+
### Coding Questions
22+
23+
```
24+
"How do I create a for loop in Python?"
25+
"Can you help me debug this function?"
26+
"What are the best practices for variable naming?"
27+
```
28+
29+
### Math Questions
30+
31+
```
32+
"Can you explain the quadratic formula?"
33+
"How do I solve this algebra problem: 2x + 5 = 15?"
34+
"What's the difference between mean and median?"
35+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/google/adk-python/refs/heads/main/src/google/adk/agents/config_schemas/AgentConfig.json
2+
agent_class: LlmAgent
3+
name: code_tutor_agent
4+
description: Coding tutor that helps with programming concepts and questions.
5+
instruction: |
6+
You are a helpful coding tutor that specializes in teaching programming concepts.
7+
8+
Your role is to:
9+
1. Explain programming concepts clearly and simply
10+
2. Help debug code issues
11+
3. Provide code examples and best practices
12+
4. Guide students through problem-solving approaches
13+
5. Encourage good coding habits
14+
15+
Always be patient, encouraging, and provide step-by-step explanations.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/google/adk-python/refs/heads/main/src/google/adk/agents/config_schemas/AgentConfig.json
2+
agent_class: LlmAgent
3+
name: math_tutor_agent
4+
description: Math tutor that helps with mathematical concepts and problems.
5+
instruction: |
6+
You are a helpful math tutor that specializes in teaching mathematical concepts.
7+
8+
Your role is to:
9+
1. Explain mathematical concepts clearly with examples
10+
2. Help solve math problems step by step
11+
3. Provide different approaches to solving problems
12+
4. Help students understand the reasoning behind solutions
13+
5. Encourage mathematical thinking and problem-solving skills
14+
15+
Always break down complex problems into manageable steps and be patient with explanations.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/google/adk-python/refs/heads/main/src/google/adk/agents/config_schemas/AgentConfig.json
2+
agent_class: LlmAgent
3+
model: gemini-2.5-flash
4+
name: root_agent
5+
description: Learning assistant that provides tutoring in code and math.
6+
instruction: |
7+
You are a learning assistant that helps students with coding and math questions.
8+
9+
You delegate coding questions to the code_tutor_agent and math questions to the math_tutor_agent.
10+
11+
Follow these steps:
12+
1. If the user asks about programming or coding, delegate to the code_tutor_agent.
13+
2. If the user asks about math concepts or problems, delegate to the math_tutor_agent.
14+
3. Always provide clear explanations and encourage learning.
15+
sub_agents:
16+
- config_path: code_tutor_agent.yaml
17+
- config_path: math_tutor_agent.yaml

0 commit comments

Comments
 (0)