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
6 changes: 3 additions & 3 deletions agentstack/generation/tool_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def add_tool(tool_name: str, path: Optional[str] = None):

with importlib.resources.path(f'agentstack.templates.{framework}.tools', f"{tool_name}_tool.py") as tool_file_path:
os.system(tool_data['package']) # Install package
shutil.copy(tool_file_path, f'{path + "/" if path else ""}src/tools/{tool_name}.py') # Move tool from package to project
shutil.copy(tool_file_path, f'{path + "/" if path else ""}src/tools/{tool_name}_tool.py') # Move tool from package to project
add_tool_to_tools_init(tool_data, path) # Export tool from tools dir
add_tool_to_agent_definition(framework, tool_data, path)
insert_code_after_tag(f'{path + "/" if path else ""}.env', '# Tools', [tool_data['env']], next_line=True) # Add env var
Expand All @@ -44,7 +44,7 @@ def add_tool_to_tools_init(tool_data: dict, path: Optional[str] = None):
file_path = f'{path + "/" if path else ""}src/tools/__init__.py'
tag = '# tool import'
code_to_insert = [
f"from {tool_data['name']}_tool import {', '.join([tool_name for tool_name in tool_data['tools']])}"
f"from .{tool_data['name']}_tool import {', '.join([tool_name for tool_name in tool_data['tools']])}"
]
insert_code_after_tag(file_path, tag, code_to_insert, next_line=True)

Expand All @@ -59,7 +59,7 @@ def add_tool_to_agent_definition(framework: str, tool_data: dict, path: Optional

with fileinput.input(files=filename, inplace=True) as f:
for line in f:
print(line.replace('tools=[', f'tools=[tools.{", tools.".join([tool_name for tool_name in tool_data["tools"]])}, '), end='')
print(line.replace('tools=[', f'tools=[{"*" if tool_data.get("tools_bundled") else ""}tools.{", tools.".join([tool_name for tool_name in tool_data["tools"]])}, '), end='')


def assert_tool_exists(tool_name: str, tools: dict):
Expand Down
3 changes: 3 additions & 0 deletions agentstack/templates/crewai/tools/code_interpreter_tool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from crewai_tools import CodeInterpreterTool

code_interpreter = CodeInterpreterTool()
6 changes: 6 additions & 0 deletions agentstack/templates/crewai/tools/composio_tool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from composio_crewai import ComposioToolSet, App

composio_tools = ComposioToolSet().get_tools(apps=[App.CODEINTERPRETER])

# change App.CODEINTERPRETER to be the app you want to use
# For more info on tool selection, see https://docs.agentstack.sh/tools/tool/composio
3 changes: 3 additions & 0 deletions agentstack/templates/crewai/tools/vision_tool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from crewai_tools import VisionTool

vision_tool = VisionTool()
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ python = ">=3.10,<=3.13"
agentops = "^0.3.12"
crewai = "^0.63.6"
crewai-tools= "0.12.1"
python-dotenv="1.0.1"

[project.scripts]
{{cookiecutter.project_metadata.project_name}} = "{{cookiecutter.project_metadata.project_name}}.main:run"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import sys
from crew import {{cookiecutter.project_metadata.project_name|replace('-', '')|replace('_', '')|capitalize}}Crew
import agentops
from dotenv import load_dotenv
load_dotenv()

agentops.init()

Expand Down
6 changes: 6 additions & 0 deletions agentstack/tools/code_interpreter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "code_interpreter_tool",
"package": "poetry add 'crewai[tools]'",
"env": "",
"tools": ["code_interpreter"]
}
8 changes: 8 additions & 0 deletions agentstack/tools/composio.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "composio",
"package": "poetry add composio-crewai",
"env": "COMPOSIO_API_KEY=...",
"tools": ["composio_tools"],
"tools_bundled": true,
"cta": "!!! Composio provides 150+ tools. Additional setup is required in src/tools/composio_tool.py"
}
15 changes: 13 additions & 2 deletions agentstack/tools/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
"name": "mem0",
"url": "https://github.com/mem0ai/mem0"
}],
"code-gen": [{
"code-execution": [{
"name": "open_interpreter",
"url": "https://github.com/OpenInterpreter/open-interpreter"
},{
"name": "code_interpreter",
"url": "AgentStack default tool"
}],
"computer-control": [{
"name": "directory_search",
Expand All @@ -27,10 +30,18 @@
"url": "https://github.com/crewAIInc/crewAI-tools/tree/main/crewai_tools/tools/file_read_tool"
},{
"name": "ftp",
"url": "AgentStack custom tool"
"url": "AgentStack default tool"
}],
"network-protocols": [{
"name": "agent_connect",
"url": "https://github.com/chgaowei/AgentConnect"
}],
"unified-apis": [{
"name": "composio",
"url": "https://composio.dev/"
}],
"vision": [{
"name": "vision",
"url": "AgentStack default tool"
}]
}
6 changes: 6 additions & 0 deletions agentstack/tools/vision.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "vision",
"package": "poetry add 'crewai[tools]'",
"env": "",
"tools": ["vision_tool"]
}
6 changes: 2 additions & 4 deletions agentstack/utils.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
from typing import Optional

import toml
import os
import sys
import json
import re
from importlib.metadata import version


def get_version():
try:
with open('../pyproject.toml', 'r') as f:
pyproject_data = toml.load(f)
return pyproject_data['project']['version']
return version('agentstack')
except (KeyError, FileNotFoundError) as e:
print(e)
return "Unknown version"
Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "agentstack"
version = "0.1.6"
version = "0.1.7"
description = "The fastest way to build robust AI agents"
authors = [
{ name="Braelyn Boynton", email="bboynton97@gmail.com" }
Expand All @@ -25,9 +25,6 @@ dependencies = [
[tool.setuptools.package-data]
agentstack = ["templates/**/*"]

[project.urls]
"Homepage" = "https://github.com/AgentOps-AI/AgentStack"


[project.scripts]
agentstack = "agentstack.main:main"
Loading