mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
Merge https://github.com/google/adk-python/pull/3394 This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling) Note: while I use tooling to identify errors, the tooling doesn't _actually_ provide the corrections, I'm picking them on my own. I'm a human, and I may make mistakes. ### Testing Plan The misspellings have been reported at https://github.com/jsoref/adk-python/actions/runs/19056081305/attempts/1#summary-54426435973 The action reports that the changes in this PR would make it happy: https://github.com/jsoref/adk-python/actions/runs/19056081446/attempts/1#summary-54426436321 **Unit Tests:** - [ ] I have added or updated unit tests for my change. - [ ] All unit tests pass locally. _Please include a summary of passed `pytest` results._ **Manual End-to-End (E2E) Tests:** _Please provide instructions on how to manually test your changes, including any necessary setup or configuration. Please provide logs or screenshots to help reviewers better understand the fix._ ### Checklist - [x] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document. - [x] I have performed a self-review of my own code. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] New and existing unit tests pass locally with my changes. - [ ] I have manually tested my changes end-to-end. - [ ] Any dependent changes have been merged and published in downstream modules. ### Additional context - https://github.com/google/adk-python/pull/3382#issuecomment-3488654110 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3394 from jsoref:spelling-contributing c3d5e342c4350f7cae9f8f0c6638b176f2e30e80 PiperOrigin-RevId: 828659867
Agent Builder Assistant
An intelligent assistant for building ADK multi-agent systems using YAML configurations.
Quick Start
Using ADK Web Interface
# From the ADK project root
adk web src/google/adk/agent_builder_assistant
Programmatic Usage
# Create with defaults
agent = AgentBuilderAssistant.create_agent()
# Create with custom settings
agent = AgentBuilderAssistant.create_agent(
model="gemini-2.5-pro",
schema_mode="query",
working_directory="/path/to/project"
)
Core Features
🎯 Intelligent Agent Design
- Analyzes requirements and suggests appropriate agent types
- Designs multi-agent architectures (Sequential, Parallel, Loop patterns)
- Provides high-level design confirmation before implementation
📝 Advanced YAML Configuration
- Generates AgentConfig schema-compliant YAML files
- Supports all agent types: LlmAgent, SequentialAgent, ParallelAgent, LoopAgent
- Built-in validation with detailed error reporting
🛠️ Multi-File Management
- Read/Write Operations: Batch processing of multiple files
- File Type Separation: YAML files use validation tools, Python files use generic tools
- Backup & Recovery: Automatic backups before overwriting existing files
🗂️ Project Structure Analysis
- Explores existing project structures
- Suggests conventional ADK file organization
- Provides path recommendations for new components
🧭 Dynamic Path Resolution
- Session Binding: Each chat session bound to one root directory
- Working Directory: Automatic detection and context provision
- ADK Source Discovery: Finds ADK installation dynamically (no hardcoded paths)
Schema Modes
Choose between two schema handling approaches:
Embedded Mode (Default)
agent = AgentBuilderAssistant.create_agent(schema_mode="embedded")
- Full AgentConfig schema embedded in context
- Faster execution, higher token usage
- Best for comprehensive schema work
Query Mode
agent = AgentBuilderAssistant.create_agent(schema_mode="query")
- Dynamic schema queries via tools
- Lower initial token usage
- Best for targeted schema operations
Example Interactions
Create a new agent
Create an agent that can roll n-sided number and check whether the rolled number is prime.
Add Capabilities to Existing Agent
Could you make the agent under `./config_based/roll_and_check` a multi agent system : root_agent only for request routing and two sub agents responsible for two functions respectively ?
Project Structure Analysis
Please analyze my existing project structure at './config_based/roll_and_check' and suggest improvements for better organization.
Tool Ecosystem
Core File Operations
read_config_files- Read multiple YAML configurations with analysiswrite_config_files- Write multiple YAML files with validationread_files- Read multiple files of any typewrite_files- Write multiple files with backup optionsdelete_files- Delete multiple files with backup options
Project Analysis
explore_project- Analyze project structure and suggest pathsresolve_root_directory- Resolve paths with working directory context
ADK knowledge Context
google_search- Search for ADK examples and documentationurl_context- Fetch content from URLs (GitHub, docs, etc.)search_adk_source- Search ADK source code with regex patterns
File Organization Conventions
ADK Project Structure
my_adk_project/
└── src/
└── my_app/
├── root_agent.yaml
├── sub_agent_1.yaml
├── sub_agent_2.yaml
├── tools/
│ ├── process_email.py # No _tool suffix
│ └── analyze_sentiment.py
└── callbacks/
├── logging.py # No _callback suffix
└── security.py
Naming Conventions
- Agent directories:
snake_case - Tool files:
descriptive_action.py - Callback files:
descriptive_name.py - Tool paths:
project_name.tools.module.function_name - Callback paths:
project_name.callbacks.module.function_name
Session Management
Root Directory Binding
Each chat session is bound to a single root directory:
- Automatic Detection: Working directory provided to model automatically
- Session State: Tracks established root directory across conversations
- Path Resolution: All relative paths resolved against session root
- Directory Switching: Suggest user starting new session to work in different directory
Working Directory Context
# The assistant automatically receives working directory context
agent = AgentBuilderAssistant.create_agent(
working_directory="/path/to/project"
)
# Model instructions include: "Working Directory: /path/to/project"
Advanced Features
Dynamic ADK Source Discovery
No hardcoded paths - works in any ADK installation:
from google.adk.agent_builder_assistant.utils import (
find_adk_source_folder,
get_adk_schema_path,
load_agent_config_schema
)
# Find ADK source dynamically
adk_path = find_adk_source_folder()
# Load schema with caching
schema = load_agent_config_schema()
Schema Validation
All YAML files validated against AgentConfig schema:
- Syntax Validation: YAML parsing with detailed error locations
- Schema Compliance: Full AgentConfig.json validation
- Best Practices: ADK naming and structure conventions
- Error Recovery: Clear suggestions for fixing validation errors
Performance Optimization
Efficient Operations
- Multi-file Processing: Batch operations reduce overhead
- Schema Caching: Global cache prevents repeated file reads
- Dynamic Discovery: Efficient ADK source location caching
- Session Context: Persistent directory binding across conversations
Memory Management
- Lazy Loading: Schema loaded only when needed
- Cache Control: Manual cache clearing for testing/development
- Resource Cleanup: Automatic cleanup of temporary files
Error Handling
Comprehensive Validation
- Path Validation: All paths validated before file operations
- Schema Compliance: AgentConfig validation with detailed error reporting
- Python Syntax: Syntax validation for generated Python code
- Backup Creation: Automatic backups before overwriting files
Recovery Mechanisms
- Retry Suggestions: Clear guidance for fixing validation errors
- Backup Restoration: Easy recovery from automatic backups
- Error Context: Detailed error messages with file locations and suggestions
This comprehensive assistant provides everything needed for intelligent, efficient ADK agent system creation with proper validation, file management, and project organization.