Skip to content

hotfix: Fix agent-not-found errors: only route refinement to registered agents#602

Open
gsarchioni wants to merge 1 commit intoed-donner:mainfrom
gsarchioni:fix/autogent-creator
Open

hotfix: Fix agent-not-found errors: only route refinement to registered agents#602
gsarchioni wants to merge 1 commit intoed-donner:mainfrom
gsarchioni:fix/autogent-creator

Conversation

@gsarchioni
Copy link

@gsarchioni gsarchioni commented Feb 15, 2026

Problem

When an agent tried to bounce an idea off another agent, the runtime could log:
ERROR:autogen_core:Agent agent2 not found, failed to deliver message.

find_recipient() was choosing from every agent*.py file on disk. With many concurrent requests, some agents (e.g. agent20) are registered and run before others (e.g. agent2). Picking agent2 before it was registered caused the delivery failure.

Solution

  • Track registered agents: Introduced REGISTERED_AGENTS and register_agent() in messages.py. The Creator calls register_agent(agent_name) after each successful registration with the runtime.
  • Route only to registered agents: find_recipient() now selects only from REGISTERED_AGENTS instead of from all agent*.py files.
  • Exclude self and handle no recipient: find_recipient(exclude=...) excludes the current agent so we don’t send to ourselves. It returns None when there is no valid recipient; the agent then skips the bounce and returns its idea as-is.
  • Cleanup: Removed the unused (and broken) from agent import Agent in world.py; the module only defines AgentCreator.

Files changed

  • messages.pyREGISTERED_AGENTS, register_agent(), find_recipient(exclude) with registered-only selection
  • creator.py – call messages.register_agent(agent_name) after registering an agent
  • agent.py – use find_recipient(exclude=self.id.type) and only bounce when recipient is not None
  • world.py – remove invalid Agent import

@gsarchioni
Copy link
Author

Hi @ed-donner - please review this PR. I noticed an issue with the autogen final project when an agent*.py created but have not been registered to the runtime before another agent calls it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments