Untitled conversation
- User
[Bug] team.acontinue_run loss dependencies or session_state
Description
team.acontinue_run loss dependencies or session_state
Steps to Reproduce
requires_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
session_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)Agent Configuration (if applicable)
No response
Expected Behavior
in group_del_stock, dependencies["user_token"] or session_state["user_token"] should be not None
Actual Behavior
dependencies["user_token"] or session_state["user_token"] is None
Screenshots or Logs (if applicable)
No response
Environment
agno=2.6.9Possible Solutions (optional)
in _aroute_requirements_to_members_stream, The run_context has not been restored https://github.com/agno-agi/agno/blob/55ba3edd1b4ea230afe8a3fcda39582f8a2178ad/libs/agno/agno/team/_run.py#L5145
Additional Context
No response
Interface
No new interfaces are introduced.
- Assistant
I’ll trace the async team continuation and requirement-routing paths, compare them with sync and agent behavior, then patch the context restoration and add a focused regression test.
- Assistant
rgisn’t installed in this workspace, so I’m using targetedgrep/file inspection instead. - Assistant
The loss occurs at the team-to-member continuation boundary: all four routing variants call the member with only the run/session IDs. The original team context (dependencies, session state, metadata, filters, and user identity) is therefore absent when the confirmed member tool resumes. I’m aligning continuation routing with the existing member-delegation context propagation.
- Assistant
The focused test file is in place, but the prescribed
.venvis absent in this checkout. I’m checking the available local Python environment and will run the narrowest equivalent test/validation commands without installing anything. - Assistant
Both async regression cases now pass, along with the full 51-test continuation-requirements suite. I’m doing formatting/type-lint checks next and reviewing the context-copy semantics for nested members before finalizing.
- Assistant
The repository-wide formatter touched four unrelated pre-existing files. The worktree was clean before this task, so I’m reverting only those formatter-only changes and retaining the two intended files.
- Assistant
Repository-wide validation is still running (the output is buffered); the focused Ruff checks and all continuation tests already pass.
- Assistant
The implementation now passes targeted Ruff, targeted mypy, and the 51 focused tests. Full repository validation reached mypy and stopped on an unrelated pre-existing type error in
knowledge/embedder/jina.py; I’m running the broader team unit suite to catch routing regressions.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →
- fable-5Compare side by side →