Skip to content

aea.agent_loop

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

AgentLoopException Objects

class AgentLoopException(AEAException)

Exception for agent loop runtime errors.

AgentLoopStates Objects

class AgentLoopStates(Enum)

Internal agent loop states.

BaseAgentLoop Objects

class BaseAgentLoop(Runnable,  WithLogger,  ABC)

Base abstract agent loop class.

__init__

 | __init__(agent: AbstractAgent, loop: Optional[AbstractEventLoop] = None, threaded=False) -> 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.

agent

 | @property
 | agent() -> AbstractAgent

Get agent.

set_loop

 | set_loop(loop: AbstractEventLoop) -> None

Set event loop and all event loopp related objects.

run

 | async run() -> None

Run agent loop.

state

 | @property
 | state() -> AgentLoopStates

Get current main loop state.

is_running

 | @property
 | is_running() -> bool

Get running state of the loop.

AsyncAgentLoop Objects

class AsyncAgentLoop(BaseAgentLoop)

Asyncio based agent loop suitable only for AEA.

__init__

 | __init__(agent: AbstractAgent, loop: AbstractEventLoop = None, threaded=False)

Init agent loop.

Arguments:

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