aea.runtime
This module contains the implementation of runtime for economic agent (AEA).
RuntimeStates Objects
Runtime states.
BaseRuntime Objects
Abstract runtime class to create implementations.
__
init__
| __init__(agent: AbstractAgent, multiplexer_options: Dict, loop_mode: Optional[str] = None, loop: Optional[AbstractEventLoop] = None, threaded: bool = False, task_manager_mode: Optional[str] = None) -> None
Init runtime.
Arguments:
agent
: Agent to run.multiplexer_options
: options for the multiplexer.loop_mode
: agent main loop mode.loop
: optional event loop. if not provided a new one will be created.threaded
: if True, run in threaded mode, else asynctask_manager_mode
: mode of the task manager.
storage
Get optional storage.
loop_
mode
Get current loop mode.
task_
manager
Get the task manager.
loop
Get event loop.
agent_
loop
Get the agent loop.
multiplexer
Get multiplexer.
is_
running
Get running state of the runtime.
is_
stopped
Get stopped state of the runtime.
state
Get runtime state.
Returns:
RuntimeStates
decision_
maker
Return decision maker if set.
set_
decision_
maker
Set decision maker with handler provided.
set_
loop
Set event loop to be used.
Arguments:
loop
: event loop to use.
AsyncRuntime Objects
Asynchronous runtime: uses asyncio loop for multiplexer and async agent main loop.
__
init__
| __init__(agent: AbstractAgent, multiplexer_options: Dict, loop_mode: Optional[str] = None, loop: Optional[AbstractEventLoop] = None, threaded: bool = False, task_manager_mode: Optional[str] = None) -> None
Init runtime.
Arguments:
agent
: Agent to run.multiplexer_options
: options for the multiplexer.loop_mode
: agent main loop mode.loop
: optional event loop. if not provided a new one will be created.threaded
: if True, run in threaded mode, else asynctask_manager_mode
: mode of the task manager.
set_
loop
Set event loop to be used.
Arguments:
loop
: event loop to use.
run
Start runtime task.
Starts multiplexer and agent loop.
stop_
runtime
Stop runtime coroutine.
Stop main loop. Tear down the agent.. Disconnect multiplexer.
run_
runtime
Run runtime which means start agent loop, multiplexer and storage.
ThreadedRuntime Objects
Run agent and multiplexer in different threads with own asyncio loops.