|
| 1 | +# Agent Builder Assistant |
| 2 | + |
| 3 | +An intelligent assistant for building ADK multi-agent systems using YAML configurations. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +### Using ADK Web Interface |
| 8 | +```bash |
| 9 | +# From the ADK project root |
| 10 | +adk web src/google/adk/agent_builder_assistant |
| 11 | +``` |
| 12 | + |
| 13 | +### Programmatic Usage |
| 14 | +```python |
| 15 | +# Create with defaults |
| 16 | +agent = AgentBuilderAssistant.create_agent() |
| 17 | + |
| 18 | +# Create with custom settings |
| 19 | +agent = AgentBuilderAssistant.create_agent( |
| 20 | + model="gemini-2.5-pro", |
| 21 | + schema_mode="query", |
| 22 | + working_directory="/path/to/project" |
| 23 | +) |
| 24 | +``` |
| 25 | + |
| 26 | +## Core Features |
| 27 | + |
| 28 | +### 🎯 **Intelligent Agent Design** |
| 29 | +- Analyzes requirements and suggests appropriate agent types |
| 30 | +- Designs multi-agent architectures (Sequential, Parallel, Loop patterns) |
| 31 | +- Provides high-level design confirmation before implementation |
| 32 | + |
| 33 | +### 📝 **Advanced YAML Configuration** |
| 34 | +- Generates AgentConfig schema-compliant YAML files |
| 35 | +- Supports all agent types: LlmAgent, SequentialAgent, ParallelAgent, LoopAgent |
| 36 | +- Built-in validation with detailed error reporting |
| 37 | + |
| 38 | +### 🛠️ **Multi-File Management** |
| 39 | +- **Read/Write Operations**: Batch processing of multiple files |
| 40 | +- **File Type Separation**: YAML files use validation tools, Python files use generic tools |
| 41 | +- **Backup & Recovery**: Automatic backups before overwriting existing files |
| 42 | + |
| 43 | +### 🗂️ **Project Structure Analysis** |
| 44 | +- Explores existing project structures |
| 45 | +- Suggests conventional ADK file organization |
| 46 | +- Provides path recommendations for new components |
| 47 | + |
| 48 | +### 🧭 **Dynamic Path Resolution** |
| 49 | +- **Session Binding**: Each chat session bound to one root directory |
| 50 | +- **Working Directory**: Automatic detection and context provision |
| 51 | +- **ADK Source Discovery**: Finds ADK installation dynamically (no hardcoded paths) |
| 52 | + |
| 53 | +## Schema Modes |
| 54 | + |
| 55 | +Choose between two schema handling approaches: |
| 56 | + |
| 57 | +### Embedded Mode (Default) |
| 58 | +```python |
| 59 | +agent = AgentBuilderAssistant.create_agent(schema_mode="embedded") |
| 60 | +``` |
| 61 | +- Full AgentConfig schema embedded in context |
| 62 | +- Faster execution, higher token usage |
| 63 | +- Best for comprehensive schema work |
| 64 | + |
| 65 | +### Query Mode |
| 66 | +```python |
| 67 | +agent = AgentBuilderAssistant.create_agent(schema_mode="query") |
| 68 | +``` |
| 69 | +- Dynamic schema queries via tools |
| 70 | +- Lower initial token usage |
| 71 | +- Best for targeted schema operations |
| 72 | + |
| 73 | +## Example Interactions |
| 74 | + |
| 75 | +### Create a new agent |
| 76 | +``` |
| 77 | +Create an agent that can roll n-sided number and check whether the rolled number is prime. |
| 78 | +``` |
| 79 | + |
| 80 | +### Add Capabilities to Existing Agent |
| 81 | +``` |
| 82 | +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 ? |
| 83 | +``` |
| 84 | + |
| 85 | +### Project Structure Analysis |
| 86 | +``` |
| 87 | +Please analyze my existing project structure at './config_based/roll_and_check' and suggest improvements for better organization. |
| 88 | +``` |
| 89 | + |
| 90 | +## Tool Ecosystem |
| 91 | + |
| 92 | +### Core File Operations |
| 93 | +- **`read_config_files`** - Read multiple YAML configurations with analysis |
| 94 | +- **`write_config_files`** - Write multiple YAML files with validation |
| 95 | +- **`read_files`** - Read multiple files of any type |
| 96 | +- **`write_files`** - Write multiple files with backup options |
| 97 | +- **`delete_files`** - Delete multiple files with backup options |
| 98 | + |
| 99 | +### Project Analysis |
| 100 | +- **`explore_project`** - Analyze project structure and suggest paths |
| 101 | +- **`resolve_root_directory`** - Resolve paths with working directory context |
| 102 | + |
| 103 | +### ADK knowledge Context |
| 104 | +- **`google_search`** - Search for ADK examples and documentation |
| 105 | +- **`url_context`** - Fetch content from URLs (GitHub, docs, etc.) |
| 106 | +- **`search_adk_source`** - Search ADK source code with regex patterns |
| 107 | + |
| 108 | + |
| 109 | +## File Organization Conventions |
| 110 | + |
| 111 | +### ADK Project Structure |
| 112 | +``` |
| 113 | +my_adk_project/ |
| 114 | +└── src/ |
| 115 | + └── my_app/ |
| 116 | + ├── root_agent.yaml |
| 117 | + ├── sub_agent_1.yaml |
| 118 | + ├── sub_agent_2.yaml |
| 119 | + ├── tools/ |
| 120 | + │ ├── process_email.py # No _tool suffix |
| 121 | + │ └── analyze_sentiment.py |
| 122 | + └── callbacks/ |
| 123 | + ├── logging.py # No _callback suffix |
| 124 | + └── security.py |
| 125 | +``` |
| 126 | + |
| 127 | +### Naming Conventions |
| 128 | +- **Agent directories**: `snake_case` |
| 129 | +- **Tool files**: `descriptive_action.py` |
| 130 | +- **Callback files**: `descriptive_name.py` |
| 131 | +- **Tool paths**: `project_name.tools.module.function_name` |
| 132 | +- **Callback paths**: `project_name.callbacks.module.function_name` |
| 133 | + |
| 134 | +## Session Management |
| 135 | + |
| 136 | +### Root Directory Binding |
| 137 | +Each chat session is bound to a single root directory: |
| 138 | + |
| 139 | +- **Automatic Detection**: Working directory provided to model automatically |
| 140 | +- **Session State**: Tracks established root directory across conversations |
| 141 | +- **Path Resolution**: All relative paths resolved against session root |
| 142 | +- **Directory Switching**: Suggest user starting new session to work in different directory |
| 143 | + |
| 144 | +### Working Directory Context |
| 145 | +```python |
| 146 | +# The assistant automatically receives working directory context |
| 147 | +agent = AgentBuilderAssistant.create_agent( |
| 148 | + working_directory="/path/to/project" |
| 149 | +) |
| 150 | +# Model instructions include: "Working Directory: /path/to/project" |
| 151 | +``` |
| 152 | + |
| 153 | +## Advanced Features |
| 154 | + |
| 155 | +### Dynamic ADK Source Discovery |
| 156 | +No hardcoded paths - works in any ADK installation: |
| 157 | + |
| 158 | +```python |
| 159 | +from google.adk.agent_builder_assistant.utils import ( |
| 160 | + find_adk_source_folder, |
| 161 | + get_adk_schema_path, |
| 162 | + load_agent_config_schema |
| 163 | +) |
| 164 | + |
| 165 | +# Find ADK source dynamically |
| 166 | +adk_path = find_adk_source_folder() |
| 167 | + |
| 168 | +# Load schema with caching |
| 169 | +schema = load_agent_config_schema() |
| 170 | +``` |
| 171 | + |
| 172 | +### Schema Validation |
| 173 | +All YAML files validated against AgentConfig schema: |
| 174 | + |
| 175 | +- **Syntax Validation**: YAML parsing with detailed error locations |
| 176 | +- **Schema Compliance**: Full AgentConfig.json validation |
| 177 | +- **Best Practices**: ADK naming and structure conventions |
| 178 | +- **Error Recovery**: Clear suggestions for fixing validation errors |
| 179 | + |
| 180 | +## Performance Optimization |
| 181 | + |
| 182 | +### Efficient Operations |
| 183 | +- **Multi-file Processing**: Batch operations reduce overhead |
| 184 | +- **Schema Caching**: Global cache prevents repeated file reads |
| 185 | +- **Dynamic Discovery**: Efficient ADK source location caching |
| 186 | +- **Session Context**: Persistent directory binding across conversations |
| 187 | + |
| 188 | +### Memory Management |
| 189 | +- **Lazy Loading**: Schema loaded only when needed |
| 190 | +- **Cache Control**: Manual cache clearing for testing/development |
| 191 | +- **Resource Cleanup**: Automatic cleanup of temporary files |
| 192 | + |
| 193 | +## Error Handling |
| 194 | + |
| 195 | +### Comprehensive Validation |
| 196 | +- **Path Validation**: All paths validated before file operations |
| 197 | +- **Schema Compliance**: AgentConfig validation with detailed error reporting |
| 198 | +- **Python Syntax**: Syntax validation for generated Python code |
| 199 | +- **Backup Creation**: Automatic backups before overwriting files |
| 200 | + |
| 201 | +### Recovery Mechanisms |
| 202 | +- **Retry Suggestions**: Clear guidance for fixing validation errors |
| 203 | +- **Backup Restoration**: Easy recovery from automatic backups |
| 204 | +- **Error Context**: Detailed error messages with file locations and suggestions |
| 205 | + |
| 206 | +This comprehensive assistant provides everything needed for intelligent, efficient ADK agent system creation with proper validation, file management, and project organization. |
0 commit comments