ToolsAgent is a versatile Python project that provides a series of functional modules for biology, chemistry, materials science, and general tools. The project has a clear structure, supports extensions, and is suitable for research and development.
ToolsAgent provides tool services for SciToolAgent. It integrates over 500 tools from the fields of biology, chemistry, and materials science, including AI models, online APIs, Python packages, and other formats. These tools are packaged together and made available through a unified HTTP access interface. You can use the tools we have prepared or add custom tools of your own.
/ToolsAgent
├── DataFiles # Directory for data files (e.g., cif, csv, md, pdb, pdf, sdf formats)
├── LogFiles # Directory for log files
├── TempFiles # Temporary files directory
├── TestCode # Directory for test codes
├── ToolsFuns # Core functional modules directory
├── utils # Common utility functions directory
├── README.md # Project overview
├── requirements.txt # Python dependencies
├── run.sh # One-click run script
├── struct.md # Project structure documentation
├── config.py # Configuration file
├── example.env # Environment variable file
└── tool_runner.py # Tool entry point
- Clone the project to your local machine
cd ToolsAgent
- Create and activate a virtual environment
conda create -n ToolsAgent python=3.10 conda activate ToolsAgent
- Install the project dependencies
pip install -r requirements.txt
- Run the project
bash run.sh
For some AI model-driven tools, you also need to configure model files, paths, and environment information. You can find the corresponding tool code in
ToolsAgent/ToolsFuns
for specific modifications.
To access the tool services via HTTP requests, you can use the FastAPI-based service exposed by the run-func endpoint. Here’s a step-by-step guide on how to make an HTTP request to invoke a function:
The run-func
endpoint accepts POST requests and requires the following parameters:
func_name
: The name of the function you want to run.
func_args
: The arguments required by the function, passed as a string.
file_path_list
: A list of file paths (optional) for files that need to be uploaded for the function.
{
"func_name": "function_name_here",
"func_args": "arguments_for_function",
"file_path_list": ["path/to/file1", "path/to/file2"]
}
The default port is 60002, which can be modified in main.py
.
{
"status_code": 200,
"result": "function_execution_result_here"
}
This project uses the FastAPI framework. You can view the API documentation at http://127.0.0.1:60002/docs
You can add custom tools by following these steps:
- Create a new tool in Python under
ToolsAgent/ToolsFuns
. You can follow the existing tools as examples. Format:def custom_tool(parameter: str): # Your code here return result
- Add the tool name to
tool_name_dict.py
andtools_dict.py
. - Restart the tool service to apply the changes.
Special thanks to the developers of FastAPI and all the open-source scientific tools that we have integrated into this project: