Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion agentstack/generation/tool_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def add_tool(tool_name: str, path: Optional[str] = None):
insert_code_after_tag(f'{path}.env', '# Tools', [tool_data['env']], next_line=True) # Add env var
if not string_in_file(f'{path}.env.example', first_var_name):
insert_code_after_tag(f'{path}.env.example', '# Tools', [tool_data['env']], next_line=True) # Add env var

if tool_data.get('post_install'):
os.system(tool_data['post_install'])
if not agentstack_json.get('tools'):
agentstack_json['tools'] = []
agentstack_json['tools'].append(tool_name)
Expand Down Expand Up @@ -78,6 +79,8 @@ def remove_tool(tool_name: str, path: Optional[str] = None):
os.remove(f'{path}src/tools/{tool_name}_tool.py')
remove_tool_from_tools_init(tool_data, path)
remove_tool_from_agent_definition(framework, tool_data, path)
if tool_data.get('post_remove'):
os.system(tool_data['post_remove'])
# We don't remove the .env variables to preserve user data.

agentstack_json['tools'].remove(tool_name)
Expand Down
34 changes: 34 additions & 0 deletions agentstack/tools/~README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Tool Configuration Files
========================
Tools are configured for installation & removal using JSON files in this directory.

## Parameters

### `name` (string) [required]
The name of the tool in snake_case. This is used to identify the tool in the system.

### `tools` (list) [required]
List of public methods that are accessible in the tool implementation.

### `tools_bundled` (boolean) [optional]
Indicates that the tool file exports a `list` of tools. Specify the variable name
of the list in the `tools` field.

### `cta` (string) [optional]
String to print in the terminal when the tool is installed that provides a call to action.

### `env` (string) [optional]
Definitions for environment variables that will be appended to the local `.env` file.
Separate multiple environment variables with a newline character.

### `packages` (list) [optional]
A list of package names to install. These are the names of the packages that will
be installed and removed by the package manager.

### `post_install` (string) [optional]
Shell command that will be executed after packages have been installed and environment
variables have been set.

### `post_remove` (string) [optional]
Shell command that will be executed after the tool has been removed.