aea.agent_loop

This module contains the implementation of an agent loop using asyncio.

BaseAgentLoop Objects

class BaseAgentLoop(ABC)

Base abstract agent loop class.

__init__

 | __init__(agent: "Agent", loop: Optional[AbstractEventLoop] = None) -> None

Init loop.

:params agent: Agent or AEA to run. :params loop: optional asyncio event loop. if not specified a new loop will be created.

set_loop

 | set_loop(loop: AbstractEventLoop) -> None

Set event loop and all event loopp related objects.

start

 | start() -> None

Start agent loop synchronously in own asyncio loop.

run_loop

 | async run_loop() -> None

Run agent loop.

wait_run_loop_stopped

 | async wait_run_loop_stopped() -> None

Wait all tasks stopped.

stop

 | stop() -> None

Stop agent loop.

is_running

 | @property
 | is_running() -> bool

Get running state of the loop.

AgentLoopException Objects

class AgentLoopException(AEAException)

Exception for agent loop runtime errors.

AgentLoopStates Objects

class AgentLoopStates(Enum)

Internal agent loop states.

AsyncAgentLoop Objects

class AsyncAgentLoop(BaseAgentLoop)

Asyncio based agent loop suitable only for AEA.

__init__

 | __init__(agent: "AEA", loop: AbstractEventLoop = None)

Init agent loop.

Arguments:

  • agent: AEA instance
  • loop: asyncio loop to use. optional

SyncAgentLoop Objects

class SyncAgentLoop(BaseAgentLoop)

Synchronous agent loop.

__init__

 | __init__(agent: "Agent", loop: AbstractEventLoop = None)

Init agent loop.

Arguments:

  • agent: AEA instance
  • loop: asyncio loop to use. optional