@@ -21,7 +21,7 @@ def add_tool(tool_name: str, path: Optional[str] = None):
21
21
22
22
with importlib .resources .path (f'agentstack.templates.{ framework } .tools' , f"{ tool_name } _tool.py" ) as tool_file_path :
23
23
os .system (tool_data ['package' ]) # Install package
24
- shutil .copy (tool_file_path , f'{ path + "/" if path else "" } src/tools/{ tool_name } .py' ) # Move tool from package to project
24
+ shutil .copy (tool_file_path , f'{ path + "/" if path else "" } src/tools/{ tool_name } _tool .py' ) # Move tool from package to project
25
25
add_tool_to_tools_init (tool_data , path ) # Export tool from tools dir
26
26
add_tool_to_agent_definition (framework , tool_data , path )
27
27
insert_code_after_tag (f'{ path + "/" if path else "" } .env' , '# Tools' , [tool_data ['env' ]], next_line = True ) # Add env var
@@ -44,7 +44,7 @@ def add_tool_to_tools_init(tool_data: dict, path: Optional[str] = None):
44
44
file_path = f'{ path + "/" if path else "" } src/tools/__init__.py'
45
45
tag = '# tool import'
46
46
code_to_insert = [
47
- f"from { tool_data ['name' ]} _tool import { ', ' .join ([tool_name for tool_name in tool_data ['tools' ]])} "
47
+ f"from . { tool_data ['name' ]} _tool import { ', ' .join ([tool_name for tool_name in tool_data ['tools' ]])} "
48
48
]
49
49
insert_code_after_tag (file_path , tag , code_to_insert , next_line = True )
50
50
@@ -59,7 +59,7 @@ def add_tool_to_agent_definition(framework: str, tool_data: dict, path: Optional
59
59
60
60
with fileinput .input (files = filename , inplace = True ) as f :
61
61
for line in f :
62
- print (line .replace ('tools=[' , f'tools=[tools.{ ", tools." .join ([tool_name for tool_name in tool_data ["tools" ]])} , ' ), end = '' )
62
+ 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 = '' )
63
63
64
64
65
65
def assert_tool_exists (tool_name : str , tools : dict ):
0 commit comments