MicroAgent

Frameworks & SDKs 💻 TypeScript ⚖️ MIT 🔴 No recent commits
4.3k stars

Micro Agent is a CLI tool that generates code from a prompt by first creating a test and then iterating on the code until the test passes. It solves the problem of LLMs producing broken code by automating the test-driven development loop. It is for developers who want to quickly generate reliable code snippets or components.

MicroAgent demo
🖼️ Screenshot from the project README

✨ Key features

  • Generates code and iterates until tests pass
  • Interactive mode for guided code generation
  • Supports OpenAI, Anthropic, Ollama, and custom endpoints
  • Visual matching to replicate designs from screenshots
  • Configurable max runs and model selection
  • Integrates with Visual Copilot for Figma designs

🎯 Use cases

  • Generate a function or component with a test
  • Fix code by providing a failing test
  • Match a UI design from a screenshot
  • Automate test-driven development for small tasks

📦 Installation

🧰 Requirements: Requires Node.js v18 or later and an API key for OpenAI, Anthropic, or another compatible provider.

npm install -g @builder.io/micro-agent

🚀 Usage

micro-agent

For manual mode with a test:

micro-agent ./file-to-edit.ts -t "npm test"

⚠️ Good to know

This project is not an end-to-end developer; it does not install modules or handle multi-file changes. Visual matching is experimental and requires an Anthropic API key.

❓ FAQ

What models does Micro Agent support?

It supports OpenAI models (default gpt-4o), Anthropic Claude models, and any OpenAI-compatible provider like Groq or Ollama.

How does Micro Agent ensure code works?

It generates a test case and iterates on the code until the test passes, up to a maximum number of runs (default 10).

Can I use Micro Agent without a test file?

Yes, you can run it in interactive mode with just micro-agent and it will ask questions to guide generation.

How do I configure the API key?

Use micro-agent config set OPENAI_KEY=<your token> or ANTHROPIC_KEY=<your token> depending on the provider.

📊 Repository

Stars★ 4,328
Forks🍴 379
Open issues🐛 42
Last commit🕒 Nov 14, 2024
Created📅 May 2024
Language💻 TypeScript
License⚖️ MIT

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.