aea.configurations.base
Classes to handle AEA configurations.
dependencies_
from_
json
dependencies_from_json(obj: Dict[str, Dict]) -> Dependencies
Parse a JSON object to get an instance of Dependencies.
Arguments:
obj
: a dictionary whose keys are package names and values are dictionary with package specifications.
Returns:
a Dependencies object.
dependencies_
to_
json
dependencies_to_json(dependencies: Dependencies) -> Dict[str, Dict]
Transform a Dependencies object into a JSON object.
Arguments:
dependencies
: an instance of "Dependencies" type.
Returns:
a dictionary whose keys are package names and values are the JSON version of a Dependency object.
ProtocolSpecificationParseError Objects
class ProtocolSpecificationParseError(Exception)
Exception for parsing a protocol specification file.
Configuration Objects
class Configuration(JSONSerializable, ABC)
Configuration class.
__
init__
| __init__()
Initialize a configuration object.
from_
json
| @classmethod
| from_json(cls, obj: Dict) -> "Configuration"
Build from a JSON object.
ordered_
json
| @property
| ordered_json() -> OrderedDict
Reorder the dictionary according to a key ordering.
This method takes all the keys in the key_order list and get the associated value in the dictionary (if present). For the remaining keys not considered in the order, it will use alphanumerical ordering.
In particular, if key_order is an empty sequence, this reduces to alphanumerical sorting.
It does not do side-effect.
Returns:
the ordered dictionary.
PackageConfiguration Objects
class PackageConfiguration(Configuration, ABC)
This class represent a package configuration.
A package can be one of: - agents - protocols - connections - skills - contracts
__
init__
| __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None)
Initialize a package configuration.
Arguments:
name
: the name of the package.author
: the author of the package.version
: the version of the package (SemVer format).license_
: the license.aea_version
: either a fixed version, or a set of specifiers describing the AEA versions allowed. (default: empty string - no constraint). The fixed version is interpreted with the specifier '=='.fingerprint
: the fingerprint.fingerprint_ignore_patterns
: a list of file patterns to ignore files to fingerprint.build_entrypoint
: path to a script to execute at build time.
name
| @property
| name() -> str
Get the name.
name
| @name.setter
| name(value: SimpleIdOrStr)
Set the name.
author
| @property
| author() -> str
Get the author.
author
| @author.setter
| author(value: SimpleIdOrStr)
Set the author.
aea_
version
| @property
| aea_version()
Get the 'aea_version' attribute.
aea_
version
| @aea_version.setter
| aea_version(new_aea_version: str)
Set the 'aea_version' attribute.
directory
| @property
| directory() -> Optional[Path]
Get the path to the configuration file associated to this file, if any.
directory
| @directory.setter
| directory(directory: Path) -> None
Set directory if not already set.
package_
id
| @property
| package_id() -> PackageId
Get package id.
aea_
version_
specifiers
| @property
| aea_version_specifiers() -> SpecifierSet
Get the AEA version set specifier.
public_
id
| @property
| public_id() -> PublicId
Get the public id.
package_
dependencies
| @property
| package_dependencies() -> Set[ComponentId]
Get the package dependencies.
update
| update(data: Dict, env_vars_friendly: bool = False) -> None
Update configuration with other data.
Arguments:
data
: the data to replace.
Returns:
None
validate_
config_
data
| @classmethod
| validate_config_data(cls, json_data: Dict, env_vars_friendly: bool = False) -> None
Perform config validation.
from_
json
| @classmethod
| from_json(cls, obj: Dict)
Initialize from a JSON object.
make_
resulting_
config_
data
| make_resulting_config_data(overrides: Dict) -> Dict
Make config data with overrides applied.
Does not update config, just creates json representation
check_
overrides_
valid
| check_overrides_valid(overrides: Dict, env_vars_friendly: bool = False) -> None
Check overrides is correct, return list of errors if present.
get_
overridable
| get_overridable() -> dict
Get dictionary of values that can be updated for this config.
ComponentConfiguration Objects
class ComponentConfiguration(PackageConfiguration, ABC)
Class to represent an agent component configuration.
__
init__
| __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, build_directory: Optional[str] = None, dependencies: Optional[Dependencies] = None)
Set component configuration.
build_
directory
| @property
| build_directory() -> Optional[str]
Get the component type.
build_
directory
| @build_directory.setter
| build_directory(value: Optional[str]) -> None
Get the component type.
component_
type
| @property
| component_type() -> ComponentType
Get the component type.
component_
id
| @property
| component_id() -> ComponentId
Get the component id.
prefix_
import_
path
| @property
| prefix_import_path() -> str
Get the prefix import path for this component.
is_
abstract_
component
| @property
| is_abstract_component() -> bool
Check whether the component is abstract.
check_
fingerprint
| check_fingerprint(directory: Path) -> None
Check that the fingerprint are correct against a directory path.
:raises ValueError if: - the argument is not a valid package directory - the fingerprints do not match.
check_
aea_
version
| check_aea_version()
Check that the AEA version matches the specifier set.
:raises ValueError if the version of the aea framework falls within a specifier.
check_
public_
id_
consistency
| check_public_id_consistency(directory: Path) -> None
Check that the public ids in the init file match the config.
:raises ValueError if: - the argument is not a valid package directory - the public ids do not match.
ConnectionConfig Objects
class ConnectionConfig(ComponentConfiguration)
Handle connection configuration.
__
init__
| __init__(name: SimpleIdOrStr = "", author: SimpleIdOrStr = "", version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, build_directory: Optional[str] = None, class_name: str = "", protocols: Optional[Set[PublicId]] = None, connections: Optional[Set[PublicId]] = None, restricted_to_protocols: Optional[Set[PublicId]] = None, excluded_protocols: Optional[Set[PublicId]] = None, dependencies: Optional[Dependencies] = None, description: str = "", connection_id: Optional[PublicId] = None, is_abstract: bool = False, cert_requests: Optional[List[CertRequest]] = None, **config, ,)
Initialize a connection configuration object.
package_
dependencies
| @property
| package_dependencies() -> Set[ComponentId]
Get the connection dependencies.
is_
abstract_
component
| @property
| is_abstract_component() -> bool
Check whether the component is abstract.
json
| @property
| json() -> Dict
Return the JSON representation.
ProtocolConfig Objects
class ProtocolConfig(ComponentConfiguration)
Handle protocol configuration.
__
init__
| __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, build_directory: Optional[str] = None, aea_version: str = "", dependencies: Optional[Dependencies] = None, description: str = "")
Initialize a connection configuration object.
json
| @property
| json() -> Dict
Return the JSON representation.
SkillComponentConfiguration Objects
class SkillComponentConfiguration()
This class represent a skill component configuration.
__
init__
| __init__(class_name: str, **args)
Initialize a skill component configuration.
Arguments:
skill_component_type
: the skill component type.class_name
: the class name of the component.args
: keyword arguments.
json
| @property
| json() -> Dict
Return the JSON representation.
from_
json
| @classmethod
| from_json(cls, obj: Dict) -> "SkillComponentConfiguration"
Initialize from a JSON object.
SkillConfig Objects
class SkillConfig(ComponentConfiguration)
Class to represent a skill configuration file.
__
init__
| __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, build_directory: Optional[str] = None, connections: Optional[Set[PublicId]] = None, protocols: Optional[Set[PublicId]] = None, contracts: Optional[Set[PublicId]] = None, skills: Optional[Set[PublicId]] = None, dependencies: Optional[Dependencies] = None, description: str = "", is_abstract: bool = False)
Initialize a skill configuration.
package_
dependencies
| @property
| package_dependencies() -> Set[ComponentId]
Get the skill dependencies.
is_
abstract_
component
| @property
| is_abstract_component() -> bool
Check whether the component is abstract.
json
| @property
| json() -> Dict
Return the JSON representation.
get_
overridable
| get_overridable() -> dict
Get overrideable confg data.
AgentConfig Objects
class AgentConfig(PackageConfiguration)
Class to represent the agent configuration file.
__
init__
| __init__(agent_name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, registry_path: str = DEFAULT_REGISTRY_NAME, description: str = "", logging_config: Optional[Dict] = None, period: Optional[float] = None, execution_timeout: Optional[float] = None, max_reactions: Optional[int] = None, error_handler: Optional[Dict] = None, decision_maker_handler: Optional[Dict] = None, skill_exception_policy: Optional[str] = None, connection_exception_policy: Optional[str] = None, default_ledger: Optional[str] = None, currency_denominations: Optional[Dict[str, str]] = None, default_connection: Optional[str] = None, default_routing: Optional[Dict[str, str]] = None, loop_mode: Optional[str] = None, runtime_mode: Optional[str] = None, storage_uri: Optional[str] = None, component_configurations: Optional[Dict[ComponentId, Dict]] = None)
Instantiate the agent configuration object.
component_
configurations
| @property
| component_configurations() -> Dict[ComponentId, Dict]
Get the custom component configurations.
component_
configurations
| @component_configurations.setter
| component_configurations(d: Dict[ComponentId, Dict]) -> None
Set the component configurations.
package_
dependencies
| @property
| package_dependencies() -> Set[ComponentId]
Get the package dependencies.
private_
key_
paths_
dict
| @property
| private_key_paths_dict() -> Dict[str, str]
Get dictionary version of private key paths.
connection_
private_
key_
paths_
dict
| @property
| connection_private_key_paths_dict() -> Dict[str, str]
Get dictionary version of connection private key paths.
component_
configurations_
json
| component_configurations_json() -> List[OrderedDict]
Get the component configurations in JSON format.
json
| @property
| json() -> Dict
Return the JSON representation.
all_
components_
id
| @property
| all_components_id() -> List[ComponentId]
Get list of the all components for this agent config.
update
| update(data: Dict, env_vars_friendly: bool = False) -> None
Update configuration with other data.
To update the component parts, populate the field "component_configurations" as a mapping from ComponentId to configurations.
Arguments:
data
: the data to replace.
Returns:
None
SpeechActContentConfig Objects
class SpeechActContentConfig(Configuration)
Handle a speech_act content configuration.
__
init__
| __init__(**args)
Initialize a speech_act content configuration.
json
| @property
| json() -> Dict
Return the JSON representation.
from_
json
| @classmethod
| from_json(cls, obj: Dict)
Initialize from a JSON object.
ProtocolSpecification Objects
class ProtocolSpecification(ProtocolConfig)
Handle protocol specification.
__
init__
| __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", description: str = "")
Initialize a protocol specification configuration object.
protobuf_
snippets
| @property
| protobuf_snippets() -> Dict
Get the protobuf snippets.
protobuf_
snippets
| @protobuf_snippets.setter
| protobuf_snippets(protobuf_snippets: Dict)
Set the protobuf snippets.
dialogue_
config
| @property
| dialogue_config() -> Dict
Get the dialogue config.
dialogue_
config
| @dialogue_config.setter
| dialogue_config(dialogue_config: Dict)
Set the dialogue config.
json
| @property
| json() -> Dict
Return the JSON representation.
ContractConfig Objects
class ContractConfig(ComponentConfiguration)
Handle contract configuration.
__
init__
| __init__(name: SimpleIdOrStr, author: SimpleIdOrStr, version: str = "", license_: str = "", aea_version: str = "", fingerprint: Optional[Dict[str, str]] = None, fingerprint_ignore_patterns: Optional[Sequence[str]] = None, build_entrypoint: Optional[str] = None, build_directory: Optional[str] = None, dependencies: Optional[Dependencies] = None, description: str = "", contract_interface_paths: Optional[Dict[str, str]] = None, class_name: str = "")
Initialize a protocol configuration object.
json
| @property
| json() -> Dict
Return the JSON representation.