MicroAgent logo

MicroAgent

Free

Agents Capable of Self-Editing Their Prompts / Python Code ![GitHub Repo stars](https://img.shields.io/github/stars/aymenfurter/microagents?style=social)

FreeFree tier
Type
Open Source

About MicroAgent

Microagents is an experimental open-source framework that dynamically creates self-improving agents in response to user tasks. These small, microservice-sized agents are generated on-the-fly, assessed for functionality, and if validated, stored for reuse across chat sessions. This allows the system to learn and improve its methods over time without manual prompt engineering. Built with Python and leveraging OpenAI's GPT-4 Turbo and text-embedding-ada-002, Microagents enables automated task decomposition and execution. Note: Agents execute raw Python code and currently lack a sandbox, so isolated environments like GitHub Codespaces or Docker are recommended.

Key Features

Dynamically generates micro-sized agents in response to tasks
Self-improving agents that refine prompts and code over time
Validated agents are stored for reuse across chat sessions
Enables cross-session learning without manual prompt engineering
Built with Python, OpenAI GPT-4 Turbo, and text-embedding-ada-002
Supports both interactive chat (app.py) and demo run (main.py)
Offers Azure OpenAI integration with Entra ID support
Includes Gradio UI and terminal-based textual UI

Pros & Cons

Pros
  • Learns from past interactions and improves across sessions
  • No manual prompt tuning needed after initial setup
  • Reuses validated agents to reduce redundant computation
  • Open-source and free to use with your own OpenAI API key
  • Supports both OpenAI and Azure OpenAI services
  • Includes multiple UI options: Gradio, terminal, and textual
Cons
  • Executes Python code directly without a sandbox (security risk)
  • Requires an OpenAI API key with access to GPT-4 Turbo (costs incur)
  • Experimental framework – may have bugs or limited robustness
  • No built-in isolation; recommended to run in Docker or Codespaces
  • Dependent on external LLM services for agent generation

Best For

Automating repetitive coding or data processing tasksPrototyping and testing self-improving AI agent behaviorsResearching prompt engineering and agentic systemsBuilding reusable agent libraries for common workflows

FAQ

How does Microagents work?
When a user submits a task, the framework dynamically generates a small agent (a microagent) comprising a prompt and optional Python code. The agent is executed and its output is assessed. If successful, the agent is saved in a database for future reuse. Over time, the system learns which agents work best for which tasks.
What are the prerequisites?
You need an OpenAI account with access to GPT-4 Turbo and text-embedding-ada-002. For local setup, Python and the packages in requirements.txt are required. Optionally, you can use Azure OpenAI with API key or Entra ID.
Is Microagents safe to use?
The framework runs generated Python code directly without a sandbox. It is strongly recommended to run it in isolated environments like GitHub Codespaces or Docker (see README-Docker.md). Be mindful of potential security and cost implications.
How do I remove all stored agents?
Simply delete the 'agents.db' file. All previously saved agents will be removed and the system will start fresh.
Does Microagents support Azure OpenAI?
Yes. You can set environment variables for Azure OpenAI API key, endpoint, and optionally specify custom deployment names for the embedding and GPT model. Entra ID (AAD) authentication is also supported.