A programming framework for agentic AI
prevent publish to self (#29)
Jack Gerritsf4a5835772ae
diff --git a/src/agnext/application_components/_single_threaded_agent_runtime.py b/src/agnext/application_components/_single_threaded_agent_runtime.pyindex 35d67446c..bbd654331 100644--- a/src/agnext/application_components/_single_threaded_agent_runtime.py+++ b/src/agnext/application_components/_single_threaded_agent_runtime.py@@ -143,6 +143,8 @@ class SingleThreadedAgentRuntime(AgentRuntime):async def _process_publish(self, message_envelope: PublishMessageEnvelope) -> None:responses: List[Awaitable[Any]] = []for agent in self._per_type_subscribers.get(type(message_envelope.message), []): # type: ignore+ if message_envelope.sender is not None and agent.name == message_envelope.sender.name:+ continuefuture = agent.on_message(message_envelope.message,cancellation_token=message_envelope.cancellation_token,