How to Develop Agents
To develop new agents to run on AIOS, it provides the native Agent-SDK and various adapters to adapt different agent frameworks into AIOS.
Below shows the agent frameworks that have been integrated and the current integration modules.
The table below shows the agent frameworks we have integrated and different modules that have been integrated, and the details can be found in later sections.
AutoGen
LLM
Open-Interpreter
LLM
MetaGPT
LLM
Before developing agents, it is required to follow the guidelines of how to organize the agent files in the following structure.
Agent Structure
First, let's look at how to organize your agent's files. Every agent needs three mandatory components:
For example, if your name is demo_author and you're building a demo_agent that searches and summarizes articles, your folder structure would look like this:
Note: If your agent needs any libraries beyond AIOS's built-in ones, make sure to list them in meta_requirements.txt. Apart from the above three files, you can have any other files in your folder.
A minimal example of an agent is shown as below
[Important]: Rules to be strictly followed in the entry.py
The agent class must inherit the BaseAgent from https://github.com/agiresearch/Cerebrum/blob/main/cerebrum/agents/base.py
The agent class must have a
run
method as the main function to be executedAll the interactions with AIOS kernel must be through the
send_request
API, otherwise the services provided by the AIOS will not support for the agents.
Configure the agent
Your agent needs a config.json file that describes its functionality. Here's what it should include:
When setting up your agent, you'll need to specify which tools it will use.
View tools available in the AIOS Tool Hub:
View tools available locally:
To use these tools in your agent, use the AutoTool
provided by the AIOS SDK to load these tools within your agent logic.
To load a tool from ToolHub in your code:
To load a local tool in your code:
If you would like to create your new tools, you can either integrate the tool within your agent code or you can follow the tool examples in the tool folder to develop your standalone tools. The detailed instructions are in How to develop new tools.
Last updated