Skip to content

aea.abstract_agent

This module contains the interface definition of the abstract agent.

AbstractAgent Objects

class AbstractAgent(ABC)

This class provides an abstract base interface for an agent.

name

@property
@abstractmethod
def name() -> str

Get agent's name.

storage_uri

@property
@abstractmethod
def storage_uri() -> Optional[str]

Return storage uri.

start

@abstractmethod
def start() -> None

Start the agent.

Returns:

None

stop

@abstractmethod
def stop() -> None

Stop the agent.

Returns:

None

setup

@abstractmethod
def setup() -> None

Set up the agent.

Returns:

None

act

@abstractmethod
def act() -> None

Perform actions on period.

Returns:

None

handle_envelope

@abstractmethod
def handle_envelope(envelope: Envelope) -> None

Handle an envelope.

Arguments:

  • envelope: the envelope to handle.

Returns:

None

get_periodic_tasks

@abstractmethod
def get_periodic_tasks(
) -> Dict[Callable, Tuple[float, Optional[datetime.datetime]]]

Get all periodic tasks for agent.

Returns:

dict of callable with period specified

get_message_handlers

@abstractmethod
def get_message_handlers() -> List[Tuple[Callable[[Any], None], Callable]]

Get handlers with message getters.

Returns:

List of tuples of callables: handler and coroutine to get a message

exception_handler

@abstractmethod
def exception_handler(exception: Exception,
                      function: Callable) -> Optional[bool]

Handle exception raised during agent main loop execution.

Arguments:

  • exception: exception raised
  • function: a callable exception raised in.

Returns:

skip exception if True, otherwise re-raise it

teardown

@abstractmethod
def teardown() -> None

Tear down the agent.

Returns:

None