diff --git a/.vscode/launch.json b/.vscode/launch.json index b4b1d6b..7a37906 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -20,7 +20,7 @@ "PYTHONPATH": "${workspaceFolder}" }, "args": [ - "--debug", "--max_plan_iterations", "1", "--max_step_num", "3" + "--debug", "--max_plan_iterations", "1", "--max_step_num", "1" ] }, { diff --git a/src/graph/nodes.py b/src/graph/nodes.py index d3397eb..30f83ba 100644 --- a/src/graph/nodes.py +++ b/src/graph/nodes.py @@ -199,6 +199,7 @@ def _execute_agent_step( ) -> Command[Literal["research_team"]]: """Helper function to execute a step using the specified agent.""" current_plan = state.get("current_plan") + observations = state.get("observations", []) # Find the first unexecuted step for step in current_plan.steps: @@ -244,7 +245,7 @@ def _execute_agent_step( name=agent_name, ) ], - "observations": [response_content], + "observations": observations + [response_content], }, goto="research_team", ) diff --git a/src/graph/types.py b/src/graph/types.py index 128bc67..ccbbedf 100644 --- a/src/graph/types.py +++ b/src/graph/types.py @@ -14,7 +14,7 @@ class State(MessagesState): # Runtime Variables locale: str = "en-US" - observations: Annotated[list[str], operator.add] = [] + observations: list[str] = [] plan_iterations: int = 0 current_plan: Plan | str = None final_report: str = "" diff --git a/src/server/app.py b/src/server/app.py index a2f4ccf..e7036f4 100644 --- a/src/server/app.py +++ b/src/server/app.py @@ -72,7 +72,14 @@ async def _astream_workflow_generator( auto_accepted_plan: bool, interrupt_feedback: str, ): - input_ = {"messages": messages, "auto_accepted_plan": auto_accepted_plan} + input_ = { + "messages": messages, + "plan_iterations": 0, + "final_report": "", + "current_plan": None, + "observations": [], + "auto_accepted_plan": auto_accepted_plan, + } if not auto_accepted_plan and interrupt_feedback: resume_msg = f"[{interrupt_feedback}]" # add the last message to the resume message