trading_agent.extensions.package_installer
¶
Installs and removes packages: trading-agent packages install|remove.
Installing copies the package's folder into workspace/shared/packages/
Typical usage example:
report = PackageInstaller(packages).install('https://github.com/someone/news-pack.git', replace=False)
PackageError
¶
Bases: RuntimeError
A package could not be installed or removed, with the reason.
InstallReport
dataclass
¶
What one install did.
Attributes:
| Name | Type | Description |
|---|---|---|
summary |
PackageSummary
|
The installed package's contents. |
replaced |
bool
|
Whether an installed package of the same name was replaced. |
warnings |
tuple[str, ...]
|
Passages that look like prompt injection, and hook files that cannot run. |
PackageInstaller
¶
Installs packages into the packages folder.
Creates the installer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
packages
|
InstalledPackages
|
The installed packages. |
required |
Source code in src/trading_agent/extensions/package_installer.py
install
¶
Installs a package from a folder, a zip file or a git URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
The package. |
required |
replace
|
bool
|
Whether to replace an installed package of the same name. |
required |
Returns:
| Type | Description |
|---|---|
InstallReport
|
What was installed. |
Raises:
| Type | Description |
|---|---|
PackageError
|
The source cannot be fetched, holds no package part, has an invalid name or mcp_servers.json, or is already installed. |
Source code in src/trading_agent/extensions/package_installer.py
remove
¶
Deletes an installed package's folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The package's name. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
The folder that was deleted. |
Raises:
| Type | Description |
|---|---|
PackageError
|
No package of that name is installed. |