ISSUE DESCRIPTION [Bug] team.acontinuerun loss dependencies or sessionstate Description…
- User
ISSUE DESCRIPTION
[Bug] team.acontinue_run loss dependencies or session_state
Description
team.acontinue_run loss dependencies or session_state
Steps to Reproduce
pythonrequires_confirmation_tools = [ "group_del", "group_del_stock", ] async def group_del_stock(self, group_id: str, stock_list: list[dict], run_context: RunContext) -> Dict[str, Any]: url = f"{self.live_base_url}/cloud/api/optional/stock/code/del" headers = { "Content-Type": "application/json", "X-Access-Token": run_context.session_state["user_token"] } data = {"targetStockGroupId":group_id,"delVoList":stock_list}example code
pythonsession_id = str(uuid.uuid4()) user_id= '00bgh2' session_state = {"user_token":"Bearer "} asyncio.run(main()) async def main(): async for run_event in stock_team.arun( "将茅台从优质股中删除", stream=True, session_id=session_id, user_id=user_id, session_state=session_state ): from agno.run.team import RunPausedEvent as TeamRunPausedEvent # Use isinstance to check for team's pause event (not the member agent's) if isinstance(run_event, TeamRunPausedEvent): print("Team paused - requires confirmation") for req in run_event.active_requirements: if req.needs_confirmation: print(f" Tool: {req.tool_execution.tool_name}") print(f" Args: {req.tool_execution.tool_args}") req.confirm() # Use apprint_run_response for async streaming response = stock_team.acontinue_run( run_id=run_event.run_id, session_id=run_event.session_id, requirements=run_event.requirements, stream=True, user_id=user_id, dependencies=session_state, ) await pprint.apprint_run_response(response) - Assistant
I’ll trace the team pause/continue flow, focusing on how
RunContextis constructed and restored when requirements are routed back to member tools. I’ll compare the normalarunpath withacontinue_run, identify the missing state propagation, implement the smallest compatible fix, and run targeted tests (plus any relevant existing suite). - Assistant
The defect is in the member-routing calls: they invoke each member’s
acontinue_runwithout the parent continuation’sRunContext, so the member creates a fresh context with empty session state and no dependencies. I’ll propagate that context in both streaming and non-streaming routing. I’ll also seed a continuation context from an already suppliedTeamRunOutput.session_statewhen available, preserving state for in-memory/run-response continuation flows. - Assistant
The patch now propagates the context through all four async member-routing branches (and the corresponding sync branches, keeping behavior consistent). The continuation dispatch also reuses state embedded in a provided run response instead of unconditionally replacing it with
{}. I’ll run the focused team continuation tests and type/compile checks next. - Assistant
The focused suite passes (49 tests), compilation succeeds, and the diff has no whitespace errors. The resulting change is limited to context propagation and state restoration; no tests were modified. I’ll do one broader team test run to catch compatibility issues with nested/team/agent member variants before submission.
- Assistant
The broader command itself was rejected because this repository’s pytest configuration does not provide the
--timeoutplugin/option; no tests ran in that attempt. I’ll rerun the same unit directory without that unsupported option. - Assistant
The broader team suite reached 299 passing tests (2 skipped) before stopping on an unrelated environment/dependency failure:
agno.db.postgresis unavailable while an existing test patches it. This is outside the changed code. I’ll perform the final diff/status verification and submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.