aea.context.base
This module contains the agent context class.
AgentContext Objects
class AgentContext()
Provide read access to relevant objects of the agent for the skills.
__
init__
| __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 idledger_it_to_currency_denom
: 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.kwargs
: keyword arguments to be attached in the agent context namespace.
send_
to_
skill
| send_to_skill(message_or_envelope: Union[Message, Envelope], context: Optional[EnvelopeContext] = None) -> None
Send message or envelope to another skill.
Arguments:
message_or_envelope
: envelope to send to another skill. if message passed it will be wrapped into envelope with optional envelope context.
Returns:
None
storage
| @property
| storage() -> Optional[Storage]
Return storage instance if enabled in AEA.
data_
dir
| @property
| data_dir() -> str
Return assets directory.
shared_
state
| @property
| shared_state() -> Dict[str, Any]
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.
identity
| @property
| identity() -> Identity
Get the identity.
agent_
name
| @property
| agent_name() -> str
Get agent name.
addresses
| @property
| addresses() -> Dict[str, Address]
Get addresses.
address
| @property
| address() -> Address
Get the default address.
connection_
status
| @property
| connection_status() -> MultiplexerStatus
Get connection status of the multiplexer.
outbox
| @property
| outbox() -> OutBox
Get outbox.
decision_
maker_
message_
queue
| @property
| decision_maker_message_queue() -> Queue
Get decision maker queue.
decision_
maker_
handler_
context
| @property
| decision_maker_handler_context() -> SimpleNamespace
Get the decision maker handler context.
task_
manager
| @property
| task_manager() -> TaskManager
Get the task manager.
search_
service_
address
| @property
| search_service_address() -> Address
Get the address of the search service.
decision_
maker_
address
| @property
| decision_maker_address() -> Address
Get the address of the decision maker.
default_
ledger_
id
| @property
| default_ledger_id() -> str
Get the default ledger id.
currency_
denominations
| @property
| currency_denominations() -> Dict[str, str]
Get a dictionary mapping ledger ids to currency denominations.
default_
connection
| @property
| default_connection() -> Optional[PublicId]
Get the default connection.
default_
routing
| @property
| default_routing() -> Dict[PublicId, PublicId]
Get the default routing.
namespace
| @property
| namespace() -> SimpleNamespace
Get the agent context namespace.