@@ -21,7 +21,7 @@ def add_tool(tool_name: str, path: Optional[str] = None):
2121
2222 with importlib .resources .path (f'agentstack.templates.{ framework } .tools' , f"{ tool_name } _tool.py" ) as tool_file_path :
2323 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
2525 add_tool_to_tools_init (tool_data , path ) # Export tool from tools dir
2626 add_tool_to_agent_definition (framework , tool_data , path )
2727 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):
4444 file_path = f'{ path + "/" if path else "" } src/tools/__init__.py'
4545 tag = '# tool import'
4646 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' ]])} "
4848 ]
4949 insert_code_after_tag (file_path , tag , code_to_insert , next_line = True )
5050
@@ -59,7 +59,7 @@ def add_tool_to_agent_definition(framework: str, tool_data: dict, path: Optional
5959
6060 with fileinput .input (files = filename , inplace = True ) as f :
6161 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 = '' )
6363
6464
6565def assert_tool_exists (tool_name : str , tools : dict ):
0 commit comments