Skip to content

Commit 6c6e034

Browse files
committed
fix: gracefully handle task exceptions in event consumer
1 parent dec4b48 commit 6c6e034

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/a2a/server/events/event_consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,5 @@ def agent_task_callback(self, agent_task: asyncio.Task[None]) -> None:
160160
agent_task: The asyncio.Task that completed.
161161
"""
162162
logger.debug('Agent task callback triggered.')
163-
if agent_task.exception() is not None:
163+
if not agent_task.cancelled and agent_task.done:
164164
self._exception = agent_task.exception()

0 commit comments

Comments
 (0)