@@ -45,7 +45,7 @@ class StepSuccess(BaseModel):
4545 """Output of success attacher"""
4646
4747 success : bool = Field (description = "Whether the task was completed successfully" )
48- explanation : str = Field (description = "Explanation of what happened" )
48+ explanation : str = Field (description = "Summarize briefly what happened" )
4949
5050
5151class MegamindState (MessagesState ):
@@ -102,7 +102,9 @@ def analyzer_node(
102102 state ["step_success" ] = StepSuccess (
103103 success = analysis .success , explanation = analysis .explanation
104104 )
105- state ["steps_done" ].append (f"{ state ['step_success' ].explanation } " )
105+ state ["steps_done" ].append (
106+ f"objective: { state ['step' ]} , success: { state ['step_success' ].success } , explanation: { state ['step_success' ].explanation } "
107+ )
106108 return state
107109
108110
@@ -158,7 +160,7 @@ def create_react_structured_agent(
158160 return graph .compile ()
159161
160162
161- def create_handoff_tool (agent_name : str , description : str = None ):
163+ def create_handoff_tool (agent_name : str , description : Optional [ str ] = None ):
162164 """Create a handoff tool for transferring tasks to specialist agents."""
163165 name = f"transfer_to_{ agent_name } "
164166 description = description or f" { agent_name } for help."
@@ -221,9 +223,10 @@ def plan_step(
221223 state ["step" ] = None
222224
223225 megamind_prompt = f"You are given objective to complete: { state ['original_task' ]} "
224- for provider in context_providers :
225- megamind_prompt += provider .get_context ()
226- megamind_prompt += "\n "
226+ if context_providers :
227+ for provider in context_providers :
228+ megamind_prompt += provider .get_context ()
229+ megamind_prompt += "\n "
227230 if state ["steps_done" ]:
228231 megamind_prompt += "\n \n "
229232 megamind_prompt += "Steps that were already done successfully:\n "
0 commit comments