24
24
25
25
from pydantic import BaseModel
26
26
from pydantic import ConfigDict
27
+ from pydantic import Field
27
28
28
29
from ..utils .feature_decorator import experimental
29
30
from .common_configs import AgentRefConfig
@@ -43,32 +44,41 @@ class BaseAgentConfig(BaseModel):
43
44
extra = 'allow' ,
44
45
)
45
46
46
- agent_class : Union [Literal ['BaseAgent' ], str ] = 'BaseAgent'
47
- """Required. The class of the agent. The value is used to differentiate
48
- among different agent classes."""
47
+ agent_class : Union [Literal ['BaseAgent' ], str ] = Field (
48
+ default = 'BaseAgent' ,
49
+ description = (
50
+ 'Required. The class of the agent. The value is used to differentiate'
51
+ ' among different agent classes.'
52
+ ),
53
+ )
49
54
50
- name : str
51
- """Required. The name of the agent."""
55
+ name : str = Field (description = 'Required. The name of the agent.' )
52
56
53
- description : str = ''
54
- """Optional. The description of the agent."""
57
+ description : str = Field (
58
+ default = '' , description = 'Optional. The description of the agent.'
59
+ )
55
60
56
- sub_agents : Optional [List [AgentRefConfig ]] = None
57
- """Optional. The sub-agents of the agent."""
61
+ sub_agents : Optional [List [AgentRefConfig ]] = Field (
62
+ default = None , description = 'Optional. The sub-agents of the agent.'
63
+ )
58
64
59
- before_agent_callbacks : Optional [List [CodeConfig ]] = None
60
- """Optional. The before_agent_callbacks of the agent.
65
+ before_agent_callbacks : Optional [List [CodeConfig ]] = Field (
66
+ default = None ,
67
+ description = """\
68
+ Optional. The before_agent_callbacks of the agent.
61
69
62
- Example:
70
+ Example:
63
71
64
- ```
65
- before_agent_callbacks:
66
- - name: my_library.security_callbacks.before_agent_callback
67
- ```
68
- """
72
+ ```
73
+ before_agent_callbacks:
74
+ - name: my_library.security_callbacks.before_agent_callback
75
+ ```""" ,
76
+ )
69
77
70
- after_agent_callbacks : Optional [List [CodeConfig ]] = None
71
- """Optional. The after_agent_callbacks of the agent."""
78
+ after_agent_callbacks : Optional [List [CodeConfig ]] = Field (
79
+ default = None ,
80
+ description = 'Optional. The after_agent_callbacks of the agent.' ,
81
+ )
72
82
73
83
def to_agent_config (
74
84
self , custom_agent_config_cls : Type [TBaseAgentConfig ]
0 commit comments