SuperAPI AI Directory

microagents

Microagents is an experimental framework for dynamically creating self-improving agents based on user tasks. Powered by OpenAI's GPT-4 Turbo and Text-Embedding-Ada-002, it can generate microservice-sized agents, verify their functionality, and then store them for reuse, thereby enabling learning across chat sessions. The project provides both a command-line and a Gradio web interface, and supports parallel agent generation, pretrained agents, and SQLite persistent storage. Agents directly execute Python code, and there is currently no sandbox, so it is recommended to run them in an isolated environment.

Open website

About this tool

Microagents is an experimental framework designed to dynamically create self-improving agents based on tasks assigned by users. These agents are designed to be microservice-sized (hence the name microagents); they are dynamically generated, evaluated for functionality, and, after successful verification, stored for future reuse. This enables the system to learn across chat sessions and independently derive methods for task execution.

Main Capabilities

  • Dynamic agent generation: automatically create small agents based on user tasks.
  • Self-improvement and reuse: successfully verified agents are stored and can be reused in subsequent sessions, enabling cross-session learning.
  • Parallelization: when creating a new agent, three agents are generated in parallel, the first one to successfully complete the task is kept, and the rest are discarded.
  • Verification phase ("Judge"): a new verification step ensures that agents claiming to work actually perform as expected, and only fully usable agents are included in the working agent directory.
  • Persistent storage: agents are stored across runs via SQLite.
  • Improved agent memory: agents can only remember the agents they themselves previously created, avoiding unnecessary deep changes during execution and enhancing the robustness of agent creation.
  • Pretrained agents: includes 28 pretrained agents for testing, covering a variety of tasks from interacting with OpenStreetMap to providing current weather information; these agents were all trained using Microagents.
  • Two user interfaces: provides a command-line interface (CLI, launched via textual-app.py, contributed by bearney74) and a feature-rich web interface based on Gradio.

Usage

  1. Make sure you have an OpenAI account with access to gpt-4-turbo and text-embedding-ada-002.
  2. Clone the repository:git clone https://github.com/aymenfurter/microagents.git
  3. Install the Python packages:pip install -r requirements.txt
  4. Set environment variables:
    • Using the OpenAI API:export OPENAI_KEY='your_api_key_here'
    • Using Azure OpenAI with an API key:
      export AZURE_OPENAI_API_KEY='your_api_key_here'
      export AZURE_OPENAI_ENDPOINT='https://my_endpoint_name_here.openai.azure.com/'
      # export OPENAI_EMBEDDING='' # 可选,设置 ada 嵌入的 Azure 部署名称(如果名称不是 text-embedding-ada-002)
      # export OPENAI_MODEL='' # 可选,设置 gpt 4 的 Azure 部署名称(如果名称不是 gpt-4-1106-preview)
      
    • Using Azure OpenAI with Entra ID (AAD):
      export AZURE_OPENAI_ENDPOINT='https://my_endpoint_name_here.openai.azure.com/'
      export AZURE_OPENAI_USE_AAD='true' # 启用 DefaultAzureCredential
      # export AZURE_OPENAI_AD_TOKEN='' # 可选,指定 AAD 令牌
      # export AZURE_CLIENT_ID='' # 可选,指定托管标识的客户端 ID
      # export OPENAI_EMBEDDING='' # 可选,设置 ada 嵌入的 Azure 部署名称
      # export OPENAI_MODEL='' # 可选,设置 gpt 4 的 Azure 部署名称
      
  5. Run the demo or interactive chat (the specific commands are not provided in the materials).
  6. Delete all agents: delete the "agents.db" file.

Applicable Scenarios

  • Experimental projects that require dynamically generating and reusing agents to complete diverse tasks.
  • Research on self-improving agents and cross-session learning.
  • Testing the performance of pretrained agents on tasks such as OpenStreetMap interaction and weather information.

Limitations and Notes

  • Microagents directly execute Python code, and there is currently no sandbox. It is strongly recommended to run them in an isolated environment (such as GitHub Codespaces or Docker; see README-Docker.md) to limit potential damage.
  • Be mindful of the costs incurred from using OpenAI services.
  • The project is an experimental framework, and its functionality may be incomplete.
  • Version v0.1.0 (January 21, 2024) is the first release, with subsequent updates.
  • Licensed under the MIT License.