|
@@ -1,11 +1,9 @@
|
|
|
import asyncio
|
|
import asyncio
|
|
|
-import argparse
|
|
|
|
|
import sys
|
|
import sys
|
|
|
from typing import Type
|
|
from typing import Type
|
|
|
|
|
|
|
|
import agenthub # noqa F401 (we import this to get the agents registered)
|
|
import agenthub # noqa F401 (we import this to get the agents registered)
|
|
|
-from opendevin import config
|
|
|
|
|
-from opendevin.schema import ConfigType
|
|
|
|
|
|
|
+from opendevin.config import args
|
|
|
from opendevin.agent import Agent
|
|
from opendevin.agent import Agent
|
|
|
from opendevin.controller import AgentController
|
|
from opendevin.controller import AgentController
|
|
|
from opendevin.llm.llm import LLM
|
|
from opendevin.llm.llm import LLM
|
|
@@ -22,54 +20,8 @@ def read_task_from_stdin() -> str:
|
|
|
return sys.stdin.read()
|
|
return sys.stdin.read()
|
|
|
|
|
|
|
|
|
|
|
|
|
-def parse_arguments():
|
|
|
|
|
- """Parse command-line arguments."""
|
|
|
|
|
- parser = argparse.ArgumentParser(
|
|
|
|
|
- description='Run an agent with a specific task')
|
|
|
|
|
- parser.add_argument(
|
|
|
|
|
- '-t', '--task', type=str, default='', help='The task for the agent to perform'
|
|
|
|
|
- )
|
|
|
|
|
- parser.add_argument(
|
|
|
|
|
- '-f',
|
|
|
|
|
- '--file',
|
|
|
|
|
- type=str,
|
|
|
|
|
- help='Path to a file containing the task. Overrides -t if both are provided.',
|
|
|
|
|
- )
|
|
|
|
|
- parser.add_argument(
|
|
|
|
|
- '-c',
|
|
|
|
|
- '--agent-cls',
|
|
|
|
|
- default='MonologueAgent',
|
|
|
|
|
- type=str,
|
|
|
|
|
- help='The agent class to use',
|
|
|
|
|
- )
|
|
|
|
|
- parser.add_argument(
|
|
|
|
|
- '-m',
|
|
|
|
|
- '--model-name',
|
|
|
|
|
- default=config.get(ConfigType.LLM_MODEL),
|
|
|
|
|
- type=str,
|
|
|
|
|
- help='The (litellm) model name to use',
|
|
|
|
|
- )
|
|
|
|
|
- parser.add_argument(
|
|
|
|
|
- '-i',
|
|
|
|
|
- '--max-iterations',
|
|
|
|
|
- default=config.get(ConfigType.MAX_ITERATIONS),
|
|
|
|
|
- type=int,
|
|
|
|
|
- help='The maximum number of iterations to run the agent',
|
|
|
|
|
- )
|
|
|
|
|
- parser.add_argument(
|
|
|
|
|
- '-n',
|
|
|
|
|
- '--max-chars',
|
|
|
|
|
- default=config.get(ConfigType.MAX_CHARS),
|
|
|
|
|
- type=int,
|
|
|
|
|
- help='The maximum number of characters to send to and receive from LLM per task',
|
|
|
|
|
- )
|
|
|
|
|
- args, _ = parser.parse_known_args()
|
|
|
|
|
- return args
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
async def main():
|
|
async def main():
|
|
|
"""Main coroutine to run the agent controller with task input flexibility."""
|
|
"""Main coroutine to run the agent controller with task input flexibility."""
|
|
|
- args = parse_arguments()
|
|
|
|
|
|
|
|
|
|
# Determine the task source
|
|
# Determine the task source
|
|
|
if args.file:
|
|
if args.file:
|