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

 | @abstractproperty
 | name() -> str

Get agent's name.

storage_uri

 | @abstractproperty
 | storage_uri() -> Optional[str]

Return storage uri.

start

 | @abstractmethod
 | start() -> None

Start the agent.

Returns:

None

stop

 | @abstractmethod
 | stop() -> None

Stop the agent.

Returns:

None

setup

 | @abstractmethod
 | setup() -> None

Set up the agent.

Returns:

None

act

 | @abstractmethod
 | act() -> None

Perform actions on period.

Returns:

None

handle_envelope

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

Handle an envelope.

Arguments:

  • envelope: the envelope to handle.

Returns:

None

get_periodic_tasks

 | @abstractmethod
 | 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
 | 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
 | 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
 | teardown() -> None

Tear down the agent.

Returns:

None

Back to top