Skip to content

trading_agent.client.skill_commands

The trading-agent skills commands: list and import.

Typical usage example:

exit_code = SkillCommands(layout, desk_names, passed_environment).run('import', '~/.hermes/skills/research', replace=False)

SkillCommands

SkillCommands(layout, desk_names, passed_environment, output=stdout)

Lists and imports skills for the user.

Creates the commands.

Parameters:

Name Type Description Default
layout WorkspaceLayout

Where the skills are.

required
desk_names Sequence[str]

The desks whose own skills to list.

required
passed_environment Mapping[str, str]

The variables the bash sandbox receives, against which skills' needs are checked.

required
output TextIO

Where to print.

stdout
Source code in src/trading_agent/client/skill_commands.py
def __init__(
    self,
    layout: workspace_layout.WorkspaceLayout,
    desk_names: Sequence[str],
    passed_environment: Mapping[str, str],
    output: TextIO = sys.stdout,
):
    """Creates the commands.

    Args:
        layout (workspace_layout.WorkspaceLayout): Where the skills are.
        desk_names (Sequence[str]): The desks whose own skills to list.
        passed_environment (Mapping[str, str]): The variables the bash sandbox receives, against which skills' needs are checked.
        output (TextIO): Where to print.
    """
    self._layout = layout
    self._desk_names = list(desk_names)
    self._passed_environment = passed_environment
    self._output = output

run

run(action, source, replace)

Runs one action.

Parameters:

Name Type Description Default
action str

"list" or "import".

required
source str | None

For "import", the folder, zip file or git URL.

required
replace bool

For "import", whether to replace installed skills of the same name.

required

Returns:

Type Description
int

0 on success, 1 when the import failed or a skill in it was invalid.

Source code in src/trading_agent/client/skill_commands.py
def run(self, action: str, source: str | None, replace: bool) -> int:
    """Runs one action.

    Args:
        action (str): "list" or "import".
        source (str | None): For "import", the folder, zip file or git URL.
        replace (bool): For "import", whether to replace installed skills of the same name.

    Returns:
        int: 0 on success, 1 when the import failed or a skill in it was invalid.
    """
    if action == 'list':
        self._list()
        return 0
    return self._import(source, replace)