aea.context.base¶
This module contains the agent context class.
AgentContext Objects¶
Provide read access to relevant objects of the agent for the skills.
__
init__
¶
def __init__(identity: Identity,
connection_status: MultiplexerStatus,
outbox: OutBox,
decision_maker_message_queue: Queue,
decision_maker_handler_context: SimpleNamespace,
task_manager: TaskManager,
default_ledger_id: str,
currency_denominations: Dict[str, str],
default_connection: Optional[PublicId],
default_routing: Dict[PublicId, PublicId],
search_service_address: Address,
decision_maker_address: Address,
data_dir: str,
storage_callable: Callable[[], Optional[Storage]] = lambda: None,
send_to_skill: Optional[Callable] = None,
**kwargs: Any) -> None
Initialize an agent context.
Arguments:
identity
: the identity objectconnection_status
: the connection status of the multiplexeroutbox
: the outboxdecision_maker_message_queue
: the (in) queue of the decision makerdecision_maker_handler_context
: the decision maker's name spacetask_manager
: the task managerdefault_ledger_id
: the default ledger idcurrency_denominations
: mapping from ledger ids to currency denominationsdefault_connection
: the default connectiondefault_routing
: the default routingsearch_service_address
: the address of the search servicedecision_maker_address
: the address of the decision makerdata_dir
: directory where to put local files.storage_callable
: function that returns optional storage attached to agent.send_to_skill
: callable for sending envelopes to skills.kwargs
: keyword arguments to be attached in the agent context namespace.
send_
to_
skill¶
def 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
: the optional envelope context
storage¶
Return storage instance if enabled in AEA.
data_
dir¶
Return assets directory.
shared_
state¶
Get the shared state dictionary.
The shared state is the only object which skills can use to exchange state directly. It is accessible (read and write) from all skills.
Returns:
dictionary of the shared state.
identity¶
Get the identity.
agent_
name¶
Get agent name.
addresses¶
Get addresses.
public_
keys¶
Get public keys.
address¶
Get the default address.
public_
key¶
Get the default public key.
connection_
status¶
Get connection status of the multiplexer.
outbox¶
Get outbox.
decision_
maker_
message_
queue¶
Get decision maker queue.
decision_
maker_
handler_
context¶
Get the decision maker handler context.
task_
manager¶
Get the task manager.
search_
service_
address¶
Get the address of the search service.
decision_
maker_
address¶
Get the address of the decision maker.
default_
ledger_
id¶
Get the default ledger id.
currency_
denominations¶
Get a dictionary mapping ledger ids to currency denominations.
default_
connection¶
Get the default connection.
default_
routing¶
Get the default routing.
namespace¶
Get the agent context namespace.