Skip to content

aea.configurations.manager

Implementation of the AgentConfigManager.

VariableDoesNotExist Objects

class VariableDoesNotExist(ValueError)

Variable does not exist in a config exception.

handle_dotted_path

handle_dotted_path(value: str, author: str, aea_project_path: Union[str, Path] = ".") -> Tuple[List[str], Path, ConfigLoader, Optional[ComponentId]]

Separate the path between path to resource and json path to attribute.

Allowed values: 'agent.an_attribute_name' 'protocols.my_protocol.an_attribute_name' 'connections.my_connection.an_attribute_name' 'contracts.my_contract.an_attribute_name' 'skills.my_skill.an_attribute_name' 'vendor.author.[protocols|contracts|connections|skills].package_name.attribute_name

We also return the component id to retrieve the configuration of a specific component. Notice that at this point we don't know the version, so we put 'latest' as version, but later we will ignore it because we will filter with only the component prefix (i.e. the triple type, author and name).

Arguments:

  • value: dotted path.
  • author: the author string.
  • aea_project_path: project path

Returns:

Tuple[list of settings dict keys, filepath, config loader, component id].

find_component_directory_from_component_id

find_component_directory_from_component_id(aea_project_directory: Path, component_id: ComponentId) -> Path

Find a component directory from component id.

AgentConfigManager Objects

class AgentConfigManager()

AeaConfig manager.

__init__

 | __init__(agent_config: AgentConfig, aea_project_directory: Union[str, Path], env_vars_friendly: bool = False) -> None

Init manager.

Arguments:

  • agent_config: AgentConfig to manage.
  • aea_project_directory: directory where project for agent_config placed.
  • env_vars_friendly: whether or not it is env vars friendly

load_component_configuration

 | load_component_configuration(component_id: ComponentId, skip_consistency_check: bool = True) -> ComponentConfiguration

Load component configuration from the project directory.

Arguments:

  • component_id: Id of the component to load config for.
  • skip_consistency_check: bool.

Returns:

ComponentConfiguration

agent_config_file_path

 | @property
 | agent_config_file_path() -> Path

Return agent config file path.

load

 | @classmethod
 | load(cls, aea_project_path: Union[Path, str], substitude_env_vars: bool = False) -> "AgentConfigManager"

Create AgentConfigManager instance from agent project path.

set_variable

 | set_variable(path: VariablePath, value: JSON_TYPES) -> None

Set config variable.

Arguments:

  • path: str dotted path or List[Union[ComponentId, str]]
  • value: one of the json friendly objects.

get_variable

 | get_variable(path: VariablePath) -> JSON_TYPES

Set config variable.

Arguments:

  • path: str dotted path or List[Union[ComponentId, str]]

Returns:

json friendly value.

update_config

 | update_config(overrides: Dict) -> None

Apply overrides for agent config.

Validates and applies agent config and component overrides. Does not save it on the disc!

Arguments:

  • overrides: overridden values dictionary

Returns:

None

validate_current_config

 | validate_current_config() -> None

Check is current config valid.

json

 | @property
 | json() -> Dict

Return current agent config json representation.

dump_config

 | dump_config() -> None

Save agent config on the disc.

verify_private_keys

 | @classmethod
 | verify_private_keys(cls, aea_project_path: Union[Path, str], private_key_helper: Callable[[AgentConfig, Path, Optional[str]], None], substitude_env_vars: bool = False, password: Optional[str] = None) -> "AgentConfigManager"

Verify private keys.

Does not saves the config! Use AgentConfigManager.dump_config()

Arguments:

  • aea_project_path: path to an AEA project.
  • private_key_helper: private_key_helper is a function that use agent config to check the keys
  • substitude_env_vars: replace env vars with values, does not dump config
  • password: the password to encrypt/decrypt the private key.

Returns:

the agent configuration manager.

get_overridables

 | get_overridables() -> Tuple[Dict, Dict[ComponentId, Dict]]

Get config overridables.

Back to top