Untitled conversation
- User
[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
Now I'll add the helpers and modify the four routing functions. First, the import:
- Assistant
Now add the helper functions before
_route_requirements_to_members: - Assistant
Now update the sync non-streaming variant:
- Assistant
Now the sync streaming variant:
- Assistant
Now add the merge after the sync stream loop:
- Assistant
Now the async non-streaming variant:
- Assistant
Now the async streaming variant (
_aroute_requirements_to_members_stream): - Assistant
Now let me verify the team's async dispatch (
acontinue_run_dispatch) properly wires dependencies into the run_context and passes run_context to the async routing functions: - Assistant
One consideration — members can be
RemoteAgent/RemoteTeam. Let me check that theircontinue_run/acontinue_runacceptrun_context: - Assistant
RemoteAgentmembers would already fail on this path (it doesn't acceptrun_response=), but I'll make the helper defensive withgetattrfor the knowledge attributes: - Assistant
Now let me check existing tests covering this routing:
- Assistant
Let me view the end of the test file and then add tests:
- Assistant
All 59 tests pass. Now run the broader team test suite:
- Assistant
The 2 failures are pre-existing (missing DB deps in this environment), unrelated to my change. Now run format and validation:
- Assistant
Fixed. Here's a summary of the change:
Root cause
When a team run pauses for HITL and is resumed via
team.continue_run()/team.acontinue_run(), the requirement-routing helpers in (, , , ) called / with only / and .
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.