AIOS Docs
  • Welcome
  • Getting Started
    • Installation
    • Quickstart
      • Use Terminal
      • Use WebUI
    • Environment Variables Configuration
  • AIOS Kernel
    • Overview
    • LLM Core(s)
      • LiteLLM Compatible Backend
      • vLLM Backend
      • Hugging Face Backend
      • LLM Routing
    • Scheduler
      • FIFOScheduler
      • RRScheduler
    • Context
    • Memory
      • Base Layer
      • Agentic Memory Operations
    • Storage
      • sto_mount
      • sto_create_file
      • sto_create_directory
      • sto_write
      • sto_retrieve
      • sto_rollback
      • sto_share
    • Tools
    • Access
    • Syscalls
    • Terminal
  • AIOS Agent
    • How to Use Agent
    • How to Develop Agents
      • Develop with Native SDK
      • Develop with AutoGen
      • Develop with Open-Interpreter
      • Develop with MetaGPT
    • How to Publish Agents
  • AIOS-Agent SDK
    • Overview
    • LLM Core API
      • llm_chat
      • llm_chat_with_json_output
      • llm_chat_with_tool_call_output
      • llm_call_tool
      • llm_operate_file
    • Memory API
      • create_memory
      • get_memory
      • update_memory
      • delete_memory
      • search_memories
      • create_agentic_memory
    • Storage API
      • mount
      • create_file
      • create_dir
      • write_file
      • retrieve_file
      • rollback_file
      • share_file
    • Tool API
      • How to Develop Tools
    • Access API
    • Post API
    • Agent API
  • Community
    • How to Contribute
Powered by GitBook
On this page
  • How Tool Execution Works
  • Dynamic Tool Loading
  1. AIOS Kernel

Tools

AIOS Tool Manager

The AIOS Tool Manager serves as a central hub for handling tool executions within the kernel. It provides a structured way to load and execute these tools while preventing conflicts.

How Tool Execution Works

  1. Receives the tool request with specific parameters

  2. Prevents tool conflicts by tracking active tool executions

  3. Loads the appropriate tool instance on demand

  4. Executes the tool with the provided parameters

  5. Returns the result back to the requesting component

The Tool Manager implements a key method called address_request that handles incoming tool requests:

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

One of the most powerful features of the Tool Manager is its ability to dynamically load tool instances when needed:

def load_tool_instance(self, tool_org_and_name):
    # Create a new instance of the requested tool
    tool_instance = AutoTool.from_preloaded(tool_org_and_name)
    return tool_instance
Previoussto_shareNextAccess

Last updated 1 month ago

Details of how to use AutoTool can be found in .

https://github.com/agiresearch/Cerebrum/blob/main/cerebrum/interface/__init__.py