feat: semantically determine goal completion

ref: N25B-432
This commit is contained in:
Twirre Meulenbelt
2026-01-07 17:08:23 +01:00
parent 3189b9fee3
commit aa5b386f65
8 changed files with 380 additions and 163 deletions

View File

@@ -192,7 +192,16 @@ class BaseAgent(ABC):
:param coro: The coroutine to execute as a task.
"""
task = asyncio.create_task(coro)
async def try_coro(coro_: Coroutine):
try:
await coro_
except asyncio.CancelledError:
self.logger.debug("A behavior was canceled successfully: %s", coro_)
except Exception:
self.logger.warning("An exception occurred in a behavior.", exc_info=True)
task = asyncio.create_task(try_coro(coro))
self._tasks.add(task)
task.add_done_callback(self._tasks.discard)
return task