-
Notifications
You must be signed in to change notification settings - Fork 118
Description
Bug Report: AttributeError: 'NoneType' object has no attribute 'agent_info'
Summary
The aworld framework encountered an AttributeError: 'NoneType' object has no attribute 'agent_info' error during the execution of ParallelizableAgent (specifically ArchitectLeader). This error occurred because message.context was None when passed to exec_agent via ParallelizableAgent.async_policy, causing a crash when exec_agent attempted to access context.agent_info.
Symptoms
AttributeError: 'NoneType' object has no attribute 'agent_info'- Stack trace points to
libs/aworld/aworld/utils/run_util.pyline 78:info_dict = context.agent_info.get(agent.id(), {}). - Occurs during parallel execution of sub-agents (e.g.,
Scoper,Fetcher) byArchitectLeader.
Root Cause Analysis
In libs/aworld/aworld/agents/parallel_llm_agent.py, the async_policy method calls exec_agent asynchronously for each sub-agent.
exec_agent(observation.content, agent=agent, context=message.context, sub_task=True)While BaseAgent.async_run validates message.context before calling async_policy, it appears that in some execution paths (possibly direct calls or asynchronous context loss), message.context evaluates to None at the time of the exec_agent call. This leads to exec_agent receiving None as the implementation of Context and crashing.
Fix
Two fixes were applied to robustly handle context propagation and error reporting:
1. Robust Context Check in ParallelizableAgent
Modified libs/aworld/aworld/agents/parallel_llm_agent.py to explicitly check if message.context is valid before spawning sub-tasks. If context is missing, it logs an error.
2. Guard Clause in exec_agent
Modified libs/aworld/aworld/utils/run_util.py to raise a descriptive ValueError if context is None, instead of allowing the confusing AttributeError to propagate.