MicroAgents are specialized prompts that enhance OpenHands with domain-specific knowledge and task-specific workflows. They help developers by providing expert guidance, automating common tasks, and ensuring consistent practices across projects. Each microagent is designed to excel in a specific area, from Git operations to code review processes.
OpenHands loads microagents from two sources:
This directory (OpenHands/microagents/
) contains shareable microagents that are:
- Available to all OpenHands users
- Maintained in the OpenHands repository
- Perfect for reusable knowledge and common workflows
Directory structure:
OpenHands/microagents/
βββ knowledge/ # Keyword-triggered expertise
β βββ git.md # Git operations
β βββ testing.md # Testing practices
β βββ docker.md # Docker guidelines
βββ tasks/ # Interactive workflows
βββ pr_review.md # PR review process
βββ bug_fix.md # Bug fixing workflow
βββ feature.md # Feature implementation
Each repository can have its own instructions in .openhands/microagents/repo.md
. These instructions are:
- Private to that repository
- Automatically loaded when working with that repository
- Perfect for repository-specific guidelines and team practices
Example repository structure:
your-repository/
βββ .openhands/
βββ microagents/
βββ repo.md # Repository-specific instructions
βββ knowledges/ # Private micro-agents that are only available inside this repo
βββ tasks/ # Private micro-agents that are only available inside this repo
When OpenHands works with a repository, it:
- Loads repository-specific instructions from
.openhands/microagents/repo.md
if present - Loads relevant knowledge agents based on keywords in conversations
- Enable task agent if user select one of them
All microagents use markdown files with YAML frontmatter.
Knowledge agents provide specialized expertise that's triggered by keywords in conversations. They help with:
- Language best practices
- Framework guidelines
- Common patterns
- Tool usage
Key characteristics:
- Trigger-based: Activated by specific keywords in conversations
- Context-aware: Provide relevant advice based on file types and content
- Reusable: Knowledge can be applied across multiple projects
- Versioned: Support multiple versions of tools/frameworks
You can see an example of a knowledge-based agent in OpenHands's github microagent.
Repository agents provide repository-specific knowledge and guidelines. They are:
- Loaded from
.openhands/microagents/repo.md
- Specific to individual repositories
- Automatically activated for their repository
- Perfect for team practices and project conventions
Key features:
- Project-specific: Contains guidelines unique to the repository
- Team-focused: Enforces team conventions and practices
- Always active: Automatically loaded for the repository
- Locally maintained: Updated with the project
You can see an example of a repo agent in the agent for the OpenHands repo itself.
Task agents provide interactive workflows that guide users through common development tasks. They:
- Accept user inputs
- Follow predefined steps
- Adapt to context
- Provide consistent results
Key capabilities:
- Interactive: Guide users through complex processes
- Validating: Check inputs and conditions
- Flexible: Adapt to different scenarios
- Reproducible: Ensure consistent outcomes
Example workflow: You can see an example of a task-based agent in OpenHands's pull request updating microagent.
-
Knowledge Agents - When you have:
- Language/framework best practices
- Tool usage patterns
- Common problem solutions
- General development guidelines
-
Task Agents - When you have:
- Repeatable workflows
- Multi-step processes
- Common development tasks
- Standard procedures
-
Repository Agents - When you need:
- Project-specific guidelines
- Team conventions and practices
- Custom workflow documentation
- Repository-specific setup instructions
-
For Knowledge Agents:
- Choose distinctive triggers
- Focus on one area of expertise
- Include practical examples
- Use file patterns when relevant
- Keep knowledge general and reusable
-
For Task Agents:
- Break workflows into clear steps
- Validate user inputs
- Provide helpful defaults
- Include usage examples
- Make steps adaptable
-
For Repository Agents:
- Document clear setup instructions
- Include repository structure details
- Specify testing and build procedures
- List environment requirements
- Maintain up-to-date team practices
- Create your agent file in the appropriate directory:
knowledge/
for expertise (public, shareable)tasks/
for workflows (public, shareable)- Note: Repository agents should remain in their respective repositories'
.openhands/microagents/
directory
- Test thoroughly
- Submit a pull request to OpenHands
All microagents are subject to the same license as OpenHands. See the root LICENSE file for details.