Skip to main content

openhands.microagent.microagent

BaseMicroAgent Objects

class BaseMicroAgent(BaseModel)

Base class for all microagents.

source

path to the file

load

@classmethod
def load(cls,
path: Union[str, Path],
file_content: str | None = None) -> 'BaseMicroAgent'

Load a microagent from a markdown file with frontmatter.

KnowledgeMicroAgent Objects

class KnowledgeMicroAgent(BaseMicroAgent)

Knowledge micro-agents provide specialized expertise that's triggered by keywords in conversations. They help with:

  • Language best practices
  • Framework guidelines
  • Common patterns
  • Tool usage

match_trigger

def match_trigger(message: str) -> str | None

Match a trigger in the message.

It returns the first trigger that matches the message.

RepoMicroAgent Objects

class RepoMicroAgent(BaseMicroAgent)

MicroAgent specialized for repository-specific knowledge and guidelines.

RepoMicroAgents are loaded from .openhands/microagents/repo.md files within repositories and contain private, repository-specific instructions that are automatically loaded when working with that repository. They are ideal for:

  • Repository-specific guidelines
  • Team practices and conventions
  • Project-specific workflows
  • Custom documentation references

TaskMicroAgent Objects

class TaskMicroAgent(BaseMicroAgent)

MicroAgent specialized for task-based operations.

load_microagents_from_dir

def load_microagents_from_dir(
microagent_dir: Union[str, Path]
) -> tuple[dict[str, RepoMicroAgent], dict[str, KnowledgeMicroAgent], dict[
str, TaskMicroAgent]]

Load all microagents from the given directory.

Arguments:

  • microagent_dir - Path to the microagents directory.

Returns:

Tuple of (repo_agents, knowledge_agents, task_agents) dictionaries