You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the _generate_updated_plan method of the MultiStepAgent class. There's a direct contradiction between the code comments and the actual implementation, which likely causes the planning functionality to behave differently than intended.
The Issue
In agents.py,
def_generate_updated_plan(self, task: str, step: int) ->Tuple[ChatMessage, ChatMessage]:
# Do not take the system prompt message from the memory# summary_mode=False: Do not take previous plan steps to avoid influencing the new planmemory_messages=self.write_memory_to_messages()[1:]
However, when examining how write_memory_to_messages() and PlanningStep.to_messages() work together, I discovered that setting summary_mode=False (the default when not specified) actually includes previous plans rather than excluding them.
Looking at memory.py, the PlanningStep.to_messages() method shows:
defto_messages(self, summary_mode: bool, **kwargs) ->List[Message]:
messages= []
messages.append(
Message(
role=MessageRole.ASSISTANT, content=[{"type": "text", "text": f"[FACTS LIST]:\n{self.facts.strip()}"}]
)
)
ifnotsummary_mode: # This step is not shown to a model writing a plan to avoid influencing the new planmessages.append(
Message(
role=MessageRole.ASSISTANT, content=[{"type": "text", "text": f"[PLAN]:\n{self.plan.strip()}"}]
)
)
returnmessages
This means the condition is the exact opposite of what the comment suggests: when summary_mode=False, plans ARE included, not excluded
The text was updated successfully, but these errors were encountered:
Description
In the _generate_updated_plan method of the MultiStepAgent class. There's a direct contradiction between the code comments and the actual implementation, which likely causes the planning functionality to behave differently than intended.
The Issue
In agents.py,
However, when examining how write_memory_to_messages() and PlanningStep.to_messages() work together, I discovered that setting summary_mode=False (the default when not specified) actually includes previous plans rather than excluding them.
Looking at memory.py, the PlanningStep.to_messages() method shows:
This means the condition is the exact opposite of what the comment suggests: when summary_mode=False, plans ARE included, not excluded
The text was updated successfully, but these errors were encountered: