mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-10 15:28:14 -05:00
* don't modify directories * oops typo * dev_config/python * add config to CI * bump CI python to 3.10 * 3.11? * del actions/ * add suggestions * delete unused code * missed some * oops missed another one * remove a file
26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
from typing import Type
|
|
import argparse
|
|
|
|
from opendevin.agent import Agent
|
|
from opendevin.controller import AgentController
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(description="Run an agent with a specific task")
|
|
parser.add_argument("-d", "--directory", required=True, type=str, help="The working directory for the agent")
|
|
parser.add_argument("-t", "--task", required=True, type=str, help="The task for the agent to perform")
|
|
parser.add_argument("-c", "--agent-cls", default="LangchainsAgent", type=str, help="The agent class to use")
|
|
parser.add_argument("-m", "--model-name", default="gpt-4-0125-preview", type=str, help="The (litellm) model name to use")
|
|
args = parser.parse_args()
|
|
|
|
print(f"Running agent {args.agent_cls} (model: {args.model_name}, directory: {args.directory}) with task: \"{args.task}\"")
|
|
|
|
AgentCls: Type[Agent] = Agent.get_cls(args.agent_cls)
|
|
agent = AgentCls(
|
|
instruction=args.task,
|
|
workspace_dir=args.directory,
|
|
model_name=args.model_name
|
|
)
|
|
|
|
controller = AgentController(agent, args.directory)
|
|
controller.start_loop()
|