requirement.py 662 B

12345678910111213141516171819202122232425262728293031
  1. from abc import abstractmethod
  2. from dataclasses import dataclass
  3. from openhands.events.action import Action
  4. from openhands.events.observation import Observation
  5. class Plugin:
  6. """Base class for a plugin.
  7. This will be initialized by the runtime client, which will run inside docker.
  8. """
  9. name: str
  10. @abstractmethod
  11. async def initialize(self, username: str):
  12. """Initialize the plugin."""
  13. pass
  14. @abstractmethod
  15. async def run(self, action: Action) -> Observation:
  16. """Run the plugin for a given action."""
  17. pass
  18. @dataclass
  19. class PluginRequirement:
  20. """Requirement for a plugin."""
  21. name: str