Skip to content

Package management

aica_challenge_1.package_manager.InstalledAgent dataclass

A dataclass tracking information about an installed challenge-compatible agent.

Parameters:

Name Type Description Default
name str

A unique name of the agent.

required
package str

A name of the package which the agent is a part of. Multiple agents can be in one package.

required
description str

A description of an agent.

required

aica_challenge_1.package_manager.InstalledPackage dataclass

A dataclass tracking information about installed packages that contain challenge-compatible agents.

Parameters:

Name Type Description Default
name str

A name of the package.

required
path str

A full path to the package as returned by the module_finder.

required
dir str

A directory parth of the path.

required
version str

A version of the package.

required
description str

A description of the package.

required

aica_challenge_1.package_manager.PackageManager

Package manager provides convenience functions for initializing, installing and removing agents. Be aware that these are really just convenience functions and rely on the underlying package management system (i.e., Poetry). Therefore if you have an agent that exists as a separate package somewhere (e.g., https://pypi.org/project/aica-challenge-1-heuristic-agent/), you can simply install it via poetry and it will work as if you used this package manager.

list_available_packages() -> List[str]

Provides a list of packages that are available for installation in the agents directory of the challenge.

Returns:

Type Description
List[str]

A list of available packages.

list_installed_packages() -> List[InstalledPackage]

Provides a list of packages installed in the current virtual environment from the agents directory of the challenge.

Returns:

Type Description
List[InstalledPackage]

A list of installed packages.

install_package(name: str) -> Tuple[bool, str, str]

Attempts to install a package from the given path.

Parameters:

Name Type Description Default
name str

A name of the package that should be the same as a name of a directory in the agents folder of the challenge. While you can escape the directory with '..' I suggest not to do it.

required

Returns:

Type Description
Tuple[bool, str, str]

A tuple indicating whether the installation was successful [0] and if not, also providing the stdout [1] and stderr [2].

install_all() -> bool

Attempts to install all available packages in the agents directory.

Returns:

Type Description
bool

True on success, False otherwise.

remove_package(name: str) -> Tuple[bool, str, str]

Attempts to remove a package by name. Be aware that this has to be a package name and not a path to the package. As this is just a thin wrapper over poetry, it will happily remove any package in the current virtual environment.

Parameters:

Name Type Description Default
name str

A name of the package to remove.

required

Returns:

Type Description
Tuple[bool, str, str]

A tuple indicating whether the removal was successful [0] and if not, also providing the stdout [1] and stderr [2].

remove_all() -> bool

Attempts to remove all packages in the agents directory from the current virtual environment.

Returns:

Type Description
bool

True on success, False otherwise.

list_installed_agents() -> Dict[str, InstalledAgent] staticmethod

Provides a list of challenge-compatible agents that are installed in the current virtual environment.

Returns:

Type Description
Dict[str, InstalledAgent]

A dictionary, where the key is an agent name and the value is the agent description structure.

init_agent(agent_name: str) -> Tuple[bool, str]

Initializes an agent's skeleton in the agents directory of the current challenge.

Parameters:

Name Type Description Default
agent_name str

A desired name of the agent.

required

Returns:

Type Description
Tuple[bool, str]

Tuple indicating whether the initialization was successful [0] and its normalized PEP-compliant name [1].