Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from ._subscription import Subscription
from ._telemetry import EnvelopeMetadata, MessageRuntimeTracingConfig, TraceHelper, get_telemetry_envelope_metadata
from ._topic import TopicId
from .exceptions import MessageDroppedException
from .exceptions import MessageDroppedException, RecipientNotFoundError

logger = logging.getLogger("autogen_core")
event_logger = logging.getLogger("autogen_core.events")
Expand Down Expand Up @@ -362,7 +362,7 @@ async def send_message(
):
future = asyncio.get_event_loop().create_future()
if recipient.type not in self._known_agent_names:
future.set_exception(Exception("Recipient not found"))
future.set_exception(RecipientNotFoundError("Recipient not found"))
return await future

content = message.__dict__ if hasattr(message, "__dict__") else message
Expand Down
10 changes: 9 additions & 1 deletion python/packages/autogen-core/src/autogen_core/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__all__ = ["CantHandleException", "UndeliverableException", "MessageDroppedException", "NotAccessibleError"]
__all__ = ["CantHandleException", "UndeliverableException", "MessageDroppedException", "NotAccessibleError", "RecipientNotFoundError"]


class CantHandleException(Exception):
Expand All @@ -15,3 +15,11 @@ class MessageDroppedException(Exception):

class NotAccessibleError(Exception):
"""Tried to access a value that is not accessible. For example if it is remote cannot be accessed locally."""


class RecipientNotFoundError(Exception):
"""Raised when a recipient agent is not found in the runtime.

This exception provides a fine-grained way to handle cases where a message
is sent to an agent that hasn't been registered in the runtime yet.
"""
19 changes: 19 additions & 0 deletions python/packages/autogen-ext/tests/test_workflow_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
Workflow Demo Test

This file demonstrates the automated contribution workflow.
"""

def test_demo():
"""Demo test for workflow demonstration"""
# This is a simple test to demonstrate the workflow
# In a real fix, this would contain actual test logic
assert True

def test_encoding_example():
"""Example test for encoding-related fixes"""
# Example: test that UTF-8 encoding works
test_str = "测试 🚀"
encoded = test_str.encode("utf-8")
decoded = encoded.decode("utf-8")
assert decoded == test_str