Skip to content

feat: Implement configuration-driven agent creation#1

Open
sidpan1 wants to merge 1 commit into
mainfrom
feature/configurable-agents
Open

feat: Implement configuration-driven agent creation#1
sidpan1 wants to merge 1 commit into
mainfrom
feature/configurable-agents

Conversation

@sidpan1

@sidpan1 sidpan1 commented May 31, 2025

Copy link
Copy Markdown
Owner

This commit introduces a new system for defining and loading agents and their capabilities via YAML configuration files.

Key features and changes:

  • Pydantic Models for Configuration: New models (RootConfig, LlmAgentConfig, SequentialAgentConfig, ParallelAgentConfig, ToolReferenceConfig) are defined in src/google/adk/config/models.py to represent the YAML structure.

  • Configuration Loader & Agent Factory: src/google/adk/config/loader.py provides load_configuration which parses the main YAML, loads specified capability libraries (also YAML), and uses an AgentFactory to instantiate the defined agents. The factory resolves capability references and recursively builds agent hierarchies.

  • Flexible Agent Definitions:

    • Agents can be of different types (LLM, Sequential, Parallel).
    • Agents can be defined inline within a parent agent's configuration or referenced by name from a top-level agent definition, allowing for reusable agent components.
    • LLM agents can be configured with models, instructions, capabilities, output keys (for state sharing), and output schemas.
  • Capability Library Configuration: Capability libraries can be defined in separate YAML files, specifying data sources, individual capabilities (e.g., SQLite capabilities), and capability sets. The loader currently supports a structure similar to existing ADK capability YAMLs.

  • Sample Implementation: A comprehensive sample is provided in samples/configurable_agents/:

    • config.yaml: Demonstrates various agent types, hierarchy, agent referencing (inline and by name), and capability usage.
    • sample_tools.yaml: Defines sample SQLite capabilities and a capability set.
    • sample_db.sqlite: A small SQLite database for the sample capabilities.
  • Basic Integration Test: tests/integration/config/test_config_loading.py includes a test to verify that the sample configuration can be loaded successfully.

  • Documentation: samples/configurable_agents/README.md provides detailed documentation on the YAML schema for agents and capabilities, usage examples, and how to load configurations programmatically.

This feature significantly enhances the flexibility and manageability of creating and deploying agents within the ADK framework.

This commit introduces a new system for defining and loading agents
and their capabilities via YAML configuration files.

Key features and changes:

- **Pydantic Models for Configuration:**
  New models (`RootConfig`, `LlmAgentConfig`, `SequentialAgentConfig`,
  `ParallelAgentConfig`, `ToolReferenceConfig`) are defined in
  `src/google/adk/config/models.py` to represent the YAML structure.

- **Configuration Loader & Agent Factory:**
  `src/google/adk/config/loader.py` provides `load_configuration`
  which parses the main YAML, loads specified capability libraries (also YAML),
  and uses an `AgentFactory` to instantiate the defined agents.
  The factory resolves capability references and recursively builds agent
  hierarchies.

- **Flexible Agent Definitions:**
  - Agents can be of different types (LLM, Sequential, Parallel).
  - Agents can be defined inline within a parent agent's
    configuration or referenced by name from a top-level agent definition,
    allowing for reusable agent components.
  - LLM agents can be configured with models, instructions, capabilities,
    output keys (for state sharing), and output schemas.

- **Capability Library Configuration:**
  Capability libraries can be defined in separate YAML files, specifying
  data sources, individual capabilities (e.g., SQLite capabilities), and capability sets.
  The loader currently supports a structure similar to existing ADK
  capability YAMLs.

- **Sample Implementation:**
  A comprehensive sample is provided in `samples/configurable_agents/`:
    - `config.yaml`: Demonstrates various agent types, hierarchy,
      agent referencing (inline and by name), and capability usage.
    - `sample_tools.yaml`: Defines sample SQLite capabilities and a capability set.
    - `sample_db.sqlite`: A small SQLite database for the sample capabilities.

- **Basic Integration Test:**
  `tests/integration/config/test_config_loading.py` includes a test
  to verify that the sample configuration can be loaded successfully.

- **Documentation:**
  `samples/configurable_agents/README.md` provides detailed
  documentation on the YAML schema for agents and capabilities, usage examples,
  and how to load configurations programmatically.

This feature significantly enhances the flexibility and manageability of
creating and deploying agents within the ADK framework.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant