Skip to content

fix: Add RecipientNotFoundError for fine-grained exception handling (#4964)#7882

Open
hsms4710-pixel wants to merge 2 commits into
microsoft:mainfrom
hsms4710-pixel:test/real-workflow-20260624
Open

fix: Add RecipientNotFoundError for fine-grained exception handling (#4964)#7882
hsms4710-pixel wants to merge 2 commits into
microsoft:mainfrom
hsms4710-pixel:test/real-workflow-20260624

Conversation

@hsms4710-pixel

@hsms4710-pixel hsms4710-pixel commented Jun 24, 2026

Copy link
Copy Markdown

Why are these changes needed?

This PR addresses Issue #4964 by adding a fine-grained exception class RecipientNotFoundError for "recipient not found" errors in AutoGen Core.

Currently, when a recipient is not found, a generic Exception is raised, making it difficult to catch specific "recipient not found" errors without catching all exceptions. This PR adds a dedicated exception class for better error handling.

Related issue number

Fixes #4964

Checks

Changes

  • Added RecipientNotFoundError to autogen_core/exceptions.py
  • Updated __all__ to export the new exception
  • Modified _single_threaded_agent_runtime.py to use RecipientNotFoundError instead of generic Exception

Testing

  • Verified that RecipientNotFoundError can be imported and used
  • Verified that it can be caught specifically without catching generic Exception
  • Installed package in development mode and verified it works

Checklist

  • Code follows the project's coding standards
  • Tests have been added/updated (verified exception works correctly)
  • Documentation has been updated (docstring added)

qiyuanjiang added 2 commits June 24, 2026 13:05
…icrosoft#4964)

This PR addresses Issue microsoft#4964 by adding a fine-grained exception class
RecipientNotFoundError for 'recipient not found' errors in AutoGen Core.

Changes:
- Added RecipientNotFoundError to autogen_core/exceptions.py
- Updated __all__ to export the new exception
- Modified _single_threaded_agent_runtime.py to use RecipientNotFoundError
  instead of generic Exception

This allows users to catch specific 'recipient not found' errors without
catching all exceptions.

Fixes microsoft#4964
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.

[Python] Fine-grained exception class for "recipient not found" in Core

1 participant