28 lines
844 B
Python
28 lines
844 B
Python
from typing import List
|
|
|
|
from pydantic import Field
|
|
|
|
from app.agent.toolcall import ToolCallAgent
|
|
from app.prompt.swe import SYSTEM_PROMPT
|
|
from app.tool import Bash, StrReplaceEditor, Terminate, ToolCollection
|
|
|
|
|
|
class SWEAgent(ToolCallAgent):
|
|
"""An agent that implements the SWEAgent paradigm for executing code and natural conversations."""
|
|
|
|
name: str = "swe"
|
|
description: str = "an autonomous AI programmer that interacts directly with the computer to solve tasks."
|
|
|
|
system_prompt: str = SYSTEM_PROMPT
|
|
next_step_prompt: str = ""
|
|
|
|
available_tools: ToolCollection = ToolCollection(
|
|
Bash(), StrReplaceEditor(), Terminate()
|
|
)
|
|
special_tool_names: List[str] = Field(default_factory=lambda: [Terminate().name])
|
|
|
|
max_steps: int = 20
|
|
|
|
bash: Bash = Field(default_factory=Bash)
|
|
working_dir: str = "."
|