Skip to content

Bug Report: AttributeError: 'NoneType' object has no attribute 'agent_info' #762

@luxunxiansheng

Description

@luxunxiansheng

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.py line 78: info_dict = context.agent_info.get(agent.id(), {}).
  • Occurs during parallel execution of sub-agents (e.g., Scoper, Fetcher) by ArchitectLeader.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions