Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions src/google/adk/agents/base_agent_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

from pydantic import BaseModel
from pydantic import ConfigDict
from pydantic import Field

from ..utils.feature_decorator import experimental
from .common_configs import AgentRefConfig
Expand All @@ -43,32 +44,41 @@ class BaseAgentConfig(BaseModel):
extra='allow',
)

agent_class: Union[Literal['BaseAgent'], str] = 'BaseAgent'
"""Required. The class of the agent. The value is used to differentiate
among different agent classes."""
agent_class: Union[Literal['BaseAgent'], str] = Field(
default='BaseAgent',
description=(
'Required. The class of the agent. The value is used to differentiate'
' among different agent classes.'
),
)

name: str
"""Required. The name of the agent."""
name: str = Field(description='Required. The name of the agent.')

description: str = ''
"""Optional. The description of the agent."""
description: str = Field(
default='', description='Optional. The description of the agent.'
)

sub_agents: Optional[List[AgentRefConfig]] = None
"""Optional. The sub-agents of the agent."""
sub_agents: Optional[List[AgentRefConfig]] = Field(
default=None, description='Optional. The sub-agents of the agent.'
)

before_agent_callbacks: Optional[List[CodeConfig]] = None
"""Optional. The before_agent_callbacks of the agent.
before_agent_callbacks: Optional[List[CodeConfig]] = Field(
default=None,
description="""\
Optional. The before_agent_callbacks of the agent.

Example:
Example:

```
before_agent_callbacks:
- name: my_library.security_callbacks.before_agent_callback
```
"""
```
before_agent_callbacks:
- name: my_library.security_callbacks.before_agent_callback
```""",
)

after_agent_callbacks: Optional[List[CodeConfig]] = None
"""Optional. The after_agent_callbacks of the agent."""
after_agent_callbacks: Optional[List[CodeConfig]] = Field(
default=None,
description='Optional. The after_agent_callbacks of the agent.',
)

def to_agent_config(
self, custom_agent_config_cls: Type[TBaseAgentConfig]
Expand Down
Loading