็™ป้Œฒใ—ใฆๆ‹›ๅพ…ใƒชใƒณใ‚ฏใ‚’ๅ…ฑๆœ‰ใ™ใ‚‹ใจใ€ๅ‹•็”ปๅ†็”Ÿๅ ฑ้…ฌใจ็ดนไป‹ๅ ฑ้…ฌใ‚’็ฒๅพ—ใงใใพใ™ใ€‚

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture ๆŠ•็จฟใฏๅ€‹ไบบใฎๆ„่ฆ‹ใงใ™ใ€‚
ๅ‚ๅŠ  May 2026
258 ใƒ•ใ‚ฉใƒญใƒผไธญ    225 ใƒ•ใ‚กใƒณ
# Practical and Useful Patterns with ADK ๐Ÿ“„ What if you could define agents in YAML instead of code? ADK's Agent Config enables declarative agent definitions with environment-specific switching -- no redeployment needed for prompt or model changes! ๐Ÿ“Œ Title: Agent Config โ€” Declarative, Code-Free Agent Definitions in YAML ๐Ÿ”— URL: ๐Ÿงฉ Overview Agent Config lets you build ADK workflows without writing code, using YAML files to define `name`, `model`, `description`, `instruction`, `tools`, and `sub_agents`. Create projects with `adk create --type=config`, then run with `adk web`, `adk run`, or `adk api_server`. For programmatic loading, use `config_agent_utils.from_config()` in Python. This separation of agent definition from code enables prompt changes, model swaps, and environment-specific configurations without redeployment. ๐Ÿ›  Usage A basic Agent Config YAML: ```yaml # root_agent.yaml name: assistant_agent model: gemini-flash-latest description: A helper agent that answers user questions. instruction: | You are an agent that answers various user questions. Provide accurate and helpful responses. tools: - google_search sub_agents: - config_path: specialist_agent.yaml ``` Create and run a project: ```bash # Create project adk create --type=config my_agent # Run options adk web # Web interface adk run # Terminal execution adk api_server # API server mode ``` Load programmatically in Python: Use `config_agent_utils.from_config()` from `google.adk.agents` to programmatically load an agent from a YAML file path (e.g., `"my_agent/root_agent.yaml"`). ๐Ÿ— Practical Patterns **Environment-Specific Configuration**: Maintain separate YAML files for dev/staging/prod and select them via environment variables. ```yaml # config/dev/root_agent.yaml name: assistant_agent model: gemini-flash-latest instruction: | [DEV] Include debug information in your responses. # config/prod/root_agent.yaml name: assistant_agent model: gemini-2.5-pro instruction: | Answer user questions accurately and concisely. ``` Read the environment name with `os.getenv("ENVIRONMENT", "dev")` and dynamically load the corresponding YAML file via `config_agent_utils.from_config(f"config/{env}/root_agent.yaml")`. **Prompt Versioning**: Track YAML files in Git for full prompt change history. Update instructions without code changes and roll back easily when needed. **A/B Testing**: Prepare multiple YAML files with different instructions or models, and switch between them at runtime to compare performance. Call `get_ab_variant(user_id)` to determine the A/B variant (`"a"` or `"b"`), then load the corresponding YAML file with `config_agent_utils.from_config(f"config/variant_{variant}.yaml")` for runtime A/B testing. ๐Ÿ’ก Use Cases ๐Ÿ”„ Prompt and model changes without code modifications or redeployment ๐ŸŒ Per-environment configuration management (dev/staging/prod) ๐Ÿ“Š A/B testing different instructions and models ๐Ÿ“ Git-tracked prompt versioning with easy rollback ๐Ÿงฉ Enabling non-engineers to update agent configurations safely โš ๏ธ Considerations - Currently only Gemini models are supported. Other model providers are not yet available. - Custom code tools are limited to Python and Java. - `LangGraphAgent` and `A2aAgent` are not yet supported in Agent Config. - API keys and project settings are managed via `.env` files -- be careful not to commit secrets. โœจ Agent Config separates agent definitions from code, enabling non-engineers to safely modify prompts and models while making environment switching and A/B testing straightforward. Use it to maximize operational flexibility! #ADK# #AIAgent#
ใ‚‚ใฃใจ่ฆ‹ใ‚‹