@@ -56,18 +56,8 @@ Every agent is equipped with a set of tools (functions) that it can call to perf
5656 ]
5757 ```
5858
59- 2 . ** Add the Tools to the System** : Register the tools with a ToolAgent.
6059
61- Example:
62- ```python
63- await ToolAgent.register(
64- runtime,
65- " baker_tool_agent" ,
66- lambda : ToolAgent(" Baker tool execution agent" , get_baker_tools()),
67- )
68- ```
69-
70- # ## **Step 2: Implement the Agent Class**
60+ 2 . ** Implement the Agent Class**
7161Create a new agent class that inherits from `BaseAgent` .
7262
7363Example (for `BakerAgent` ):
@@ -87,17 +77,42 @@ class BakerAgent(BaseAgent):
8777 system_message = " You are an AI Agent specialized in baking tasks." ,
8878 )
8979```
80+ ### ** Step 2: Register the new Agent in the messages**
81+ Update ` messages.py ` to include the new agent.
82+
83+ ```python
84+ baker_agent = "BakerAgent"
85+ ```
9086
9187### ** Step 3: Register the Agent in the Initialization Process**
9288Update the ` initialize_runtime_and_context ` function in ` utils.py ` to include the new agent.
9389
94- 1 . ** Generate Agent IDs** :
90+ 1 . ** Import new agent** :
91+ ``` python
92+ from agents.baker_agent import BakerAgent, get_baker_tools
93+ ```
94+
95+ 2 . ** Add the bakers tools** :
96+ ```python
97+ baker_tools = get_baker_tools()
98+ ```
99+
100+ 3 . ** Generate Agent IDs** :
95101 ```python
96102 baker_agent_id = AgentId(" baker_agent" , session_id)
97103 baker_tool_agent_id = AgentId(" baker_tool_agent" , session_id)
98104 ```
99105
100- 2 . ** Register the Agent and ToolAgent** :
106+ 4 . ** Register to ToolAgent** :
107+ ```python
108+ await ToolAgent.register(
109+ runtime,
110+ " baker_tool_agent" ,
111+ lambda : ToolAgent(" Baker tool execution agent" , baker_tools),
112+ )
113+ ```
114+
115+ 5 . ** Register the Agent and ToolAgent** :
101116 ```python
102117 await BakerAgent.register(
103118 runtime,
@@ -112,6 +127,29 @@ Update the `initialize_runtime_and_context` function in `utils.py` to include th
112127 ),
113128 )
114129 ```
130+ 6 . ** Add to HumanAgent** :
131+ ```python
132+ await HumanAgent.register(
133+ BAgentType.baker_agent: baker_agent_id,
134+ ```
135+ 7 . ** Add to GroupChatManager** :
136+ ```python
137+ await GroupChatManager.register(
138+ baker_tools: List[Tool] = get_baker_tools()
139+ ```
140+ 8 . ** Append to baker_tools to functions** :
141+ ```python
142+ for tool in baker_tools:
143+ functions.append(
144+ {
145+ " agent" : " BakerAgent" ,
146+ " function" : tool.name,
147+ " description" : tool.description,
148+ " arguments" : str (tool.schema[" parameters" ][" properties" ]),
149+ }
150+ )
151+ ```
152+
115153
116154# ## **Step 4: Update the Planner Agent**
117155Modify `PlannerAgent` to recognize and include the new agent when generating plans.
@@ -129,12 +167,6 @@ Modify `PlannerAgent` to recognize and include the new agent when generating pla
129167 ]
130168 ```
131169
132- 2 . ** Update Tool List** :
133- Ensure the tool list passed to the PlannerAgent includes the new agent' s tools.
134- ```python
135- tool_list = retrieve_all_agent_tools() + get_baker_tools()
136- ```
137-
138170# ## **Step 5: Validate the Integration**
139171Deploy the updated system and ensure the new agent is properly included in the planning process. For example, if the user requests to bake cookies, the `PlannerAgent` should:
140172
0 commit comments