Merge branch 'feat/norms-and-goals-program' into docs/docs-cb

This commit is contained in:
2025-11-25 12:04:33 +01:00
11 changed files with 28 additions and 61 deletions

View File

@@ -1,6 +1,7 @@
import asyncio
import logging
from abc import ABC, abstractmethod
from asyncio import Task
from collections.abc import Coroutine
import zmq
@@ -102,8 +103,8 @@ class BaseAgent(ABC):
await self.setup()
# Start processing inbox and ZMQ messages
await self.add_behavior(self._process_inbox())
await self.add_behavior(self._receive_internal_zmq_loop())
self.add_behavior(self._process_inbox())
self.add_behavior(self._receive_internal_zmq_loop())
async def stop(self):
"""
@@ -182,7 +183,7 @@ class BaseAgent(ABC):
"""
raise NotImplementedError
async def add_behavior(self, coro: Coroutine):
def add_behavior(self, coro: Coroutine) -> Task:
"""
Add a background behavior (task) to the agent.
@@ -194,3 +195,4 @@ class BaseAgent(ABC):
task = asyncio.create_task(coro)
self._tasks.add(task)
task.add_done_callback(self._tasks.discard)
return task