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
Let me start by exploring the repository structure to understand the codebase.
Assistant
Let me explore the agno library structure to find the relevant code.
Assistant
Let me look at the non-streaming version for comparison.
Assistant
Let me look at where
_aroute_requirements_to_members_streamis called.Assistant
Let me look at the full function and understand what
run_contextshould contain.Assistant
Now let me look at the sync version
_route_requirements_to_members_stream:Assistant
Let me look at the
acontinue_runmethod to understand its parameters:Assistant
Let me look at the agent's
acontinue_run:Assistant
Let me look at the
_aroute_requirements_to_membersfunction in detail and the_acontinue_run_streamfunction:Assistant
Let me check how the team acontinue_run processes dependencies:
Assistant
Let me look at
_acontinue_run_streamto see howrun_contextis used:Assistant
Let me look at the sync
_continue_run_streamto compare:Assistant
Let me look at how
run_contextis processed in_acontinue_runand_acontinue_run_stream:Assistant
Let me look at
_asetup_sessionand related function:Assistant
Let me look at how the agent's acontinue_run_dispatch processes run_context:
Assistant
Let me look at the tests for the continue_run functionality:
Assistant
Let me look at how the user is using dependencies in the team arun:
Assistant
Let me check the git log to see recent changes around the area:
Assistant
Let me look at the existing test setup files:
Assistant
Let me look at the test for
acontinue_run_background_stream:Assistant
Let me look at
_find_member_route_by_idand the_route_requirements_to_membersto understand the call flow:Assistant
Now let me create a script to reproduce the issue:
Assistant
Let me set up a reproduction script:
Assistant
Let me create a more targeted test that uses mocks to exercise the actual code path:
Assistant
Hmm, the print statements inside the function didn't show. Let me check the call flow:
Assistant
The member_id needs to be set on the requirement. Let me update the test:
Assistant
I've reproduced the issue. Now let me look at the issue's suggested fix area to understand the scope better:
Assistant
Now I have a clear understanding of the issue. Let me fix all four functions. Let me start with the async streaming version (the one mentioned in the issue):
Assistant
Now let me fix the
_aroute_requirements_to_members_streamfunction first (the one mentioned in the issue):Assistant
Now let me fix
_aroute_requirements_to_members(async non-streaming):Assistant
Now let me fix
_route_requirements_to_members_stream(sync streaming):Assistant
Let me find the actual content:
Assistant
Now let me fix
_route_requirements_to_members(sync non-streaming):Assistant
Now let me check that
continue_runandacontinue_runboth supportrun_contextfor agent and team:Assistant
Now let me re-run the reproduction script to verify the fix:
Assistant
The fix works. Now let me also write a comprehensive test for all 4 functions:
Assistant
me verify the edge cases:
Assistant
Let me verify the final code looks correct:
Assistant
Let me run the existing tests to make sure I didn't break anything:
Assistant
failure is unrelated to my changes (missing PostgresDb module). Let me run all team tests excluding that:
Assistant
failures are unrelated to my changes. Let me run excluding those:
Assistant
relevant tests pass. Let me also run a broader set of tests to make sure nothing else is broken:
Assistant
Let me focus on the relevant tests:
Assistant
All my changes pass the existing tests. Let me also run the integration tests for the relevant directory:
Assistant
These tests are skipped because OPENAI_API_KEY is not set. Let me set it to a dummy value and try again
Assistant
Let me check the test_team_confirmation_flows.py for tests that don't need a real model:
Assistant
Let me look at the existing test patterns in
test_team_run_regressions.pyand add tests that match the existing patterns:Assistant
Let me check the rest of the test file structure:
Assistant
me look at the issue's example flow once more to understand the exact code path:
Assistant
Let me also run the more focused unit tests one more time to ensure everything is working:
Assistant
Let me also check if there's anything related to the issue's mention of
dependenciesparameter being passed separately:Assistant
Let me run a test that simulates the full flow:
Assistant
All tests pass. Let me also clean up my temporary test scripts:
Assistant
Let me also verify the final state of the routing functions:
Assistant
me see the diff:
Assistant
Let me also run the final unit tests one more time to confirm:
Assistant
All 74 relevant tests pass. Let me also run agent tests:
Assistant
do one final reproduction test that simulates the issue's exact scenario:
Assistant
fix is verified. Let me clean up:
Assistant
Let me do one final verification by running all relevant tests:
Assistant
All 389 tests pass. Let me view the final diff to confirm the changes are clean and minimal:
Assistant
me also check if there are any other places that route member requirements that I might have missed:
Assistant
Let me check if there are any other places that might have similar issues:
Assistant
me also check how the OS router calls the team
acontinue_run:Assistant
verify the file compiles correctly:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.