aea.registries.base
This module contains registries.
Registry Objects
This class implements an abstract registry.
__
init__
Initialize the registry.
Arguments:
agent_name
: the name of the agent
register
| @abstractmethod
| register(item_id: ItemId, item: Item, is_dynamically_added: bool = False) -> None
Register an item.
Arguments:
item_id
: the public id of the item.item
: the item.is_dynamically_added
: whether or not the item is dynamically added.
Returns:
None :raises: ValueError if an item is already registered with that item id.
unregister
Unregister an item.
Arguments:
item_id
: the public id of the item.
Returns:
the item :raises: ValueError if no item registered with that item id.
fetch
Fetch an item.
Arguments:
item_id
: the public id of the item.
Returns:
the Item
fetch_
all
Fetch all the items.
Returns:
the list of items.
ids
Return the set of all the used item ids.
Returns:
the set of item ids.
setup
Set up registry.
Returns:
None
teardown
Teardown the registry.
Returns:
None
PublicIdRegistry Objects
This class implement a registry whose keys are public ids.
In particular, it is able to handle the case when the public id points to the 'latest' version of a package.
__
init__
Initialize the registry.
register
Register an item.
unregister
Unregister an item.
fetch
Fetch an item associated with a public id.
Arguments:
public_id
: the public id.
Returns:
an item, or None if the key is not present.
fetch_
all
Fetch all the items.
ids
Get all the item ids.
setup
Set up the items.
teardown
Tear down the items.
AgentComponentRegistry Objects
This class implements a simple dictionary-based registry for agent components.
__
init__
Instantiate the registry.
Arguments:
kwargs
: kwargs
register
| register(component_id: ComponentId, component: Component, is_dynamically_added: bool = False) -> None
Register a component.
Arguments:
component_id
: the id of the component.component
: the component object.is_dynamically_added
: whether or not the item is dynamically added.
unregister
Unregister a component.
Arguments:
component_id
: the ComponentId
Returns:
the item
fetch
Fetch the component by id.
Arguments:
component_id
: the contract id
Returns:
the component or None if the component is not registered
fetch_
all
Fetch all the components.
Returns:
the list of registered components.
fetch_
by_
type
Fetch all the components by a given type..
Arguments:
component_type
: a component type
Returns:
the list of registered components of a given type.
ids
Get the item ids.
setup
Set up the registry.
teardown
Teardown the registry.
ComponentRegistry Objects
class ComponentRegistry(
Registry[Tuple[PublicId, str], SkillComponentType], Generic[SkillComponentType])
This class implements a generic registry for skill components.
__
init__
Instantiate the registry.
Arguments:
kwargs
: kwargs
register
| register(item_id: Tuple[PublicId, str], item: SkillComponentType, is_dynamically_added: bool = False) -> None
Register a item.
Arguments:
item_id
: a pair (skill id, item name).item
: the item to register.is_dynamically_added
: whether or not the item is dynamically added. :raises: ValueError if an item is already registered with that item id.
unregister
Unregister a item.
Arguments:
item_id
: a pair (skill id, item name).
Returns:
skill component :raises: ValueError if no item registered with that item id.
fetch
Fetch an item.
Arguments:
item_id
: the public id of the item.
Returns:
the Item
fetch_
by_
skill
Fetch all the items of a given skill.
fetch_
all
Fetch all the items.
unregister_
by_
skill
Unregister all the components by skill.
ids
Get the item ids.
setup
Set up the items in the registry.
teardown
Teardown the registry.
HandlerRegistry Objects
This class implements the handlers registry.
__
init__
Instantiate the registry.
Arguments:
kwargs
: kwargs
register
| register(item_id: Tuple[PublicId, str], item: Handler, is_dynamically_added: bool = False) -> None
Register a handler.
Arguments:
item_id
: the item id.item
: the handler.is_dynamically_added
: whether or not the item is dynamically added.
Raises:
ValueError
: if the protocol is None, or an item with pair (skill_id, protocol_id_ already exists.
unregister
Unregister a item.
Arguments:
item_id
: a pair (skill id, item name).
Returns:
the unregistered handler :raises: ValueError if no item is registered with that item id.
unregister_
by_
skill
Unregister all the components by skill.
fetch_
by_
protocol
Fetch the handler by the pair protocol id and skill id.
Arguments:
protocol_id
: the protocol id
Returns:
the handlers registered for the protocol_id and skill_id
fetch_
by_
protocol_
and_
skill
Fetch the handler by the pair protocol id and skill id.
Arguments:
protocol_id
: the protocol idskill_id
: the skill id.
Returns:
the handlers registered for the protocol_id and skill_id