Skip to content

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__() -> None

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) -> 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) -> None

Set the name.

author

 | @property
 | author() -> str

Get the author.

author

 | @author.setter
 | author(value: SimpleIdOrStr) -> None

Set the author.

aea_version

 | @property
 | aea_version() -> str

Get the 'aea_version' attribute.

aea_version

 | @aea_version.setter
 | aea_version(new_aea_version: str) -> None

Set the 'aea_version' attribute.

check_aea_version

 | check_aea_version() -> None

Check that the AEA version matches the specifier set.

:raises ValueError if the version of the aea framework falls within a specifier.

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.

parse_aea_version_specifier

 | @staticmethod
 | parse_aea_version_specifier(aea_version_specifiers: str) -> SpecifierSet

Parse an 'aea_version' field.

If 'aea_version' is a version, then output the specifier set "==${version}" Else, interpret it as specifier set.

Arguments:

  • aea_version_specifiers: the AEA version, or a specifier set.

Returns:

A specifier set object.

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.
  • env_vars_friendly: whether or not it is env vars friendly.

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) -> "PackageConfiguration"

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.

Arguments:

  • overrides: the overrides

Returns:

config with overrides applied

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) -> 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.

Arguments:

  • directory: the directory path.

Raises:

  • ValueError: if
    • the argument is not a valid package directory
    • the fingerprints do not match.

check_public_id_consistency

 | check_public_id_consistency(directory: Path) -> None

Check that the public ids in the init file match the config.

Arguments:

  • directory: the directory path.

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: Any, ,) -> None

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 = "", protocol_specification_id: Optional[str] = None) -> None

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, file_path: Optional[str] = None, **args: Any) -> None

Initialize a skill component configuration.

Arguments:

  • class_name: the class name of the component.
  • file_path: the file path.
  • 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) -> None

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 overridable configuration 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, 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, required_ledgers: Optional[List[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, task_manager_mode: Optional[str] = None, storage_uri: Optional[str] = None, data_dir: Optional[str] = None, component_configurations: Optional[Dict[ComponentId, Dict]] = None, dependencies: Optional[Dependencies] = None) -> 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.
  • env_vars_friendly: whether or not it is env vars friendly.

SpeechActContentConfig Objects

class SpeechActContentConfig(Configuration)

Handle a speech_act content configuration.

__init__

 | __init__(**args: Any) -> None

Initialize a speech_act content configuration.

json

 | @property
 | json() -> Dict

Return the JSON representation.

from_json

 | @classmethod
 | from_json(cls, obj: Dict) -> "SpeechActContentConfig"

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 = "", protocol_specification_id: Optional[str] = None) -> None

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) -> None

Set the protobuf snippets.

dialogue_config

 | @property
 | dialogue_config() -> Dict

Get the dialogue config.

dialogue_config

 | @dialogue_config.setter
 | dialogue_config(dialogue_config: Dict) -> None

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 = "") -> None

Initialize a protocol configuration object.

json

 | @property
 | json() -> Dict

Return the JSON representation.

AEAVersionError Objects

class AEAVersionError(ValueError)

Special Exception for version error.

__init__

 | __init__(package_id: PublicId, aea_version_specifiers: SpecifierSet) -> None

Init exception.