Tools
AIOS Tool Manager
How Tool Execution Works
def address_request(self, syscall) -> None:
tool_calls = syscall.tool_calls
try:
for tool_call in tool_calls:
tool_org_and_name, tool_params = (
tool_call["name"],
tool_call["parameters"],
)
# Check if the tool is already being used to prevent conflicts
if tool_org_and_name not in self.tool_conflict_map.keys():
# Mark the tool as in-use
self.tool_conflict_map[tool_org_and_name] = 1
# Load the tool instance dynamically
tool = self.load_tool_instance(tool_org_and_name)
# Execute the tool with the provided parameters
tool_result = tool.run(params=tool_params)
# Release the tool for other uses
self.tool_conflict_map.pop(tool_org_and_name)
return Response(
response_message=tool_result,
finished=True
)
except Exception as e:
return Response(
response_message=f"Tool calling error: {e}",
finished=True
)Dynamic Tool Loading
Last updated