@@ -24,10 +24,10 @@ class ProceduresAgent(BaseAgent):
24
24
form_agent = FormAgent ()
25
25
allowed_procedures : Dict [str , CatTool | CatForm ] = {}
26
26
27
- async def execute (self , stray ) -> AgentOutput :
27
+ def execute (self , stray ) -> AgentOutput :
28
28
29
29
# Run active form if present
30
- form_output : AgentOutput = await self .form_agent .execute (stray )
30
+ form_output : AgentOutput = self .form_agent .execute (stray )
31
31
if form_output .return_direct :
32
32
return form_output
33
33
@@ -38,7 +38,7 @@ async def execute(self, stray) -> AgentOutput:
38
38
log .debug (f"Procedural memories retrived: { len (procedural_memories )} ." )
39
39
40
40
try :
41
- procedures_result : AgentOutput = await self .execute_procedures (stray )
41
+ procedures_result : AgentOutput = self .execute_procedures (stray )
42
42
if procedures_result .return_direct :
43
43
# exit agent if a return_direct procedure was executed
44
44
return procedures_result
@@ -64,7 +64,7 @@ async def execute(self, stray) -> AgentOutput:
64
64
return AgentOutput ()
65
65
66
66
67
- async def execute_procedures (self , stray ):
67
+ def execute_procedures (self , stray ):
68
68
69
69
# using some hooks
70
70
mad_hatter = MadHatter ()
@@ -87,13 +87,13 @@ async def execute_procedures(self, stray):
87
87
)
88
88
89
89
# Execute chain and obtain a choice of procedure from the LLM
90
- llm_action : LLMAction = await self .execute_chain (stray , procedures_prompt_template , allowed_procedures )
90
+ llm_action : LLMAction = self .execute_chain (stray , procedures_prompt_template , allowed_procedures )
91
91
92
92
# route execution to subagents
93
- return await self .execute_subagents (stray , llm_action , allowed_procedures )
93
+ return self .execute_subagents (stray , llm_action , allowed_procedures )
94
94
95
95
96
- async def execute_chain (self , stray , procedures_prompt_template , allowed_procedures ) -> LLMAction :
96
+ def execute_chain (self , stray , procedures_prompt_template , allowed_procedures ) -> LLMAction :
97
97
98
98
# Prepare info to fill up the prompt
99
99
prompt_variables = {
@@ -136,15 +136,15 @@ async def execute_chain(self, stray, procedures_prompt_template, allowed_procedu
136
136
return llm_action
137
137
138
138
139
- async def execute_subagents (self , stray , llm_action , allowed_procedures ):
139
+ def execute_subagents (self , stray , llm_action , allowed_procedures ):
140
140
# execute chosen tool / form
141
141
# loop over allowed tools and forms
142
142
if llm_action .action :
143
143
chosen_procedure = allowed_procedures .get (llm_action .action , None )
144
144
try :
145
145
if Plugin ._is_cat_tool (chosen_procedure ):
146
146
# execute tool
147
- tool_output = await chosen_procedure ._arun (llm_action .action_input , stray = stray )
147
+ tool_output = chosen_procedure .run (llm_action .action_input , stray = stray )
148
148
return AgentOutput (
149
149
output = tool_output ,
150
150
return_direct = chosen_procedure .return_direct ,
@@ -158,7 +158,7 @@ async def execute_subagents(self, stray, llm_action, allowed_procedures):
158
158
# store active form in working memory
159
159
stray .working_memory .active_form = form_instance
160
160
# execute form
161
- return await self .form_agent .execute (stray )
161
+ return self .form_agent .execute (stray )
162
162
163
163
except Exception as e :
164
164
log .error (f"Error executing { chosen_procedure .procedure_type } `{ chosen_procedure .name } `" )
0 commit comments