mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-04-29 03:00:45 -04:00
This PR fixes #1897. In addition, this PR fixes and tweaks a few micro-agents. For the first time, I am able to use ManagerAgent to complete test_write_simple_script and test_edits tasks in integration tests, so this PR also adds ManagerAgent as part of integration tests. test_write_simple_script involves delegation to CoderAgent while test_edits involves delegation to TypoFixerAgent. Also for the first time, I am able to use DelegateAgent to complete test_write_simple_script and test_edits tasks in integration tests, so this PR also adds DelegateAgent as part of integration tests. It involves delegation to StudyRepoForTaskAgent, CoderAgent and VerifierAgent. This PR is a blocker for #1735 and likely #1945.
28 lines
848 B
Python
28 lines
848 B
Python
import os
|
|
|
|
import yaml
|
|
|
|
all_microagents = {}
|
|
|
|
# Get the list of directories and sort them to preserve determinism
|
|
dirs = sorted(os.listdir(os.path.dirname(__file__)))
|
|
|
|
for dir in dirs:
|
|
base = os.path.dirname(__file__) + '/' + dir
|
|
if os.path.isfile(base):
|
|
continue
|
|
if dir.startswith('_'):
|
|
continue
|
|
promptFile = base + '/prompt.md'
|
|
agentFile = base + '/agent.yaml'
|
|
if not os.path.isfile(promptFile) or not os.path.isfile(agentFile):
|
|
raise Exception(f'Missing prompt or agent file in {base}. Please create them.')
|
|
with open(promptFile, 'r') as f:
|
|
prompt = f.read()
|
|
with open(agentFile, 'r') as f:
|
|
agent = yaml.safe_load(f)
|
|
if 'name' not in agent:
|
|
raise Exception(f'Missing name in {agentFile}')
|
|
agent['prompt'] = prompt
|
|
all_microagents[agent['name']] = agent
|