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 let me look at the agent's
continue_run/acontinue_runsignature to see what parameters it accepts: - Assistant
Now let me look at how
delegate_task_to_memberpasses context to members during a normal run, to mirror the pattern: - Assistant
Let me check how the agent's
read_or_create_sessionandload_session_statework when the agent is a team member: - Assistant
Now update the sync non-streaming variant:
- Assistant
Now the sync streaming variant:
- Assistant
Now the async non-streaming variant:
- Assistant
Now the async streaming variant (the one from the issue report):
- Assistant
Now let me verify the team's async
acontinue_run_dispatchproperly loads session_state for the team-level run_context: - Assistant
The routing paths all receive
run_context. Now let's check for existing tests covering this HITL continue flow: - Assistant
Now let me add tests. I'll append a new test section to
test_continue_run_requirements.py: - Assistant
Now run the tests:
- Assistant
All 64 pass. Now run the broader team test suite plus HITL-related tests to check for regressions:
- Assistant
The 2 failures are pre-existing (DB driver env issue), unrelated to this change. Let me also run agent-side continue_run tests:
- Assistant
Now format and validate. Since
.venvdoesn't exist here, let me check available tooling: - Assistant
All checks pass. Let me review the final diff:
- Assistant
The fix is complete and verified. Here's a summary:
Bug
team.acontinue_run()(and the sync/streaming variants) lostsession_stateanddependencieswhen resuming a paused HITL run. When the team routed confirmed requirements back to member agents, the four functions in called / with only — the team's was never restored for the member. Since member agents skip the session DB read when is set (), the member rebuilt an context, so tools reading got .
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.