aea.agent_
loop
This module contains the implementation of an agent loop using asyncio.
AgentLoopException Objects
Exception for agent loop runtime errors.
AgentLoopStates Objects
Internal agent loop states.
BaseAgentLoop Objects
Base abstract agent loop class.
__
init__
| __init__(agent: AbstractAgent, loop: Optional[AbstractEventLoop] = None, threaded: bool = False) -> None
Init loop.
Arguments:
agent
: Agent or AEA to run.loop
: optional asyncio event loop. if not specified a new loop will be created.threaded
: if True, run in threaded mode, else async
agent
Get agent.
state
Get current main loop state.
wait_
state
Wait state to be set.
Arguments:
state_or_states
: state or list of states.
Returns:
tuple of previous state and new state.
is_
running
Get running state of the loop.
set_
loop
Set event loop and all event loop related objects.
run
Run agent loop.
send_
to_
skill
| @abstractmethod
| send_to_skill(message_or_envelope: Union[Message, Envelope], context: Optional[EnvelopeContext] = None) -> None
Send message or envelope to another skill.
If message passed it will be wrapped into envelope with optional envelope context.
Arguments:
message_or_envelope
: envelope to send to another skill.context
: envelope context
skill2skill_
queue
Get skill to skill message queue.
AsyncAgentLoop Objects
Asyncio based agent loop suitable only for AEA.
__
init__
Init agent loop.
Arguments:
agent
: AEA instanceloop
: asyncio loop to use. optionalthreaded
: is a new thread to be started for the agent loop
skill2skill_
queue
Get skill to skill message queue.
send_
to_
skill
| send_to_skill(message_or_envelope: Union[Message, Envelope], context: Optional[EnvelopeContext] = None) -> None
Send message or envelope to another skill.
If message passed it will be wrapped into envelope with optional envelope context.
Arguments:
message_or_envelope
: envelope to send to another skill.context
: envelope context