OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Feat: Microagents Support for Resolver

Open oconnorjoseph opened this issue 1 month ago • 1 comments

What problem or use case are you trying to solve? Perhaps I am mistaken, but it appears that neither .openhands/microagents/repo.md nor microagent markdowns in .openhands/microagents/knowledge/ nor .openhands/microagents/tasks/ are recognized and used by the Resolver.

Describe the UX of the solution you'd like The Resolver should:

  1. Automatically detect and load microagents from .openhands/microagents/ and its subdirectories (repo.md, knowledge/, and tasks/) without manual configuration, which may be several steps into the Resolver's thinking process.
  2. Trigger knowledge agents contextually based on keywords detected in conversations or file content.
  3. Emit directly or indirectly in the action output logs microagents.
  4. Display errors or warnings if microagents have invalid syntax or fail to load, ensuring users can troubleshoot issues.

Do you have thoughts on the technical implementation?

  1. Loading Microagents:

    • Implement a directory scanning feature in the Resolver to locate and parse files in .openhands/microagents/.
    • Use YAML parsers to validate and load metadata from the frontmatter of each microagent file.
    • Prioritize loading order:
      1. repo.md for repository-specific settings.
      2. knowledge/ for context-based knowledge triggers.
      3. tasks/ for interactive workflows.
  2. Integration with OpenHands:

    • Enhance the Resolver logic to allow dynamic activation of microagents based on triggers (e.g., keywords).
    • Treat the thinking Resolver agent as the user for task agents
    • Maintain a cache of loaded microagents for quick access and reduce redundant parsing.
  3. Testing:

    • Write unit tests for the Resolver to cover edge cases like missing directories or invalid microagent structures.
    • Create integration tests to ensure microagents interact correctly within OpenHands workflows.

Describe alternatives you've considered

  1. Manual Configuration: Duplicate the frontmatter from all microagents into .openhands_instructions. This approach is less user-friendly and increases the risk of misconfiguration.

oconnorjoseph avatar Jan 10 '25 13:01 oconnorjoseph