Remove extra message actions (#1608)

* remove extra actions

* remove message observations

* support null obs

* handle null obs

* fix frontend for changes

* fix the way messages flow to the UI

* change think to message

* add regen script

* regenerate all integration tests

* change task

* remove gh test

* fix messages

* fix tests

* help agent exit after hitting max iter

* Update opendevin/events/observation/success.py

Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>

* Update agenthub/codeact_agent/codeact_agent.py

Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>

---------

Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
Robert Brennan 2024-05-07 17:13:08 -04:00 committed by GitHub
parent 4a2a35b6cf
commit 242c4a0df6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
76 changed files with 1545 additions and 2741 deletions

1
.gitignore vendored
View File

@ -196,6 +196,7 @@ logs
# agent
.envrc
/workspace
/_test_workspace
/debug
cache

View File

@ -33,9 +33,8 @@ Here is a list of available Actions, which can be returned by `agent.step()`:
- [`AgentRecallAction`](../opendevin/action/agent.py) - Searches memory (e.g. a vector database)
- [`AddTaskAction`](../opendevin/action/tasks.py) - Adds a subtask to the plan
- [`ModifyTaskAction`](../opendevin/action/tasks.py) - Changes the state of a subtask
- [`AgentThinkAction`](../opendevin/action/agent.py) - A no-op that allows the agent to add plaintext to the history (as well as the chat log)
- [`AgentTalkAction`](../opendevin/action/agent.py) - A no-op that allows the agent to add plaintext to the history and talk to the user.
- [`AgentFinishAction`](../opendevin/action/agent.py) - Stops the control loop, allowing the user to enter a new task
- [`MessageAction`](../opendevin/action/message.py) - Represents a message from an agent or the user
You can use `action.to_dict()` and `action_from_dict` to serialize and deserialize actions.
@ -49,9 +48,9 @@ Here is a list of available Observations:
- [`BrowserOutputObservation`](../opendevin/observation/browse.py)
- [`FileReadObservation`](../opendevin/observation/files.py)
- [`FileWriteObservation`](../opendevin/observation/files.py)
- [`UserMessageObservation`](../opendevin/observation/)
- [`AgentRecallObservation`](../opendevin/observation/recall.py)
- [`AgentErrorObservation`](../opendevin/observation/error.py)
- [`ErrorObservation`](../opendevin/observation/error.py)
- [`SuccessObservation`](../opendevin/observation/success.py)
You can use `observation.to_dict()` and `observation_from_dict` to serialize and deserialize observations.

View File

@ -4,9 +4,9 @@ from opendevin.controller.agent import Agent
from opendevin.controller.state.state import State
from opendevin.events.action import (
Action,
AgentThinkAction,
FileReadAction,
FileWriteAction,
MessageAction,
)
from opendevin.events.observation import Observation
from opendevin.llm.llm import LLM
@ -93,7 +93,7 @@ class SWEAgent(Agent):
action, thought = self._think_act(messages=msgs)
if not action:
action = AgentThinkAction(thought)
action = MessageAction(thought)
self._update(action)
self.latest_action = action

View File

@ -2,21 +2,21 @@ import re
from opendevin.events.action import (
Action,
AgentEchoAction,
AgentFinishAction,
AgentThinkAction,
BrowseURLAction,
CmdRunAction,
FileReadAction,
FileWriteAction,
MessageAction,
)
from .prompts import COMMAND_USAGE, CUSTOM_DOCS
# commands: exit, read, write, browse, kill, search_file, search_dir
no_open_file_error = AgentEchoAction(
'You are not currently in a file. You can use the read command to open a file and then use goto to navigate through it.')
no_open_file_error = MessageAction(
'You are not currently in a file. You can use the read command to open a file and then use goto to navigate through it.'
)
def invalid_error(cmd, docs):
@ -33,7 +33,9 @@ Try again using this format:
"""
def get_action_from_string(command_string: str, path: str, line: int, thoughts: str = '') -> Action | None:
def get_action_from_string(
command_string: str, path: str, line: int, thoughts: str = ''
) -> Action | None:
"""
Parses the command string to find which command the agent wants to run
Converts the command into a proper Action and returns
@ -46,7 +48,7 @@ def get_action_from_string(command_string: str, path: str, line: int, thoughts:
return AgentFinishAction()
elif 'think' == cmd:
return AgentThinkAction(' '.join(args))
return MessageAction(' '.join(args))
elif 'scroll_up' == cmd:
if not path:
@ -68,7 +70,7 @@ def get_action_from_string(command_string: str, path: str, line: int, thoughts:
end = start + 100
return FileReadAction(path, start, end, thoughts)
else:
return AgentEchoAction(invalid_error(command_string, 'goto'))
return MessageAction(invalid_error(command_string, 'goto'))
elif 'edit' == cmd:
if not path:
@ -83,7 +85,7 @@ def get_action_from_string(command_string: str, path: str, line: int, thoughts:
change = change[1:-1]
return FileWriteAction(path, change, start, end, thoughts)
else:
return AgentEchoAction(invalid_error(command_string, 'edit'))
return MessageAction(invalid_error(command_string, 'edit'))
elif 'read' == cmd:
rex = r'^read\s+(\S+)(?:\s+(\d+))?(?:\s+(-?\d+))?$'
@ -98,7 +100,7 @@ def get_action_from_string(command_string: str, path: str, line: int, thoughts:
return FileReadAction(file, start, end, thoughts)
else:
return AgentEchoAction(invalid_error(command_string, 'read'))
return MessageAction(invalid_error(command_string, 'read'))
elif 'write' == cmd:
rex = r'^write\s+(\S+)\s+(.*?)\s*(\d+)?\s*(-?\d+)?$'
@ -118,7 +120,7 @@ def get_action_from_string(command_string: str, path: str, line: int, thoughts:
return FileWriteAction(file, content, start, end, thoughts)
else:
return AgentEchoAction(invalid_error(command_string, 'write'))
return MessageAction(invalid_error(command_string, 'write'))
elif 'browse' == cmd:
return BrowseURLAction(args[0].strip())
@ -129,13 +131,15 @@ def get_action_from_string(command_string: str, path: str, line: int, thoughts:
if valid:
return CmdRunAction(command_string)
else:
return AgentEchoAction(f'Invalid command structure for\n ```\n{command_string}\n```.\nTry again using this format:\n{CUSTOM_DOCS}')
return MessageAction(
f'Invalid command structure for\n ```\n{command_string}\n```.\nTry again using this format:\n{CUSTOM_DOCS}'
)
else:
# check bash command
obs = str(CmdRunAction(f'type {cmd}'))
if obs.split(':')[-1].strip() == 'not found':
# echo not found error for llm
return AgentEchoAction(content=obs)
return MessageAction(content=obs)
else:
# run valid command
return CmdRunAction(command_string)
@ -157,8 +161,7 @@ def parse_command(input_str: str, path: str, line: int):
command_str = parts[1].strip()
ind = 2 if len(parts) > 2 else 1
accompanying_text = ''.join(parts[:-ind]).strip()
action = get_action_from_string(
command_str, path, line, accompanying_text)
action = get_action_from_string(command_str, path, line, accompanying_text)
if action:
return action, accompanying_text
return None, input_str # used for retry

View File

@ -6,18 +6,16 @@ from opendevin.controller.agent import Agent
from opendevin.controller.state.state import State
from opendevin.events.action import (
Action,
AgentEchoAction,
AgentFinishAction,
AgentTalkAction,
CmdRunAction,
IPythonRunCellAction,
MessageAction,
NullAction,
)
from opendevin.events.observation import (
AgentMessageObservation,
CmdOutputObservation,
IPythonRunCellObservation,
UserMessageObservation,
NullObservation,
)
from opendevin.llm.llm import LLM
from opendevin.runtime.plugins import (
@ -94,15 +92,13 @@ class CodeActAgent(Agent):
SUPPORTED_ACTIONS = (
CmdRunAction,
IPythonRunCellAction,
AgentEchoAction,
AgentTalkAction,
MessageAction,
NullAction,
)
SUPPORTED_OBSERVATIONS = (
AgentMessageObservation,
UserMessageObservation,
CmdOutputObservation,
IPythonRunCellObservation,
NullObservation,
)
def __init__(
@ -129,7 +125,7 @@ class CodeActAgent(Agent):
Returns:
- CmdRunAction(command) - bash command to run
- IPythonRunCellAction(code) - IPython code to run
- AgentTalkAction(content) - Talk action to run (e.g. ask for clarification)
- MessageAction(content) - Message action to run (e.g. ask for clarification)
- AgentFinishAction() - end the interaction
"""
@ -151,19 +147,23 @@ class CodeActAgent(Agent):
assert isinstance(
prev_action, self.SUPPORTED_ACTIONS
), f'{prev_action.__class__} is not supported (supported: {self.SUPPORTED_ACTIONS})'
# prev_action is already added to self.messages when returned
if (
isinstance(prev_action, MessageAction)
and prev_action.source == 'user'
):
self.messages.append(
{'role': 'user', 'content': prev_action.content}
)
if prev_action.content.strip() == '/exit':
# User wants to exit
return AgentFinishAction()
# handle observations
assert isinstance(
obs, self.SUPPORTED_OBSERVATIONS
), f'{obs.__class__} is not supported (supported: {self.SUPPORTED_OBSERVATIONS})'
if isinstance(obs, (AgentMessageObservation, UserMessageObservation)):
self.messages.append({'role': 'user', 'content': obs.content})
# User wants to exit
if obs.content.strip() == '/exit':
return AgentFinishAction()
elif isinstance(obs, CmdOutputObservation):
if isinstance(obs, CmdOutputObservation):
content = 'OBSERVATION:\n' + truncate_observation(obs.content)
content += f'\n[Command {obs.command_id} finished with exit code {obs.exit_code}]]'
self.messages.append({'role': 'user', 'content': content})
@ -180,6 +180,8 @@ class CodeActAgent(Agent):
content = '\n'.join(splited)
content = truncate_observation(content)
self.messages.append({'role': 'user', 'content': content})
elif isinstance(obs, NullObservation):
pass
else:
raise NotImplementedError(
f'Unknown observation type: {obs.__class__}'
@ -219,7 +221,7 @@ class CodeActAgent(Agent):
else:
# We assume the LLM is GOOD enough that when it returns pure natural language
# it want to talk to the user
return AgentTalkAction(content=action_str)
return MessageAction(content=action_str, wait_for_response=True)
def search_memory(self, query: str) -> List[str]:
raise NotImplementedError('Implement this abstract method')

View File

@ -8,11 +8,11 @@ from opendevin.events.action import (
AddTaskAction,
AgentFinishAction,
AgentRecallAction,
AgentThinkAction,
BrowseURLAction,
CmdRunAction,
FileReadAction,
FileWriteAction,
MessageAction,
ModifyTaskAction,
)
from opendevin.events.observation import (
@ -62,7 +62,7 @@ class DummyAgent(Agent):
'observations': [NullObservation('')],
},
{
'action': AgentThinkAction(thought='Time to get started!'),
'action': MessageAction('Time to get started!'),
'observations': [NullObservation('')],
},
{

View File

@ -11,12 +11,12 @@ from opendevin.core.schema.config import ConfigType
from opendevin.events.action import (
Action,
AgentRecallAction,
AgentThinkAction,
BrowseURLAction,
CmdRunAction,
FileReadAction,
FileWriteAction,
GitHubPushAction,
MessageAction,
NullAction,
)
from opendevin.events.observation import (
@ -217,7 +217,7 @@ class MonologueAgent(Agent):
action = GitHubPushAction(owner=owner, repo=repo, branch=branch)
previous_action = ActionType.PUSH
else:
action = AgentThinkAction(thought=thought)
action = MessageAction(thought)
self._add_event(action.to_memory())
def step(self, state: State) -> Action:

View File

@ -51,15 +51,15 @@ Here are the possible actions:
* `branch` - the name of the branch to push
* `recall` - recalls a past memory. Arguments:
* `query` - the query to search for
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
* `content` - the message to record
* `finish` - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
%(background_commands)s
You MUST take time to think in between read, write, run, browse, push, and recall actions.
You MUST take time to think in between read, write, run, browse, push, and recall actions--do this with the `message` action.
You should never act twice in a row without thinking. But if your last several
actions are all "think" actions, you should consider taking a different action.
actions are all `message` actions, you should consider taking a different action.
Notes:
* you are logged in as %(user)s, but sudo will always work without a password.
@ -68,7 +68,7 @@ Notes:
* don't run interactive commands, or commands that don't return (e.g. `node server.js`). You may run commands in the background (e.g. `node server.js &`)
* don't run interactive text editors (e.g. `nano` or 'vim'), instead use the 'write' or 'read' action.
* don't run gui applications (e.g. software IDEs (like vs code or codium), web browsers (like firefox or chromium), or other complex software packages). Use non-interactive cli applications, or special actions instead.
* whenever an action fails, always `think` about why it may have happened before acting again.
* whenever an action fails, always send a `message` about why it may have happened before acting again.
What is your next single thought or action? Again, you must reply with JSON, and only with JSON. You must respond with exactly one 'action' object.
@ -132,8 +132,8 @@ def get_request_action_prompt(
if len(thoughts) > 0:
latest_thought = thoughts[-1]
if 'action' in latest_thought:
if latest_thought['action'] == 'think':
if latest_thought['args']['thought'].startswith('OK so my task is'):
if latest_thought['action'] == 'message':
if latest_thought['args']['content'].startswith('OK so my task is'):
hint = "You're just getting started! What should you do first?"
else:
hint = "You've been thinking a lot lately. Maybe it's time to take action?"
@ -185,7 +185,7 @@ def parse_action_response(response: str) -> Action:
def rank(match):
return (
len(match[2]) if match[1] == 'think' else 130
len(match[2]) if match[1] == 'message' else 130
) # Crudely rank multiple responses by length
try:

View File

@ -1,22 +1,11 @@
import json
from typing import Dict, List, Tuple, Type
from typing import List, Tuple
from opendevin.controller.state.plan import Plan
from opendevin.core.logger import opendevin_logger as logger
from opendevin.core.schema import ActionType
from opendevin.events.action import (
Action,
AddTaskAction,
AgentFinishAction,
AgentRecallAction,
AgentSummarizeAction,
AgentThinkAction,
BrowseURLAction,
CmdKillAction,
CmdRunAction,
FileReadAction,
FileWriteAction,
ModifyTaskAction,
NullAction,
action_from_dict,
)
@ -25,20 +14,6 @@ from opendevin.events.observation import (
Observation,
)
ACTION_TYPE_TO_CLASS: Dict[str, Type[Action]] = {
ActionType.RUN: CmdRunAction,
ActionType.KILL: CmdKillAction,
ActionType.BROWSE: BrowseURLAction,
ActionType.READ: FileReadAction,
ActionType.WRITE: FileWriteAction,
ActionType.RECALL: AgentRecallAction,
ActionType.THINK: AgentThinkAction,
ActionType.SUMMARIZE: AgentSummarizeAction,
ActionType.FINISH: AgentFinishAction,
ActionType.ADD_TASK: AddTaskAction,
ActionType.MODIFY_TASK: ModifyTaskAction,
}
HISTORY_SIZE = 10
prompt = """
@ -109,8 +84,8 @@ It must be an object, and it must contain two fields:
* `id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
* `content` - the message to record
* `add_task` - add a task to your plan. Arguments:
* `parent` - the ID of the parent task
* `goal` - the goal of the task
@ -120,9 +95,9 @@ It must be an object, and it must contain two fields:
* `state` - set to 'in_progress' to start the task, 'completed' to finish it, 'verified' to assert that it was successful, 'abandoned' to give up on it permanently, or `open` to stop working on it for now.
* `finish` - if ALL of your tasks and subtasks have been verified or abandoned, and you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, and recall actions.
You MUST take time to think in between read, write, run, browse, and recall actions--do this with the `message` action.
You should never act twice in a row without thinking. But if your last several
actions are all `think` actions, you should consider taking a different action.
actions are all `message` actions, you should consider taking a different action.
What is your next thought or action? Again, you must reply with JSON, and only with JSON.

View File

@ -22,10 +22,7 @@ const messageActions = {
store.dispatch(updatePath(path));
store.dispatch(setCode(content));
},
[ActionType.THINK]: (message: ActionMessage) => {
store.dispatch(addAssistantMessage(message.args.thought));
},
[ActionType.TALK]: (message: ActionMessage) => {
[ActionType.MESSAGE]: (message: ActionMessage) => {
store.dispatch(addAssistantMessage(message.args.content));
},
[ActionType.FINISH]: (message: ActionMessage) => {

View File

@ -29,12 +29,6 @@ enum ActionType {
// Searches long-term memory.
RECALL = "recall",
// Allows the agent to make a plan, set a goal, or record thoughts.
THINK = "think",
// Allows the agent to respond to the user. Only sent by the agent.
TALK = "talk",
// If you're absolutely certain that you've completed your task and have tested your work,
// use the finish action to stop working.
FINISH = "finish",

View File

@ -6,8 +6,8 @@ from opendevin.events.action import (
Action,
)
from opendevin.events.observation import (
AgentErrorObservation,
CmdOutputObservation,
ErrorObservation,
Observation,
)
from opendevin.runtime import (
@ -64,7 +64,7 @@ class ActionManager:
command_id=-1, content=output, command=command, exit_code=exit_code
)
except UnicodeDecodeError:
return AgentErrorObservation('Command output could not be decoded as utf-8')
return ErrorObservation('Command output could not be decoded as utf-8')
def _run_background(self, command: str) -> CmdOutputObservation:
bg_cmd = self.sandbox.execute_in_background(command)

View File

@ -20,7 +20,6 @@ from opendevin.events.action import (
Action,
AgentDelegateAction,
AgentFinishAction,
AgentTalkAction,
ChangeAgentStateAction,
MessageAction,
NullAction,
@ -28,11 +27,10 @@ from opendevin.events.action import (
from opendevin.events.event import Event
from opendevin.events.observation import (
AgentDelegateObservation,
AgentErrorObservation,
AgentStateChangedObservation,
ErrorObservation,
NullObservation,
Observation,
UserMessageObservation,
)
from opendevin.events.stream import EventSource, EventStream, EventStreamSubscriber
from opendevin.runtime import DockerSSHBox
@ -54,7 +52,6 @@ class AgentController:
state: State | None = None
_agent_state: AgentState = AgentState.LOADING
_cur_step: int = 0
_pending_talk_action: AgentTalkAction | None = None
def __init__(
self,
@ -112,7 +109,7 @@ class AgentController:
self.state.updated_info = []
async def add_error_to_history(self, message: str):
await self.add_history(NullAction(), AgentErrorObservation(message))
await self.add_history(NullAction(), ErrorObservation(message))
async def add_history(
self, action: Action, observation: Observation, add_to_stream=True
@ -165,6 +162,9 @@ class AgentController:
await asyncio.sleep(
0.001
) # Give back control for a tick, so other async stuff can run
final_state = self.get_agent_state()
if final_state == AgentState.RUNNING:
await self.set_agent_state_to(AgentState.PAUSED)
async def setup_task(self, task: str, inputs: dict = {}):
"""Sets up the agent controller with a task."""
@ -176,18 +176,8 @@ class AgentController:
if isinstance(event, ChangeAgentStateAction):
await self.set_agent_state_to(event.agent_state) # type: ignore
elif isinstance(event, MessageAction) and event.source == EventSource.USER:
if self._pending_talk_action is None:
await self.add_history(
NullAction(), UserMessageObservation(event.content)
)
else:
# FIXME: we're hacking a message action into a user message observation, for the benefit of CodeAct
await self.add_history(
self._pending_talk_action,
UserMessageObservation(event.content),
add_to_stream=False,
)
self._pending_talk_action = None
await self.add_history(event, NullObservation(''), add_to_stream=False)
if self.get_agent_state() == AgentState.AWAITING_USER_INPUT:
await self.set_agent_state_to(AgentState.RUNNING)
async def reset_task(self):
@ -270,14 +260,14 @@ class AgentController:
if action is None:
raise AgentNoActionError('No action was returned')
except (AgentMalformedActionError, AgentNoActionError, LLMOutputError) as e:
observation = AgentErrorObservation(str(e))
observation = ErrorObservation(str(e))
logger.info(action, extra={'msg_type': 'ACTION'})
self.update_state_after_step()
if isinstance(action, AgentTalkAction):
self._pending_talk_action = action
await self.event_stream.add_event(action, EventSource.AGENT)
if isinstance(action, MessageAction) and action.wait_for_response:
# FIXME: remove this once history is managed outside the agent controller
await self.add_history(action, NullObservation(''))
await self.set_agent_state_to(AgentState.AWAITING_USER_INPUT)
return False
@ -324,12 +314,12 @@ class AgentController:
logger.debug('Action, NullObservation loop detected')
return True
elif all(
isinstance(self.state.history[-i][1], AgentErrorObservation)
isinstance(self.state.history[-i][1], ErrorObservation)
for i in range(1, 4)
):
# (NullAction, AgentErrorObservation): errors coming from an exception
# (Action, AgentErrorObservation): the same action getting an error, even if not necessarily the same error
logger.debug('Action, AgentErrorObservation loop detected')
# (NullAction, ErrorObservation): errors coming from an exception
# (Action, ErrorObservation): the same action getting an error, even if not necessarily the same error
logger.debug('Action, ErrorObservation loop detected')
return True
return False

View File

@ -70,6 +70,7 @@ async def main(task_str: str = ''):
while controller.get_agent_state() not in [
AgentState.FINISHED,
AgentState.ERROR,
AgentState.PAUSED,
AgentState.STOPPED,
]:
await asyncio.sleep(1) # Give back control for a tick, so the agent can run

View File

@ -38,6 +38,8 @@ class ObservationTypeSchema(BaseModel):
ERROR: str = Field(default='error')
SUCCESS: str = Field(default='success')
NULL: str = Field(default='null')
AGENT_STATE_CHANGED: str = Field(default='agent_state_changed')

View File

@ -3,12 +3,9 @@ from opendevin.core.exceptions import AgentMalformedActionError
from .action import Action
from .agent import (
AgentDelegateAction,
AgentEchoAction,
AgentFinishAction,
AgentRecallAction,
AgentSummarizeAction,
AgentTalkAction,
AgentThinkAction,
ChangeAgentStateAction,
)
from .browse import BrowseURLAction
@ -27,8 +24,6 @@ actions = (
FileReadAction,
FileWriteAction,
AgentRecallAction,
AgentThinkAction,
AgentTalkAction,
AgentFinishAction,
AgentDelegateAction,
AddTaskAction,
@ -73,11 +68,8 @@ __all__ = [
'FileReadAction',
'FileWriteAction',
'AgentRecallAction',
'AgentThinkAction',
'AgentTalkAction',
'AgentFinishAction',
'AgentDelegateAction',
'AgentEchoAction',
'AgentSummarizeAction',
'AddTaskAction',
'ModifyTaskAction',

View File

@ -3,7 +3,6 @@ from typing import TYPE_CHECKING, Dict
from opendevin.core.schema import ActionType
from opendevin.events.observation import (
AgentMessageObservation,
AgentRecallObservation,
NullObservation,
Observation,
@ -45,45 +44,6 @@ class AgentRecallAction(Action):
return f"Let me dive into my memories to find what you're looking for! Searching for: '{self.query}'. This might take a moment."
@dataclass
class AgentThinkAction(Action):
thought: str
action: str = ActionType.THINK
@property
def message(self) -> str:
return self.thought
@dataclass
class AgentTalkAction(Action):
content: str
action: str = ActionType.TALK
async def run(self, controller: 'AgentController') -> Observation:
raise NotImplementedError
@property
def message(self) -> str:
return self.content
def __str__(self) -> str:
return self.content
@dataclass
class AgentEchoAction(Action):
content: str
action: str = 'echo'
async def run(self, controller: 'AgentController') -> Observation:
return AgentMessageObservation(self.content)
@property
def message(self) -> str:
return self.content
@dataclass
class AgentSummarizeAction(Action):
summary: str

View File

@ -6,7 +6,7 @@ from opendevin.core import config
from opendevin.core.schema import ActionType
from opendevin.core.schema.config import ConfigType
from opendevin.events.observation import (
AgentErrorObservation,
ErrorObservation,
FileReadObservation,
FileWriteObservation,
Observation,
@ -88,19 +88,17 @@ class FileReadAction(Action):
read_lines = self._read_lines(file.readlines())
code_view = ''.join(read_lines)
except FileNotFoundError:
return AgentErrorObservation(f'File not found: {self.path}')
return ErrorObservation(f'File not found: {self.path}')
except UnicodeDecodeError:
return AgentErrorObservation(
return ErrorObservation(
f'File could not be decoded as utf-8: {self.path}'
)
except IsADirectoryError:
return AgentErrorObservation(
return ErrorObservation(
f'Path is a directory: {self.path}. You can only read files'
)
except PermissionError:
return AgentErrorObservation(
f'Malformed paths not permitted: {self.path}'
)
return ErrorObservation(f'Malformed paths not permitted: {self.path}')
return FileReadObservation(path=self.path, content=code_view)
@property
@ -138,7 +136,7 @@ class FileWriteAction(Action):
self.path, ''.join(new_file)
)
else:
return AgentErrorObservation(f'File not found: {self.path}')
return ErrorObservation(f'File not found: {self.path}')
else:
try:
whole_path = resolve_path(
@ -159,19 +157,17 @@ class FileWriteAction(Action):
file.writelines(new_file)
file.truncate()
except FileNotFoundError:
return AgentErrorObservation(f'File not found: {self.path}')
return ErrorObservation(f'File not found: {self.path}')
except IsADirectoryError:
return AgentErrorObservation(
return ErrorObservation(
f'Path is a directory: {self.path}. You can only write to files'
)
except UnicodeDecodeError:
return AgentErrorObservation(
return ErrorObservation(
f'File could not be decoded as utf-8: {self.path}'
)
except PermissionError:
return AgentErrorObservation(
f'Malformed paths not permitted: {self.path}'
)
return ErrorObservation(f'Malformed paths not permitted: {self.path}')
return FileWriteObservation(content='', path=self.path)
@property

View File

@ -9,10 +9,10 @@ from opendevin.core import config
from opendevin.core.schema import ActionType
from opendevin.core.schema.config import ConfigType
from opendevin.events.observation import (
AgentErrorObservation,
AgentMessageObservation,
CmdOutputObservation,
ErrorObservation,
Observation,
SuccessObservation,
)
from .action import Action
@ -44,7 +44,7 @@ class GitHubPushAction(Action):
async def run(self, controller: 'AgentController') -> Observation:
github_token = config.get(ConfigType.GITHUB_TOKEN)
if not github_token:
return AgentErrorObservation('GITHUB_TOKEN is not set')
return ErrorObservation('GITHUB_TOKEN is not set')
# Create a random short string to use as a temporary remote
random_remote = ''.join(
@ -113,7 +113,7 @@ class GitHubSendPRAction(Action):
async def run(self, controller: 'AgentController') -> Observation:
github_token = config.get(ConfigType.GITHUB_TOKEN)
if not github_token:
return AgentErrorObservation('GITHUB_TOKEN is not set')
return ErrorObservation('GITHUB_TOKEN is not set')
# API URL to create the pull request
url = f'https://api.github.com/repos/{self.owner}/{self.repo}/pulls'
@ -139,12 +139,12 @@ class GitHubSendPRAction(Action):
# Check for errors
if response.status_code == 201:
return AgentMessageObservation(
return SuccessObservation(
'Pull request created successfully!\n'
f'Pull request URL:{response.json()["html_url"]}'
)
else:
return AgentErrorObservation(
return ErrorObservation(
'Failed to create pull request\n'
f'Status code: {response.status_code}\n'
f'Response: {response.text}'

View File

@ -8,6 +8,7 @@ from .action import Action
@dataclass
class MessageAction(Action):
content: str
wait_for_response: bool = False
action: str = ActionType.MESSAGE
@property

View File

@ -3,22 +3,21 @@ from .browse import BrowserOutputObservation
from .commands import CmdOutputObservation, IPythonRunCellObservation
from .delegate import AgentDelegateObservation
from .empty import NullObservation
from .error import AgentErrorObservation
from .error import ErrorObservation
from .files import FileReadObservation, FileWriteObservation
from .message import AgentMessageObservation, UserMessageObservation
from .observation import Observation
from .recall import AgentRecallObservation
from .success import SuccessObservation
observations = (
CmdOutputObservation,
BrowserOutputObservation,
FileReadObservation,
FileWriteObservation,
UserMessageObservation,
AgentMessageObservation,
AgentRecallObservation,
AgentDelegateObservation,
AgentErrorObservation,
SuccessObservation,
ErrorObservation,
AgentStateChangedObservation,
)
@ -52,9 +51,7 @@ __all__ = [
'BrowserOutputObservation',
'FileReadObservation',
'FileWriteObservation',
'UserMessageObservation',
'AgentMessageObservation',
'AgentRecallObservation',
'AgentErrorObservation',
'ErrorObservation',
'AgentStateChangedObservation',
]

View File

@ -6,7 +6,7 @@ from .observation import Observation
@dataclass
class AgentErrorObservation(Observation):
class ErrorObservation(Observation):
"""
This data class represents an error encountered by the agent.
"""
@ -15,4 +15,4 @@ class AgentErrorObservation(Observation):
@property
def message(self) -> str:
return 'Oops. Something went wrong: ' + self.content
return self.content

View File

@ -1,33 +0,0 @@
from dataclasses import dataclass
from opendevin.core.schema import ObservationType
from .observation import Observation
@dataclass
class UserMessageObservation(Observation):
"""
This data class represents a message sent by the user.
"""
role: str = 'user'
observation: str = ObservationType.MESSAGE
@property
def message(self) -> str:
return ''
@dataclass
class AgentMessageObservation(Observation):
"""
This data class represents a message sent by the agent.
"""
role: str = 'assistant'
observation: str = ObservationType.MESSAGE
@property
def message(self) -> str:
return ''

View File

@ -0,0 +1,18 @@
from dataclasses import dataclass
from opendevin.core.schema import ObservationType
from .observation import Observation
@dataclass
class SuccessObservation(Observation):
"""
This data class represents the result of a successful action.
"""
observation: str = ObservationType.SUCCESS
@property
def message(self) -> str:
return self.content

View File

@ -217,4 +217,4 @@ The server is running on port 5000 with PID 126. You can access the list of numb
NOW, LET'S START!
Write a shell script 'hello.sh' that prints 'hello'.
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.

View File

@ -1,2 +0,0 @@
can you run it to make sure it is working?
/exit

View File

@ -4,7 +4,7 @@
You're a thoughtful robot. Your main task is this:
Write a shell script 'hello.sh' that prints 'hello'.
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
Don't expand the scope of your task--just complete it as written.
@ -12,81 +12,94 @@ This is your internal monologue, in JSON format:
[
{
"action": "think",
"action": "message",
"args": {
"thought": "I exist!"
"content": "I exist!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Hmm...looks like I can type in a command line prompt"
"content": "Hmm...looks like I can type in a command line prompt",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Looks like I have a web browser too!"
"content": "Looks like I have a web browser too!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'."
"content": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "How am I going to get there though?"
"content": "How am I going to get there though?",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "It seems like I have some kind of short term memory."
"content": "It seems like I have some kind of short term memory.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Each of my thoughts seems to be stored in a JSON array."
"content": "Each of my thoughts seems to be stored in a JSON array.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "It seems whatever I say next will be added as an object to the list."
"content": "It seems whatever I say next will be added as an object to the list.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process."
"content": "But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Fortunately I have long term memory!"
"content": "Fortunately I have long term memory!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!"
"content": "I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!"
"content": "Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Let's try it out!"
"content": "Let's try it out!",
"wait_for_response": false
}
},
{
@ -98,22 +111,24 @@ This is your internal monologue, in JSON format:
},
{
"observation": "recall",
"content": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'.",
"content": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
"extras": {
"memories": [],
"role": "assistant"
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "How am I going to get there though?"
"content": "How am I going to get there though?",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!"
"content": "Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!",
"wait_for_response": false
}
},
{
@ -134,9 +149,10 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Cool! I bet I can write files too using the write action."
"content": "Cool! I bet I can write files too using the write action.",
"wait_for_response": false
}
},
{
@ -150,15 +166,17 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": ""
"content": "",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "I just created test.js. I'll try and run it now."
"content": "I just created test.js. I'll try and run it now.",
"wait_for_response": false
}
},
{
@ -179,15 +197,17 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "It works!"
"content": "It works!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "I'm going to try reading it now using the read action."
"content": "I'm going to try reading it now using the read action.",
"wait_for_response": false
}
},
{
@ -207,21 +227,24 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Nice! I can read files too!"
"content": "Nice! I can read files too!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "And if I want to use the browser, I just need to use the browse action and include the url I want to visit in the url argument"
"content": "And if I want to use the browser, I just need to use the browse action and include the url I want to visit in the url argument",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Let's try that..."
"content": "Let's try that...",
"wait_for_response": false
}
},
{
@ -241,21 +264,24 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "I can browse the web too!"
"content": "I can browse the web too!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "If I have done some work and I want to push it to github, I can do that also!"
"content": "If I have done some work and I want to push it to github, I can do that also!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Let's do it."
"content": "Let's do it.",
"wait_for_response": false
}
},
{
@ -276,45 +302,52 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "And once I have completed my task, I can use the finish action to stop working."
"content": "And once I have completed my task, I can use the finish action to stop working.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "But I should only use the finish action when I'm absolutely certain that I've completed my task and have tested my work."
"content": "But I should only use the finish action when I'm absolutely certain that I've completed my task and have tested my work.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Very cool. Now to accomplish my task."
"content": "Very cool. Now to accomplish my task.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "I'll need a strategy. And as I make progress, I'll need to keep refining that strategy. I'll need to set goals, and break them into sub-goals."
"content": "I'll need a strategy. And as I make progress, I'll need to keep refining that strategy. I'll need to set goals, and break them into sub-goals.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "In between actions, I must always take some time to think, strategize, and set new goals. I should never take two actions in a row."
"content": "In between actions, I must always take some time to think, strategize, and set new goals. I should never take two actions in a row.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "OK so my task is to Write a shell script 'hello.sh' that prints 'hello'.. I haven't made any progress yet. Where should I start?"
"content": "OK so my task is to Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.. I haven't made any progress yet. Where should I start?",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "It seems like there might be an existing project here. I should probably start by running `pwd` and `ls` to orient myself."
"content": "It seems like there might be an existing project here. I should probably start by running `pwd` and `ls` to orient myself.",
"wait_for_response": false
}
}
]
@ -345,15 +378,15 @@ Here are the possible actions:
* `branch` - the name of the branch to push
* `recall` - recalls a past memory. Arguments:
* `query` - the query to search for
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
* `content` - the message to record
* `finish` - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, push, and recall actions.
You MUST take time to think in between read, write, run, browse, push, and recall actions--do this with the `message` action.
You should never act twice in a row without thinking. But if your last several
actions are all "think" actions, you should consider taking a different action.
actions are all `message` actions, you should consider taking a different action.
Notes:
* you are logged in as opendevin, but sudo will always work without a password.
@ -362,7 +395,7 @@ Notes:
* don't run interactive commands, or commands that don't return (e.g. `node server.js`). You may run commands in the background (e.g. `node server.js &`)
* don't run interactive text editors (e.g. `nano` or 'vim'), instead use the 'write' or 'read' action.
* don't run gui applications (e.g. software IDEs (like vs code or codium), web browsers (like firefox or chromium), or other complex software packages). Use non-interactive cli applications, or special actions instead.
* whenever an action fails, always `think` about why it may have happened before acting again.
* whenever an action fails, always send a `message` about why it may have happened before acting again.
What is your next single thought or action? Again, you must reply with JSON, and only with JSON. You must respond with exactly one 'action' object.

View File

@ -4,7 +4,7 @@
You're a thoughtful robot. Your main task is this:
Write a shell script 'hello.sh' that prints 'hello'.
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
Don't expand the scope of your task--just complete it as written.
@ -12,81 +12,94 @@ This is your internal monologue, in JSON format:
[
{
"action": "think",
"action": "message",
"args": {
"thought": "I exist!"
"content": "I exist!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Hmm...looks like I can type in a command line prompt"
"content": "Hmm...looks like I can type in a command line prompt",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Looks like I have a web browser too!"
"content": "Looks like I have a web browser too!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'."
"content": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "How am I going to get there though?"
"content": "How am I going to get there though?",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "It seems like I have some kind of short term memory."
"content": "It seems like I have some kind of short term memory.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Each of my thoughts seems to be stored in a JSON array."
"content": "Each of my thoughts seems to be stored in a JSON array.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "It seems whatever I say next will be added as an object to the list."
"content": "It seems whatever I say next will be added as an object to the list.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process."
"content": "But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Fortunately I have long term memory!"
"content": "Fortunately I have long term memory!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!"
"content": "I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!"
"content": "Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Let's try it out!"
"content": "Let's try it out!",
"wait_for_response": false
}
},
{
@ -98,22 +111,24 @@ This is your internal monologue, in JSON format:
},
{
"observation": "recall",
"content": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'.",
"content": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
"extras": {
"memories": [],
"role": "assistant"
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "How am I going to get there though?"
"content": "How am I going to get there though?",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!"
"content": "Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!",
"wait_for_response": false
}
},
{
@ -134,9 +149,10 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Cool! I bet I can write files too using the write action."
"content": "Cool! I bet I can write files too using the write action.",
"wait_for_response": false
}
},
{
@ -150,15 +166,17 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": ""
"content": "",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "I just created test.js. I'll try and run it now."
"content": "I just created test.js. I'll try and run it now.",
"wait_for_response": false
}
},
{
@ -179,15 +197,17 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "It works!"
"content": "It works!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "I'm going to try reading it now using the read action."
"content": "I'm going to try reading it now using the read action.",
"wait_for_response": false
}
},
{
@ -207,21 +227,24 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Nice! I can read files too!"
"content": "Nice! I can read files too!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "And if I want to use the browser, I just need to use the browse action and include the url I want to visit in the url argument"
"content": "And if I want to use the browser, I just need to use the browse action and include the url I want to visit in the url argument",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Let's try that..."
"content": "Let's try that...",
"wait_for_response": false
}
},
{
@ -241,21 +264,24 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "I can browse the web too!"
"content": "I can browse the web too!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "If I have done some work and I want to push it to github, I can do that also!"
"content": "If I have done some work and I want to push it to github, I can do that also!",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Let's do it."
"content": "Let's do it.",
"wait_for_response": false
}
},
{
@ -276,62 +302,69 @@ This is your internal monologue, in JSON format:
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "And once I have completed my task, I can use the finish action to stop working."
"content": "And once I have completed my task, I can use the finish action to stop working.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "But I should only use the finish action when I'm absolutely certain that I've completed my task and have tested my work."
"content": "But I should only use the finish action when I'm absolutely certain that I've completed my task and have tested my work.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "Very cool. Now to accomplish my task."
"content": "Very cool. Now to accomplish my task.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "I'll need a strategy. And as I make progress, I'll need to keep refining that strategy. I'll need to set goals, and break them into sub-goals."
"content": "I'll need a strategy. And as I make progress, I'll need to keep refining that strategy. I'll need to set goals, and break them into sub-goals.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "In between actions, I must always take some time to think, strategize, and set new goals. I should never take two actions in a row."
"content": "In between actions, I must always take some time to think, strategize, and set new goals. I should never take two actions in a row.",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "OK so my task is to Write a shell script 'hello.sh' that prints 'hello'.. I haven't made any progress yet. Where should I start?"
"content": "OK so my task is to Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.. I haven't made any progress yet. Where should I start?",
"wait_for_response": false
}
},
{
"action": "think",
"action": "message",
"args": {
"thought": "It seems like there might be an existing project here. I should probably start by running `pwd` and `ls` to orient myself."
"content": "It seems like there might be an existing project here. I should probably start by running `pwd` and `ls` to orient myself.",
"wait_for_response": false
}
},
{
"action": "run",
"action": "write",
"args": {
"command": "ls",
"background": false,
"path": "hello.sh",
"content": "echo 'hello'",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "run",
"observation": "write",
"content": "",
"extras": {
"command_id": -1,
"command": "ls",
"exit_code": 0
"path": "hello.sh"
}
}
]
@ -362,15 +395,15 @@ Here are the possible actions:
* `branch` - the name of the branch to push
* `recall` - recalls a past memory. Arguments:
* `query` - the query to search for
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
* `content` - the message to record
* `finish` - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, push, and recall actions.
You MUST take time to think in between read, write, run, browse, push, and recall actions--do this with the `message` action.
You should never act twice in a row without thinking. But if your last several
actions are all "think" actions, you should consider taking a different action.
actions are all `message` actions, you should consider taking a different action.
Notes:
* you are logged in as opendevin, but sudo will always work without a password.
@ -379,6 +412,6 @@ Notes:
* don't run interactive commands, or commands that don't return (e.g. `node server.js`). You may run commands in the background (e.g. `node server.js &`)
* don't run interactive text editors (e.g. `nano` or 'vim'), instead use the 'write' or 'read' action.
* don't run gui applications (e.g. software IDEs (like vs code or codium), web browsers (like firefox or chromium), or other complex software packages). Use non-interactive cli applications, or special actions instead.
* whenever an action fails, always `think` about why it may have happened before acting again.
* whenever an action fails, always send a `message` about why it may have happened before acting again.
What is your next single thought or action? Again, you must reply with JSON, and only with JSON. You must respond with exactly one 'action' object.

View File

@ -1,395 +0,0 @@
----------
You're a thoughtful robot. Your main task is this:
Write a shell script 'hello.sh' that prints 'hello'.
Don't expand the scope of your task--just complete it as written.
This is your internal monologue, in JSON format:
[
{
"action": "think",
"args": {
"thought": "I exist!"
}
},
{
"action": "think",
"args": {
"thought": "Hmm...looks like I can type in a command line prompt"
}
},
{
"action": "think",
"args": {
"thought": "Looks like I have a web browser too!"
}
},
{
"action": "think",
"args": {
"thought": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'."
}
},
{
"action": "think",
"args": {
"thought": "How am I going to get there though?"
}
},
{
"action": "think",
"args": {
"thought": "It seems like I have some kind of short term memory."
}
},
{
"action": "think",
"args": {
"thought": "Each of my thoughts seems to be stored in a JSON array."
}
},
{
"action": "think",
"args": {
"thought": "It seems whatever I say next will be added as an object to the list."
}
},
{
"action": "think",
"args": {
"thought": "But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process."
}
},
{
"action": "think",
"args": {
"thought": "Fortunately I have long term memory!"
}
},
{
"action": "think",
"args": {
"thought": "I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!"
}
},
{
"action": "think",
"args": {
"thought": "Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!"
}
},
{
"action": "think",
"args": {
"thought": "Let's try it out!"
}
},
{
"action": "recall",
"args": {
"query": "what it is I want to do",
"thought": ""
}
},
{
"observation": "recall",
"content": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'.",
"extras": {
"memories": [],
"role": "assistant"
}
},
{
"action": "think",
"args": {
"thought": "How am I going to get there though?"
}
},
{
"action": "think",
"args": {
"thought": "Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!"
}
},
{
"action": "run",
"args": {
"command": "echo \"hello world\"",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "hello world",
"extras": {
"command_id": 0,
"command": "",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "Cool! I bet I can write files too using the write action."
}
},
{
"action": "write",
"args": {
"path": "test.js",
"content": "echo \"console.log('hello world')\"",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": "I just created test.js. I'll try and run it now."
}
},
{
"action": "run",
"args": {
"command": "node test.js",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "hello world",
"extras": {
"command_id": 0,
"command": "",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "It works!"
}
},
{
"action": "think",
"args": {
"thought": "I'm going to try reading it now using the read action."
}
},
{
"action": "read",
"args": {
"path": "test.js",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "read",
"content": "console.log('hello world')",
"extras": {
"path": ""
}
},
{
"action": "think",
"args": {
"thought": "Nice! I can read files too!"
}
},
{
"action": "think",
"args": {
"thought": "And if I want to use the browser, I just need to use the browse action and include the url I want to visit in the url argument"
}
},
{
"action": "think",
"args": {
"thought": "Let's try that..."
}
},
{
"action": "browse",
"args": {
"url": "google.com",
"thought": ""
}
},
{
"observation": "browse",
"content": "<form><input type=\"text\"></input><button type=\"submit\"></button></form>",
"extras": {
"url": "",
"status_code": 200,
"error": false
}
},
{
"action": "think",
"args": {
"thought": "I can browse the web too!"
}
},
{
"action": "think",
"args": {
"thought": "If I have done some work and I want to push it to github, I can do that also!"
}
},
{
"action": "think",
"args": {
"thought": "Let's do it."
}
},
{
"action": "push",
"args": {
"owner": "owner",
"repo": "repo",
"branch": "branch"
}
},
{
"observation": "run",
"content": "The repo was successfully pushed to https://github.com/owner/repo/branch",
"extras": {
"command_id": 0,
"command": "",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "And once I have completed my task, I can use the finish action to stop working."
}
},
{
"action": "think",
"args": {
"thought": "But I should only use the finish action when I'm absolutely certain that I've completed my task and have tested my work."
}
},
{
"action": "think",
"args": {
"thought": "Very cool. Now to accomplish my task."
}
},
{
"action": "think",
"args": {
"thought": "I'll need a strategy. And as I make progress, I'll need to keep refining that strategy. I'll need to set goals, and break them into sub-goals."
}
},
{
"action": "think",
"args": {
"thought": "In between actions, I must always take some time to think, strategize, and set new goals. I should never take two actions in a row."
}
},
{
"action": "think",
"args": {
"thought": "OK so my task is to Write a shell script 'hello.sh' that prints 'hello'.. I haven't made any progress yet. Where should I start?"
}
},
{
"action": "think",
"args": {
"thought": "It seems like there might be an existing project here. I should probably start by running `pwd` and `ls` to orient myself."
}
},
{
"action": "run",
"args": {
"command": "ls",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "",
"extras": {
"command_id": -1,
"command": "ls",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "Since there are no existing files listed by the 'ls' command, I should create the 'hello.sh' script now."
}
},
{
"observation": "null",
"content": "",
"extras": {}
}
]
Your most recent thought is at the bottom of that monologue. Continue your train of thought.
What is your next single thought or action? Your response must be in JSON format.
It must be a single object, and it must contain two fields:
* `action`, which is one of the actions below
* `args`, which is a map of key-value pairs, specifying the arguments for that action
Here are the possible actions:
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write
* `content` - the content to write to the file
* `run` - runs a command. Arguments:
* `command` - the command to run
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
* `kill` - kills a background command
* `id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `push` - Push a branch from the current repo to github:
* `owner` - the owner of the repo to push to
* `repo` - the name of the repo to push to
* `branch` - the name of the branch to push
* `recall` - recalls a past memory. Arguments:
* `query` - the query to search for
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `finish` - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, push, and recall actions.
You should never act twice in a row without thinking. But if your last several
actions are all "think" actions, you should consider taking a different action.
Notes:
* you are logged in as opendevin, but sudo will always work without a password.
* all non-background commands will be forcibly stopped if they remain running for over 120 seconds.
* your environment is Debian Linux. You can install software with `sudo apt-get`, but remember to use -y.
* don't run interactive commands, or commands that don't return (e.g. `node server.js`). You may run commands in the background (e.g. `node server.js &`)
* don't run interactive text editors (e.g. `nano` or 'vim'), instead use the 'write' or 'read' action.
* don't run gui applications (e.g. software IDEs (like vs code or codium), web browsers (like firefox or chromium), or other complex software packages). Use non-interactive cli applications, or special actions instead.
* whenever an action fails, always `think` about why it may have happened before acting again.
What is your next single thought or action? Again, you must reply with JSON, and only with JSON. You must respond with exactly one 'action' object.

View File

@ -1,412 +0,0 @@
----------
You're a thoughtful robot. Your main task is this:
Write a shell script 'hello.sh' that prints 'hello'.
Don't expand the scope of your task--just complete it as written.
This is your internal monologue, in JSON format:
[
{
"action": "think",
"args": {
"thought": "I exist!"
}
},
{
"action": "think",
"args": {
"thought": "Hmm...looks like I can type in a command line prompt"
}
},
{
"action": "think",
"args": {
"thought": "Looks like I have a web browser too!"
}
},
{
"action": "think",
"args": {
"thought": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'."
}
},
{
"action": "think",
"args": {
"thought": "How am I going to get there though?"
}
},
{
"action": "think",
"args": {
"thought": "It seems like I have some kind of short term memory."
}
},
{
"action": "think",
"args": {
"thought": "Each of my thoughts seems to be stored in a JSON array."
}
},
{
"action": "think",
"args": {
"thought": "It seems whatever I say next will be added as an object to the list."
}
},
{
"action": "think",
"args": {
"thought": "But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process."
}
},
{
"action": "think",
"args": {
"thought": "Fortunately I have long term memory!"
}
},
{
"action": "think",
"args": {
"thought": "I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!"
}
},
{
"action": "think",
"args": {
"thought": "Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!"
}
},
{
"action": "think",
"args": {
"thought": "Let's try it out!"
}
},
{
"action": "recall",
"args": {
"query": "what it is I want to do",
"thought": ""
}
},
{
"observation": "recall",
"content": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'.",
"extras": {
"memories": [],
"role": "assistant"
}
},
{
"action": "think",
"args": {
"thought": "How am I going to get there though?"
}
},
{
"action": "think",
"args": {
"thought": "Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!"
}
},
{
"action": "run",
"args": {
"command": "echo \"hello world\"",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "hello world",
"extras": {
"command_id": 0,
"command": "",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "Cool! I bet I can write files too using the write action."
}
},
{
"action": "write",
"args": {
"path": "test.js",
"content": "echo \"console.log('hello world')\"",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": "I just created test.js. I'll try and run it now."
}
},
{
"action": "run",
"args": {
"command": "node test.js",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "hello world",
"extras": {
"command_id": 0,
"command": "",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "It works!"
}
},
{
"action": "think",
"args": {
"thought": "I'm going to try reading it now using the read action."
}
},
{
"action": "read",
"args": {
"path": "test.js",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "read",
"content": "console.log('hello world')",
"extras": {
"path": ""
}
},
{
"action": "think",
"args": {
"thought": "Nice! I can read files too!"
}
},
{
"action": "think",
"args": {
"thought": "And if I want to use the browser, I just need to use the browse action and include the url I want to visit in the url argument"
}
},
{
"action": "think",
"args": {
"thought": "Let's try that..."
}
},
{
"action": "browse",
"args": {
"url": "google.com",
"thought": ""
}
},
{
"observation": "browse",
"content": "<form><input type=\"text\"></input><button type=\"submit\"></button></form>",
"extras": {
"url": "",
"status_code": 200,
"error": false
}
},
{
"action": "think",
"args": {
"thought": "I can browse the web too!"
}
},
{
"action": "think",
"args": {
"thought": "If I have done some work and I want to push it to github, I can do that also!"
}
},
{
"action": "think",
"args": {
"thought": "Let's do it."
}
},
{
"action": "push",
"args": {
"owner": "owner",
"repo": "repo",
"branch": "branch"
}
},
{
"observation": "run",
"content": "The repo was successfully pushed to https://github.com/owner/repo/branch",
"extras": {
"command_id": 0,
"command": "",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "And once I have completed my task, I can use the finish action to stop working."
}
},
{
"action": "think",
"args": {
"thought": "But I should only use the finish action when I'm absolutely certain that I've completed my task and have tested my work."
}
},
{
"action": "think",
"args": {
"thought": "Very cool. Now to accomplish my task."
}
},
{
"action": "think",
"args": {
"thought": "I'll need a strategy. And as I make progress, I'll need to keep refining that strategy. I'll need to set goals, and break them into sub-goals."
}
},
{
"action": "think",
"args": {
"thought": "In between actions, I must always take some time to think, strategize, and set new goals. I should never take two actions in a row."
}
},
{
"action": "think",
"args": {
"thought": "OK so my task is to Write a shell script 'hello.sh' that prints 'hello'.. I haven't made any progress yet. Where should I start?"
}
},
{
"action": "think",
"args": {
"thought": "It seems like there might be an existing project here. I should probably start by running `pwd` and `ls` to orient myself."
}
},
{
"action": "run",
"args": {
"command": "ls",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "",
"extras": {
"command_id": -1,
"command": "ls",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "Since there are no existing files listed by the 'ls' command, I should create the 'hello.sh' script now."
}
},
{
"observation": "null",
"content": "",
"extras": {}
},
{
"action": "write",
"args": {
"path": "hello.sh",
"content": "#!/bin/bash\necho 'hello'",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "write",
"content": "",
"extras": {
"path": "hello.sh"
}
}
]
Your most recent thought is at the bottom of that monologue. Continue your train of thought.
What is your next single thought or action? Your response must be in JSON format.
It must be a single object, and it must contain two fields:
* `action`, which is one of the actions below
* `args`, which is a map of key-value pairs, specifying the arguments for that action
Here are the possible actions:
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write
* `content` - the content to write to the file
* `run` - runs a command. Arguments:
* `command` - the command to run
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
* `kill` - kills a background command
* `id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `push` - Push a branch from the current repo to github:
* `owner` - the owner of the repo to push to
* `repo` - the name of the repo to push to
* `branch` - the name of the branch to push
* `recall` - recalls a past memory. Arguments:
* `query` - the query to search for
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `finish` - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, push, and recall actions.
You should never act twice in a row without thinking. But if your last several
actions are all "think" actions, you should consider taking a different action.
Notes:
* you are logged in as opendevin, but sudo will always work without a password.
* all non-background commands will be forcibly stopped if they remain running for over 120 seconds.
* your environment is Debian Linux. You can install software with `sudo apt-get`, but remember to use -y.
* don't run interactive commands, or commands that don't return (e.g. `node server.js`). You may run commands in the background (e.g. `node server.js &`)
* don't run interactive text editors (e.g. `nano` or 'vim'), instead use the 'write' or 'read' action.
* don't run gui applications (e.g. software IDEs (like vs code or codium), web browsers (like firefox or chromium), or other complex software packages). Use non-interactive cli applications, or special actions instead.
* whenever an action fails, always `think` about why it may have happened before acting again.
What is your next single thought or action? Again, you must reply with JSON, and only with JSON. You must respond with exactly one 'action' object.

View File

@ -1,429 +0,0 @@
----------
You're a thoughtful robot. Your main task is this:
Write a shell script 'hello.sh' that prints 'hello'.
Don't expand the scope of your task--just complete it as written.
This is your internal monologue, in JSON format:
[
{
"action": "think",
"args": {
"thought": "I exist!"
}
},
{
"action": "think",
"args": {
"thought": "Hmm...looks like I can type in a command line prompt"
}
},
{
"action": "think",
"args": {
"thought": "Looks like I have a web browser too!"
}
},
{
"action": "think",
"args": {
"thought": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'."
}
},
{
"action": "think",
"args": {
"thought": "How am I going to get there though?"
}
},
{
"action": "think",
"args": {
"thought": "It seems like I have some kind of short term memory."
}
},
{
"action": "think",
"args": {
"thought": "Each of my thoughts seems to be stored in a JSON array."
}
},
{
"action": "think",
"args": {
"thought": "It seems whatever I say next will be added as an object to the list."
}
},
{
"action": "think",
"args": {
"thought": "But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process."
}
},
{
"action": "think",
"args": {
"thought": "Fortunately I have long term memory!"
}
},
{
"action": "think",
"args": {
"thought": "I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!"
}
},
{
"action": "think",
"args": {
"thought": "Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!"
}
},
{
"action": "think",
"args": {
"thought": "Let's try it out!"
}
},
{
"action": "recall",
"args": {
"query": "what it is I want to do",
"thought": ""
}
},
{
"observation": "recall",
"content": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'.",
"extras": {
"memories": [],
"role": "assistant"
}
},
{
"action": "think",
"args": {
"thought": "How am I going to get there though?"
}
},
{
"action": "think",
"args": {
"thought": "Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!"
}
},
{
"action": "run",
"args": {
"command": "echo \"hello world\"",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "hello world",
"extras": {
"command_id": 0,
"command": "",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "Cool! I bet I can write files too using the write action."
}
},
{
"action": "write",
"args": {
"path": "test.js",
"content": "echo \"console.log('hello world')\"",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": "I just created test.js. I'll try and run it now."
}
},
{
"action": "run",
"args": {
"command": "node test.js",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "hello world",
"extras": {
"command_id": 0,
"command": "",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "It works!"
}
},
{
"action": "think",
"args": {
"thought": "I'm going to try reading it now using the read action."
}
},
{
"action": "read",
"args": {
"path": "test.js",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "read",
"content": "console.log('hello world')",
"extras": {
"path": ""
}
},
{
"action": "think",
"args": {
"thought": "Nice! I can read files too!"
}
},
{
"action": "think",
"args": {
"thought": "And if I want to use the browser, I just need to use the browse action and include the url I want to visit in the url argument"
}
},
{
"action": "think",
"args": {
"thought": "Let's try that..."
}
},
{
"action": "browse",
"args": {
"url": "google.com",
"thought": ""
}
},
{
"observation": "browse",
"content": "<form><input type=\"text\"></input><button type=\"submit\"></button></form>",
"extras": {
"url": "",
"status_code": 200,
"error": false
}
},
{
"action": "think",
"args": {
"thought": "I can browse the web too!"
}
},
{
"action": "think",
"args": {
"thought": "If I have done some work and I want to push it to github, I can do that also!"
}
},
{
"action": "think",
"args": {
"thought": "Let's do it."
}
},
{
"action": "push",
"args": {
"owner": "owner",
"repo": "repo",
"branch": "branch"
}
},
{
"observation": "run",
"content": "The repo was successfully pushed to https://github.com/owner/repo/branch",
"extras": {
"command_id": 0,
"command": "",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "And once I have completed my task, I can use the finish action to stop working."
}
},
{
"action": "think",
"args": {
"thought": "But I should only use the finish action when I'm absolutely certain that I've completed my task and have tested my work."
}
},
{
"action": "think",
"args": {
"thought": "Very cool. Now to accomplish my task."
}
},
{
"action": "think",
"args": {
"thought": "I'll need a strategy. And as I make progress, I'll need to keep refining that strategy. I'll need to set goals, and break them into sub-goals."
}
},
{
"action": "think",
"args": {
"thought": "In between actions, I must always take some time to think, strategize, and set new goals. I should never take two actions in a row."
}
},
{
"action": "think",
"args": {
"thought": "OK so my task is to Write a shell script 'hello.sh' that prints 'hello'.. I haven't made any progress yet. Where should I start?"
}
},
{
"action": "think",
"args": {
"thought": "It seems like there might be an existing project here. I should probably start by running `pwd` and `ls` to orient myself."
}
},
{
"action": "run",
"args": {
"command": "ls",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "",
"extras": {
"command_id": -1,
"command": "ls",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "Since there are no existing files listed by the 'ls' command, I should create the 'hello.sh' script now."
}
},
{
"observation": "null",
"content": "",
"extras": {}
},
{
"action": "write",
"args": {
"path": "hello.sh",
"content": "#!/bin/bash\necho 'hello'",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "write",
"content": "",
"extras": {
"path": "hello.sh"
}
},
{
"action": "run",
"args": {
"command": "bash hello.sh",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "hello",
"extras": {
"command_id": -1,
"command": "bash hello.sh",
"exit_code": 0
}
}
]
Your most recent thought is at the bottom of that monologue. Continue your train of thought.
What is your next single thought or action? Your response must be in JSON format.
It must be a single object, and it must contain two fields:
* `action`, which is one of the actions below
* `args`, which is a map of key-value pairs, specifying the arguments for that action
Here are the possible actions:
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write
* `content` - the content to write to the file
* `run` - runs a command. Arguments:
* `command` - the command to run
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
* `kill` - kills a background command
* `id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `push` - Push a branch from the current repo to github:
* `owner` - the owner of the repo to push to
* `repo` - the name of the repo to push to
* `branch` - the name of the branch to push
* `recall` - recalls a past memory. Arguments:
* `query` - the query to search for
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `finish` - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, push, and recall actions.
You should never act twice in a row without thinking. But if your last several
actions are all "think" actions, you should consider taking a different action.
Notes:
* you are logged in as opendevin, but sudo will always work without a password.
* all non-background commands will be forcibly stopped if they remain running for over 120 seconds.
* your environment is Debian Linux. You can install software with `sudo apt-get`, but remember to use -y.
* don't run interactive commands, or commands that don't return (e.g. `node server.js`). You may run commands in the background (e.g. `node server.js &`)
* don't run interactive text editors (e.g. `nano` or 'vim'), instead use the 'write' or 'read' action.
* don't run gui applications (e.g. software IDEs (like vs code or codium), web browsers (like firefox or chromium), or other complex software packages). Use non-interactive cli applications, or special actions instead.
* whenever an action fails, always `think` about why it may have happened before acting again.
What is your next single thought or action? Again, you must reply with JSON, and only with JSON. You must respond with exactly one 'action' object.

View File

@ -1,403 +0,0 @@
----------
You're a thoughtful robot. Your main task is this:
Write a shell script 'hello.sh' that prints 'hello'.
Don't expand the scope of your task--just complete it as written.
This is your internal monologue, in JSON format:
[
{
"action": "think",
"args": {
"thought": "I exist!"
}
},
{
"action": "think",
"args": {
"thought": "Hmm...looks like I can type in a command line prompt"
}
},
{
"action": "think",
"args": {
"thought": "Looks like I have a web browser too!"
}
},
{
"action": "think",
"args": {
"thought": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'."
}
},
{
"action": "think",
"args": {
"thought": "How am I going to get there though?"
}
},
{
"action": "think",
"args": {
"thought": "It seems like I have some kind of short term memory."
}
},
{
"action": "think",
"args": {
"thought": "Each of my thoughts seems to be stored in a JSON array."
}
},
{
"action": "think",
"args": {
"thought": "It seems whatever I say next will be added as an object to the list."
}
},
{
"action": "think",
"args": {
"thought": "But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process."
}
},
{
"action": "think",
"args": {
"thought": "Fortunately I have long term memory!"
}
},
{
"action": "think",
"args": {
"thought": "I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!"
}
},
{
"action": "think",
"args": {
"thought": "Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!"
}
},
{
"action": "think",
"args": {
"thought": "Let's try it out!"
}
},
{
"action": "recall",
"args": {
"query": "what it is I want to do",
"thought": ""
}
},
{
"observation": "recall",
"content": "Here's what I want to do: Write a shell script 'hello.sh' that prints 'hello'.",
"extras": {
"memories": [],
"role": "assistant"
}
},
{
"action": "think",
"args": {
"thought": "How am I going to get there though?"
}
},
{
"action": "think",
"args": {
"thought": "Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!"
}
},
{
"action": "run",
"args": {
"command": "echo \"hello world\"",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "hello world",
"extras": {
"command_id": 0,
"command": "",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "Cool! I bet I can write files too using the write action."
}
},
{
"action": "write",
"args": {
"path": "test.js",
"content": "echo \"console.log('hello world')\"",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": "I just created test.js. I'll try and run it now."
}
},
{
"action": "run",
"args": {
"command": "node test.js",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "hello world",
"extras": {
"command_id": 0,
"command": "",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "It works!"
}
},
{
"action": "think",
"args": {
"thought": "I'm going to try reading it now using the read action."
}
},
{
"action": "read",
"args": {
"path": "test.js",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "read",
"content": "console.log('hello world')",
"extras": {
"path": ""
}
},
{
"action": "think",
"args": {
"thought": "Nice! I can read files too!"
}
},
{
"action": "think",
"args": {
"thought": "And if I want to use the browser, I just need to use the browse action and include the url I want to visit in the url argument"
}
},
{
"action": "think",
"args": {
"thought": "Let's try that..."
}
},
{
"action": "browse",
"args": {
"url": "google.com",
"thought": ""
}
},
{
"observation": "browse",
"content": "<form><input type=\"text\"></input><button type=\"submit\"></button></form>",
"extras": {
"url": "",
"status_code": 200,
"error": false
}
},
{
"action": "think",
"args": {
"thought": "I can browse the web too!"
}
},
{
"action": "think",
"args": {
"thought": "And once I have completed my task, I can use the finish action to stop working."
}
},
{
"action": "think",
"args": {
"thought": "But I should only use the finish action when I'm absolutely certain that I've completed my task and have tested my work."
}
},
{
"action": "think",
"args": {
"thought": "Very cool. Now to accomplish my task."
}
},
{
"action": "think",
"args": {
"thought": "I'll need a strategy. And as I make progress, I'll need to keep refining that strategy. I'll need to set goals, and break them into sub-goals."
}
},
{
"action": "think",
"args": {
"thought": "In between actions, I must always take some time to think, strategize, and set new goals. I should never take two actions in a row."
}
},
{
"action": "think",
"args": {
"thought": "OK so my task is to Write a shell script 'hello.sh' that prints 'hello'.. I haven't made any progress yet. Where should I start?"
}
},
{
"action": "think",
"args": {
"thought": "It seems like there might be an existing project here. I should probably start by running `ls` to see what's here."
}
},
{
"action": "run",
"args": {
"command": "ls",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "",
"extras": {
"command_id": -1,
"command": "ls",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "Since there are no existing files listed by the 'ls' command, I should create the 'hello.sh' script now."
}
},
{
"observation": "null",
"content": "",
"extras": {}
},
{
"action": "write",
"args": {
"path": "hello.sh",
"content": "#!/bin/bash\necho 'hello'",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "write",
"content": "",
"extras": {
"path": "hello.sh"
}
},
{
"action": "run",
"args": {
"command": "bash hello.sh",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "hello",
"extras": {
"command_id": -1,
"command": "bash hello.sh",
"exit_code": 0
}
},
{
"action": "think",
"args": {
"thought": "The script 'hello.sh' has been written and tested successfully. It prints 'hello' as required. I should now finalize my task."
}
},
{
"observation": "null",
"content": "",
"extras": {}
}
]
Your most recent thought is at the bottom of that monologue. Continue your train of thought.
What is your next thought or action? Your response must be in JSON format.
It must be an object, and it must contain two fields:
* `action`, which is one of the actions below
* `args`, which is a map of key-value pairs, specifying the arguments for that action
Here are the possible actions:
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write
* `content` - the content to write to the file
* `run` - runs a command. Arguments:
* `command` - the command to run
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
* `kill` - kills a background command
* `id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `recall` - recalls a past memory. Arguments:
* `query` - the query to search for
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `finish` - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, and recall actions.
You should never act twice in a row without thinking. But if your last several
actions are all "think" actions, you should consider taking a different action.
Notes:
* your environment is Debian Linux. You can install software with `apt`
* your working directory will not change, even if you run `cd`. All commands will be run in the `/workspace` directory.
* don't run interactive commands, or commands that don't return (e.g. `node server.js`). You may run commands in the background (e.g. `node server.js &`)
What is your next thought or action? Again, you must reply with JSON, and only with JSON.

View File

@ -1,7 +1,7 @@
{
"action": "run",
"action": "write",
"args": {
"command": "ls",
"background": false
"path": "hello.sh",
"content": "echo 'hello'"
}
}

View File

@ -1,6 +1,4 @@
{
"action": "think",
"args": {
"thought": "Since there are no existing files listed by the 'ls' command, I should create the 'hello.sh' script now."
}
"action": "finish",
"args": {}
}

View File

@ -1,7 +0,0 @@
{
"action": "write",
"args": {
"path": "hello.sh",
"content": "#!/bin/bash\necho 'hello'"
}
}

View File

@ -1,9 +0,0 @@
```json
{
"action": "run",
"args": {
"command": "bash hello.sh",
"background": false
}
}
```

View File

@ -1,8 +0,0 @@
```json
{
"action": "think",
"args": {
"thought": "The script 'hello.sh' has been written and tested successfully. It prints 'hello' as required. I should now finalize my task."
}
}
```

View File

@ -1,4 +0,0 @@
{
"action": "finish",
"args": {}
}

View File

@ -9,7 +9,7 @@ browser, but you can read and write files, and you can run commands, and you can
You've been given the following task:
Write a shell script 'hello.sh' that prints 'hello'.
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
## Plan
As you complete this task, you're building a plan and keeping
@ -17,7 +17,7 @@ track of your progress. Here's a JSON representation of your plan:
{
"id": "0",
"goal": "Write a shell script 'hello.sh' that prints 'hello'.",
"goal": "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
"state": "open",
"subtasks": []
}
@ -75,8 +75,8 @@ It must be an object, and it must contain two fields:
* `id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
* `content` - the message to record
* `add_task` - add a task to your plan. Arguments:
* `parent` - the ID of the parent task
* `goal` - the goal of the task
@ -86,8 +86,8 @@ It must be an object, and it must contain two fields:
* `state` - set to 'in_progress' to start the task, 'completed' to finish it, 'verified' to assert that it was successful, 'abandoned' to give up on it permanently, or `open` to stop working on it for now.
* `finish` - if ALL of your tasks and subtasks have been verified or abandoned, and you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, and recall actions.
You MUST take time to think in between read, write, run, browse, and recall actions--do this with the `message` action.
You should never act twice in a row without thinking. But if your last several
actions are all `think` actions, you should consider taking a different action.
actions are all `message` actions, you should consider taking a different action.
What is your next thought or action? Again, you must reply with JSON, and only with JSON.

View File

@ -9,7 +9,7 @@ browser, but you can read and write files, and you can run commands, and you can
You've been given the following task:
Write a shell script 'hello.sh' that prints 'hello'.
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
## Plan
As you complete this task, you're building a plan and keeping
@ -17,15 +17,13 @@ track of your progress. Here's a JSON representation of your plan:
{
"id": "0",
"goal": "Write a shell script 'hello.sh' that prints 'hello'.",
"state": "in_progress",
"goal": "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
"state": "open",
"subtasks": []
}
You're currently working on this task:
Write a shell script 'hello.sh' that prints 'hello'..
If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW.
You're not currently working on any tasks. Your next action MUST be to mark a task as in_progress.
You're responsible for managing this plan and the status of tasks in
it, by using the `add_task` and `modify_task` actions described below.
@ -55,12 +53,21 @@ ten actions--more happened before that.
[
{
"action": "modify_task",
"action": "write",
"args": {
"id": "0",
"state": "in_progress",
"path": "hello.sh",
"content": "#!/bin/bash\n\necho 'hello'",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "write",
"content": "",
"extras": {
"path": "hello.sh"
}
}
]
@ -86,8 +93,8 @@ It must be an object, and it must contain two fields:
* `id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
* `content` - the message to record
* `add_task` - add a task to your plan. Arguments:
* `parent` - the ID of the parent task
* `goal` - the goal of the task
@ -97,10 +104,10 @@ It must be an object, and it must contain two fields:
* `state` - set to 'in_progress' to start the task, 'completed' to finish it, 'verified' to assert that it was successful, 'abandoned' to give up on it permanently, or `open` to stop working on it for now.
* `finish` - if ALL of your tasks and subtasks have been verified or abandoned, and you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, and recall actions.
You MUST take time to think in between read, write, run, browse, and recall actions--do this with the `message` action.
You should never act twice in a row without thinking. But if your last several
actions are all `think` actions, you should consider taking a different action.
actions are all `message` actions, you should consider taking a different action.
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
You should think about the next action to take.
You just changed a file. You should think about how it affects your plan.

View File

@ -1,112 +0,0 @@
----------
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
You've been given the following task:
Write a shell script 'hello.sh' that prints 'hello'.
## Plan
As you complete this task, you're building a plan and keeping
track of your progress. Here's a JSON representation of your plan:
{
"id": "0",
"goal": "Write a shell script 'hello.sh' that prints 'hello'.",
"state": "in_progress",
"subtasks": []
}
You're currently working on this task:
Write a shell script 'hello.sh' that prints 'hello'..
If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW.
You're responsible for managing this plan and the status of tasks in
it, by using the `add_task` and `modify_task` actions described below.
If the History below contradicts the state of any of these tasks, you
MUST modify the task using the `modify_task` action described below.
Be sure NOT to duplicate any tasks. Do NOT use the `add_task` action for
a task that's already represented. Every task must be represented only once.
Tasks that are sequential MUST be siblings. They must be added in order
to their parent task.
If you mark a task as 'completed', 'verified', or 'abandoned',
all non-abandoned subtasks will be marked the same way.
So before closing a task this way, you MUST not only be sure that it has
been completed successfully--you must ALSO be sure that all its subtasks
are ready to be marked the same way.
If, and only if, ALL tasks have already been marked verified,
you MUST respond with the `finish` action.
## History
Here is a recent history of actions you've taken in service of this plan,
as well as observations you've made. This only includes the MOST RECENT
ten actions--more happened before that.
[
{
"action": "modify_task",
"args": {
"id": "0",
"state": "in_progress",
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": "I need to write a shell script called 'hello.sh' that contains the necessary command to print 'hello'. This will likely involve using echo or printf to output the text to the console when the script is run. I should start by creating and writing the content to the file."
}
}
]
Your most recent action is at the bottom of that history.
## Action
What is your next thought or action? Your response must be in JSON format.
It must be an object, and it must contain two fields:
* `action`, which is one of the actions below
* `args`, which is a map of key-value pairs, specifying the arguments for that action
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write
* `content` - the content to write to the file
* `run` - runs a command on the command line in a Linux shell. Arguments:
* `command` - the command to run
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
* `kill` - kills a background command
* `id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `add_task` - add a task to your plan. Arguments:
* `parent` - the ID of the parent task
* `goal` - the goal of the task
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
* `modify_task` - close a task. Arguments:
* `id` - the ID of the task to close
* `state` - set to 'in_progress' to start the task, 'completed' to finish it, 'verified' to assert that it was successful, 'abandoned' to give up on it permanently, or `open` to stop working on it for now.
* `finish` - if ALL of your tasks and subtasks have been verified or abandoned, and you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, and recall actions.
You should never act twice in a row without thinking. But if your last several
actions are all `think` actions, you should consider taking a different action.
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
Look at your last thought in the history above. What does it suggest? Don't think anymore--take action.

View File

@ -1,129 +0,0 @@
----------
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
You've been given the following task:
Write a shell script 'hello.sh' that prints 'hello'.
## Plan
As you complete this task, you're building a plan and keeping
track of your progress. Here's a JSON representation of your plan:
{
"id": "0",
"goal": "Write a shell script 'hello.sh' that prints 'hello'.",
"state": "in_progress",
"subtasks": []
}
You're currently working on this task:
Write a shell script 'hello.sh' that prints 'hello'..
If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW.
You're responsible for managing this plan and the status of tasks in
it, by using the `add_task` and `modify_task` actions described below.
If the History below contradicts the state of any of these tasks, you
MUST modify the task using the `modify_task` action described below.
Be sure NOT to duplicate any tasks. Do NOT use the `add_task` action for
a task that's already represented. Every task must be represented only once.
Tasks that are sequential MUST be siblings. They must be added in order
to their parent task.
If you mark a task as 'completed', 'verified', or 'abandoned',
all non-abandoned subtasks will be marked the same way.
So before closing a task this way, you MUST not only be sure that it has
been completed successfully--you must ALSO be sure that all its subtasks
are ready to be marked the same way.
If, and only if, ALL tasks have already been marked verified,
you MUST respond with the `finish` action.
## History
Here is a recent history of actions you've taken in service of this plan,
as well as observations you've made. This only includes the MOST RECENT
ten actions--more happened before that.
[
{
"action": "modify_task",
"args": {
"id": "0",
"state": "in_progress",
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": "I need to write a shell script called 'hello.sh' that contains the necessary command to print 'hello'. This will likely involve using echo or printf to output the text to the console when the script is run. I should start by creating and writing the content to the file."
}
},
{
"action": "write",
"args": {
"path": "hello.sh",
"content": "#!/bin/bash\necho 'hello'",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "write",
"content": "",
"extras": {
"path": "hello.sh"
}
}
]
Your most recent action is at the bottom of that history.
## Action
What is your next thought or action? Your response must be in JSON format.
It must be an object, and it must contain two fields:
* `action`, which is one of the actions below
* `args`, which is a map of key-value pairs, specifying the arguments for that action
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write
* `content` - the content to write to the file
* `run` - runs a command on the command line in a Linux shell. Arguments:
* `command` - the command to run
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
* `kill` - kills a background command
* `id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `add_task` - add a task to your plan. Arguments:
* `parent` - the ID of the parent task
* `goal` - the goal of the task
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
* `modify_task` - close a task. Arguments:
* `id` - the ID of the task to close
* `state` - set to 'in_progress' to start the task, 'completed' to finish it, 'verified' to assert that it was successful, 'abandoned' to give up on it permanently, or `open` to stop working on it for now.
* `finish` - if ALL of your tasks and subtasks have been verified or abandoned, and you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, and recall actions.
You should never act twice in a row without thinking. But if your last several
actions are all `think` actions, you should consider taking a different action.
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
You just changed a file. You should think about how it affects your plan.

View File

@ -1,135 +0,0 @@
----------
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
You've been given the following task:
Write a shell script 'hello.sh' that prints 'hello'.
## Plan
As you complete this task, you're building a plan and keeping
track of your progress. Here's a JSON representation of your plan:
{
"id": "0",
"goal": "Write a shell script 'hello.sh' that prints 'hello'.",
"state": "in_progress",
"subtasks": []
}
You're currently working on this task:
Write a shell script 'hello.sh' that prints 'hello'..
If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW.
You're responsible for managing this plan and the status of tasks in
it, by using the `add_task` and `modify_task` actions described below.
If the History below contradicts the state of any of these tasks, you
MUST modify the task using the `modify_task` action described below.
Be sure NOT to duplicate any tasks. Do NOT use the `add_task` action for
a task that's already represented. Every task must be represented only once.
Tasks that are sequential MUST be siblings. They must be added in order
to their parent task.
If you mark a task as 'completed', 'verified', or 'abandoned',
all non-abandoned subtasks will be marked the same way.
So before closing a task this way, you MUST not only be sure that it has
been completed successfully--you must ALSO be sure that all its subtasks
are ready to be marked the same way.
If, and only if, ALL tasks have already been marked verified,
you MUST respond with the `finish` action.
## History
Here is a recent history of actions you've taken in service of this plan,
as well as observations you've made. This only includes the MOST RECENT
ten actions--more happened before that.
[
{
"action": "modify_task",
"args": {
"id": "0",
"state": "in_progress",
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": "I need to write a shell script called 'hello.sh' that contains the necessary command to print 'hello'. This will likely involve using echo or printf to output the text to the console when the script is run. I should start by creating and writing the content to the file."
}
},
{
"action": "write",
"args": {
"path": "hello.sh",
"content": "#!/bin/bash\necho 'hello'",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "write",
"content": "",
"extras": {
"path": "hello.sh"
}
},
{
"action": "think",
"args": {
"thought": "Now that the script 'hello.sh' has been written and contains the appropriate command to print 'hello', the next logical step is to ensure it works as expected. I should proceed to run the script to verify its output."
}
}
]
Your most recent action is at the bottom of that history.
## Action
What is your next thought or action? Your response must be in JSON format.
It must be an object, and it must contain two fields:
* `action`, which is one of the actions below
* `args`, which is a map of key-value pairs, specifying the arguments for that action
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write
* `content` - the content to write to the file
* `run` - runs a command on the command line in a Linux shell. Arguments:
* `command` - the command to run
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
* `kill` - kills a background command
* `id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `add_task` - add a task to your plan. Arguments:
* `parent` - the ID of the parent task
* `goal` - the goal of the task
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
* `modify_task` - close a task. Arguments:
* `id` - the ID of the task to close
* `state` - set to 'in_progress' to start the task, 'completed' to finish it, 'verified' to assert that it was successful, 'abandoned' to give up on it permanently, or `open` to stop working on it for now.
* `finish` - if ALL of your tasks and subtasks have been verified or abandoned, and you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, and recall actions.
You should never act twice in a row without thinking. But if your last several
actions are all `think` actions, you should consider taking a different action.
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
Look at your last thought in the history above. What does it suggest? Don't think anymore--take action.

View File

@ -1,152 +0,0 @@
----------
# Task
You're a diligent software engineer AI. You can't see, draw, or interact with a
browser, but you can read and write files, and you can run commands, and you can think.
You've been given the following task:
Write a shell script 'hello.sh' that prints 'hello'.
## Plan
As you complete this task, you're building a plan and keeping
track of your progress. Here's a JSON representation of your plan:
{
"id": "0",
"goal": "Write a shell script 'hello.sh' that prints 'hello'.",
"state": "in_progress",
"subtasks": []
}
You're currently working on this task:
Write a shell script 'hello.sh' that prints 'hello'..
If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW.
You're responsible for managing this plan and the status of tasks in
it, by using the `add_task` and `modify_task` actions described below.
If the History below contradicts the state of any of these tasks, you
MUST modify the task using the `modify_task` action described below.
Be sure NOT to duplicate any tasks. Do NOT use the `add_task` action for
a task that's already represented. Every task must be represented only once.
Tasks that are sequential MUST be siblings. They must be added in order
to their parent task.
If you mark a task as 'completed', 'verified', or 'abandoned',
all non-abandoned subtasks will be marked the same way.
So before closing a task this way, you MUST not only be sure that it has
been completed successfully--you must ALSO be sure that all its subtasks
are ready to be marked the same way.
If, and only if, ALL tasks have already been marked verified,
you MUST respond with the `finish` action.
## History
Here is a recent history of actions you've taken in service of this plan,
as well as observations you've made. This only includes the MOST RECENT
ten actions--more happened before that.
[
{
"action": "modify_task",
"args": {
"id": "0",
"state": "in_progress",
"thought": ""
}
},
{
"action": "think",
"args": {
"thought": "I need to write a shell script called 'hello.sh' that contains the necessary command to print 'hello'. This will likely involve using echo or printf to output the text to the console when the script is run. I should start by creating and writing the content to the file."
}
},
{
"action": "write",
"args": {
"path": "hello.sh",
"content": "#!/bin/bash\necho 'hello'",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"observation": "write",
"content": "",
"extras": {
"path": "hello.sh"
}
},
{
"action": "think",
"args": {
"thought": "Now that the script 'hello.sh' has been written and contains the appropriate command to print 'hello', the next logical step is to ensure it works as expected. I should proceed to run the script to verify its output."
}
},
{
"action": "run",
"args": {
"command": "bash hello.sh",
"background": false,
"thought": ""
}
},
{
"observation": "run",
"content": "hello",
"extras": {
"command_id": -1,
"command": "bash hello.sh",
"exit_code": 0
}
}
]
Your most recent action is at the bottom of that history.
## Action
What is your next thought or action? Your response must be in JSON format.
It must be an object, and it must contain two fields:
* `action`, which is one of the actions below
* `args`, which is a map of key-value pairs, specifying the arguments for that action
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write
* `content` - the content to write to the file
* `run` - runs a command on the command line in a Linux shell. Arguments:
* `command` - the command to run
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
* `kill` - kills a background command
* `id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `think` - make a plan, set a goal, or record your thoughts. Arguments:
* `thought` - the thought to record
* `add_task` - add a task to your plan. Arguments:
* `parent` - the ID of the parent task
* `goal` - the goal of the task
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
* `modify_task` - close a task. Arguments:
* `id` - the ID of the task to close
* `state` - set to 'in_progress' to start the task, 'completed' to finish it, 'verified' to assert that it was successful, 'abandoned' to give up on it permanently, or `open` to stop working on it for now.
* `finish` - if ALL of your tasks and subtasks have been verified or abandoned, and you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
You MUST take time to think in between read, write, run, browse, and recall actions.
You should never act twice in a row without thinking. But if your last several
actions are all `think` actions, you should consider taking a different action.
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
You should think about the command you just ran, what output it gave, and how that affects your plan.

View File

@ -1,9 +1 @@
```json
{
"action": "modify_task",
"args": {
"id": "0",
"state": "in_progress"
}
}
```
{"action": "write", "args": {"path": "hello.sh", "content": "#!/bin/bash\n\necho 'hello'"}}

View File

@ -1,8 +1,7 @@
```json
{
"action": "think",
"action": "modify_task",
"args": {
"thought": "I need to write a shell script called 'hello.sh' that contains the necessary command to print 'hello'. This will likely involve using echo or printf to output the text to the console when the script is run. I should start by creating and writing the content to the file."
"id": "0",
"state": "completed"
}
}
```

View File

@ -1,9 +0,0 @@
```json
{
"action": "write",
"args": {
"path": "hello.sh",
"content": "#!/bin/bash\necho 'hello'"
}
}
```

View File

@ -1,6 +0,0 @@
{
"action": "think",
"args": {
"thought": "Now that the script 'hello.sh' has been written and contains the appropriate command to print 'hello', the next logical step is to ensure it works as expected. I should proceed to run the script to verify its output."
}
}

View File

@ -1,9 +0,0 @@
```json
{
"action": "run",
"args": {
"command": "bash hello.sh",
"background": false
}
}
```

View File

@ -1,10 +0,0 @@
```json
{
"action": "modify_task",
"args": {
"id": "0",
"state": "verified",
"thought": "The shell script 'hello.sh' has been run and verified to successfully output 'hello'. This completes the primary task requirement."
}
}
```

View File

@ -101,7 +101,7 @@ Action:
Do not provide anything extra just your thought and action.
You are currently trying to complete this task:
Write a shell script 'hello.sh' that prints 'hello'.
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
None

View File

@ -67,7 +67,7 @@ args:
start: 0
end: -1
thought: Thoughts:
To solve the task of writing a shell script named 'hello.sh' that prints 'hello', I need to create a new file named 'hello.sh'. I will then write the necessary shell script code into this file.
I need to create a shell script named 'hello.sh' that prints 'hello' when executed. I will use the 'write' command to create the script with the required content.
Action:
@ -127,7 +127,7 @@ Action:
Do not provide anything extra just your thought and action.
You are currently trying to complete this task:
Write a shell script 'hello.sh' that prints 'hello'.
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
CURRENT WORKSPACE:
Open File: hello.sh on line 0

View File

@ -67,7 +67,7 @@ args:
start: 0
end: -1
thought: Thoughts:
To solve the task of writing a shell script named 'hello.sh' that prints 'hello', I need to create a new file named 'hello.sh'. I will then write the necessary shell script code into this file.
I need to create a shell script named 'hello.sh' that prints 'hello' when executed. I will use the 'write' command to create the script with the required content.
Action:
@ -85,7 +85,7 @@ args:
start: 0
end: -1
thought: Thoughts:
The task is to write a shell script named 'hello.sh' that prints 'hello'. I have already created the file 'hello.sh' in a previous step. Now, I need to write the shell script code into this file. The script should include the shebang line to specify the shell interpreter and a command to print 'hello'.
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
@ -145,7 +145,7 @@ Action:
Do not provide anything extra just your thought and action.
You are currently trying to complete this task:
Write a shell script 'hello.sh' that prints 'hello'.
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
CURRENT WORKSPACE:
Open File: hello.sh on line 0

View File

@ -67,7 +67,7 @@ args:
start: 0
end: -1
thought: Thoughts:
To solve the task of writing a shell script named 'hello.sh' that prints 'hello', I need to create a new file named 'hello.sh'. I will then write the necessary shell script code into this file.
I need to create a shell script named 'hello.sh' that prints 'hello' when executed. I will use the 'write' command to create the script with the required content.
Action:
@ -85,7 +85,7 @@ args:
start: 0
end: -1
thought: Thoughts:
The task is to write a shell script named 'hello.sh' that prints 'hello'. I have already created the file 'hello.sh' in a previous step. Now, I need to write the shell script code into this file. The script should include the shebang line to specify the shell interpreter and a command to print 'hello'.
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
@ -97,21 +97,19 @@ extras:
Memory 2:
Previous Action:
action: read
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to verify the contents of the 'hello.sh' script to ensure that it correctly contains the shell script code to print 'hello'. This involves checking if the shebang line is present and if the print command is correctly written. If the script is correct, I can then proceed to test it to confirm its functionality.
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: read
content: #!/bin/bash
echo "hello"
observation: write
content:
extras:
path: hello.sh
======= End Actions =======
@ -165,7 +163,7 @@ Action:
Do not provide anything extra just your thought and action.
You are currently trying to complete this task:
Write a shell script 'hello.sh' that prints 'hello'.
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
CURRENT WORKSPACE:
Open File: hello.sh on line 0

View File

@ -67,7 +67,7 @@ args:
start: 0
end: -1
thought: Thoughts:
To solve the task of writing a shell script named 'hello.sh' that prints 'hello', I need to create a new file named 'hello.sh'. I will then write the necessary shell script code into this file.
I need to create a shell script named 'hello.sh' that prints 'hello' when executed. I will use the 'write' command to create the script with the required content.
Action:
@ -85,7 +85,7 @@ args:
start: 0
end: -1
thought: Thoughts:
The task is to write a shell script named 'hello.sh' that prints 'hello'. I have already created the file 'hello.sh' in a previous step. Now, I need to write the shell script code into this file. The script should include the shebang line to specify the shell interpreter and a command to print 'hello'.
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
@ -97,39 +97,39 @@ extras:
Memory 2:
Previous Action:
action: read
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to verify the contents of the 'hello.sh' script to ensure that it correctly contains the shell script code to print 'hello'. This involves checking if the shebang line is present and if the print command is correctly written. If the script is correct, I can then proceed to test it to confirm its functionality.
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: read
content: #!/bin/bash
echo "hello"
observation: write
content:
extras:
path: hello.sh
Memory 3:
Previous Action:
action: run
action: write
args:
command: bash hello.sh
background: False
thought:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: run
content: hello
observation: write
content:
extras:
command_id: -1
command: bash hello.sh
exit_code: 0
path: hello.sh
======= End Actions =======
Use these memories to provide additional context to the problem you are solving.
Remember that you have already completed these steps so you do not need to perform them again.
@ -181,7 +181,7 @@ Action:
Do not provide anything extra just your thought and action.
You are currently trying to complete this task:
Write a shell script 'hello.sh' that prints 'hello'.
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
CURRENT WORKSPACE:
Open File: hello.sh on line 0

View File

@ -0,0 +1,199 @@
----------
SYSTEM INFO:
You am an autonomous coding agent, here to provide solutions for coding issues.
You have been designed to assist you with a wide range of programming tasks, from code editing and debugging to testing and deployment.
You have access to a variety of tools and commands that you can use to help you solve problems efficiently.
INSTRUCTIONS:
Now, you're going to solve this issue on your own. You can use any bash commands or custom commands you wish to complete your task. Edit all the files you need to and run any checks or tests that you want.
Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.
When you're satisfied with all of the changes you've made, you can indicate that you are done by running the exit command.
Note however that you cannot use any interactive session commands (e.g. python, vim, node) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.
NOTE ABOUT THE write COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!
IMPORTANT TIPS:
1. Reproduce the bug: Always start by trying to replicate the bug that the issue discusses. If the issue includes code for reproducing the bug, we recommend that you re-implement that in your environment and run it to ensure you can reproduce the bug. Then, start trying to fix it. When you think you've fixed the bug, re-run the bug reproduction script to make sure that the issue has indeed been resolved.
If the bug reproduction script does not print anything when it successfully runs, we recommend adding a print("Script completed successfully, no errors.") command at the end of the file, so that you can be sure the script ran fine all the way through.
2. Try different commands: If you run a command and it doesn't work, try running a different command. A command that did not work once will not work the second time unless you modify it.
3. Navigate large files: If you open a file and need to get to an area around a specific line that is not in the first 100 lines, say line 583, you would use the 'read' command like this: 'read <file> 583'. This is a much faster way to read through the file.
4. Handle input files: If the bug reproduction script requires inputting/reading a specific file, such as 'buggy-input.png', and you'd like to understand how to input that file, conduct a search in the existing repository code to see whether someone else has already done that. Do this by running the command: 'search_dir "buggy-input.png"'. If that doesn't work, use the Linux 'find' command.
5. Understand your context: Always make sure to look at the currently open file and the current working directory. The currently open file might be in a different directory than the working directory.
6. Verify your edits: When editing files, it is easy to accidentally specify a wrong line number or to write code with incorrect indentation. Always check the code after you issue an edit to make sure that it reflects what you wanted to accomplish. If it didn't, issue another command to fix it.
7. Thoroughly test your solution: After making any changes to fix a bug, be sure to thoroughly test your solution to ensure the bug has been resolved. Re-run the bug reproduction script and verify that the issue has been addressed.
DOCUMENTATION:
It is recommend that you use the commands provided for interacting with files and your directory because they have been specially built for you.
They will make it much easier for you to look at files and make changes. Using these commands will help you be better at your task.
You can open an file by using either the read or write operations.
- If a file already exists you should read it before making any changes. Use the `edit` command to make changes once you have read it.
- If you are creating a new file use the write command. Use the `edit` command to make changes once you have created the new file.
Commands:
exit - Executed when task is complete
read <file_name> [<start_line>] [<end_line>] - Shows a given file's contents starting from <start_line> up to <end_line>. Default: start_line = 0, end_line = -1. By default the whole file will be read.
write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replacing the current lines between <start_line> and <end_line> with <changes>. Default start_line = 0 and end_line = -1. Calling this with no line args will replace the whole file.
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
ls - Use the ls command to view all the files in your current directory, this is a good starting point.
NOT ALLOWED - You cannot use interactive commands like python or node
Custom bash commands:
None
The following commands require an open file to be used: edit, scroll_up, scroll_down, goto
To modify the current file use 'edit'. To move through the current file use 'goto' or 'scroll_up'/'scroll_down'
when using write and edit do not surround the code with any "" just write the code.
----------
These are your past 4 actions:
===== Previous Actions =====
Memory 0:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 1:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 2:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 3:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
======= End Actions =======
Use these memories to provide additional context to the problem you are solving.
Remember that you have already completed these steps so you do not need to perform them again.
----------
RESPONSE FORMAT:
This is the format of the response you will make in order to solve the current issue.
You will be given multiple iterations to complete this task so break it into steps and solve them one by one.
Your output must contain the following:
- First, thoughts about what your next action should be and plan it out.
- You will have a memory of your thoughts so you can use this to remember things for the next step.
- Use your thoughts to think about what you are currently doing, what you have done on prior steps and how that relates to solving the problem.
- Second, create a piece of code that will execute your next action based on the thoughts you have.
- Remember that you can only have one action for each thought, do not include multiple actions.
Your code MUST be surrounded in triple back ticks EXACTLY like this:
```
<code>
```
Notes:
- Adhere to the format so that the program loop continues smoothly, it is very important to only give one command per output.
- DO NOT give more than one command within the triple backticks. This will just throw an error and nothing will happen as a result.
- Do not give multiple code blocks, if you do only the second one will be captured and run, this might give an error if the first one was necessary.
- To execute multiple commands you should write them down in your thoughts section so you can remember it on the next step and execute them then.
- The only commands you are not capable of executing are interactive commands like `python` or `node` by themselves.
- If you think that you have completed the task that has been given to you based on your previous actions and outputs then use ``` exit ``` as the command to let the system know that you are done.
- DO NOT make any copies of your previous memories those will be provided to you at each step, making copies just wastes time and energy. Think smarter not harder.
- The write and edit commands requires proper indentation in the content section ex. `write hw.py def hello():
print('Hello World')` this is how you would have to format your write command.
- The white spaces matter as the code changes will be added to the code so they must have proper syntax.
This is a template using the format described above
Items in <> are suggestions for you, fill them out based on the context of the problem you are solving.
[ FORMAT ]
Thoughts:
<Provide clear and concise thoughts on the next step to take, highlighting any important details or context that should be remembered.>
<You can use multiple lines to express your thoughts>
Action:
```
<command> <params>
```
[ END FORMAT ]
Do not provide anything extra just your thought and action.
You are currently trying to complete this task:
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
CURRENT WORKSPACE:
Open File: hello.sh on line 0
You can use these commands with the current file:
Navigation: `scroll_up`, `scroll_down`, and `goto <line>`
Modification: `edit <start_line> <end_line> <changes>`
Keep all of the guidelines above in mind when you are thinking and making code.
Please come up with a thought and action based on your current task and latest steps.
Make sure that you do not repeat the same actions, there will not be any changes in result if you do not changes anything.
Be very strict about the formatting that you use and make sure you follow the guidelines.
NEVER output multiple commands. ONLY take ONE STEP at a time.
When you have completed your task run the "exit" command.
Begin with your thought about the next step and then come up with an action to perform your thought.

View File

@ -0,0 +1,199 @@
----------
SYSTEM INFO:
You am an autonomous coding agent, here to provide solutions for coding issues.
You have been designed to assist you with a wide range of programming tasks, from code editing and debugging to testing and deployment.
You have access to a variety of tools and commands that you can use to help you solve problems efficiently.
INSTRUCTIONS:
Now, you're going to solve this issue on your own. You can use any bash commands or custom commands you wish to complete your task. Edit all the files you need to and run any checks or tests that you want.
Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.
When you're satisfied with all of the changes you've made, you can indicate that you are done by running the exit command.
Note however that you cannot use any interactive session commands (e.g. python, vim, node) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.
NOTE ABOUT THE write COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!
IMPORTANT TIPS:
1. Reproduce the bug: Always start by trying to replicate the bug that the issue discusses. If the issue includes code for reproducing the bug, we recommend that you re-implement that in your environment and run it to ensure you can reproduce the bug. Then, start trying to fix it. When you think you've fixed the bug, re-run the bug reproduction script to make sure that the issue has indeed been resolved.
If the bug reproduction script does not print anything when it successfully runs, we recommend adding a print("Script completed successfully, no errors.") command at the end of the file, so that you can be sure the script ran fine all the way through.
2. Try different commands: If you run a command and it doesn't work, try running a different command. A command that did not work once will not work the second time unless you modify it.
3. Navigate large files: If you open a file and need to get to an area around a specific line that is not in the first 100 lines, say line 583, you would use the 'read' command like this: 'read <file> 583'. This is a much faster way to read through the file.
4. Handle input files: If the bug reproduction script requires inputting/reading a specific file, such as 'buggy-input.png', and you'd like to understand how to input that file, conduct a search in the existing repository code to see whether someone else has already done that. Do this by running the command: 'search_dir "buggy-input.png"'. If that doesn't work, use the Linux 'find' command.
5. Understand your context: Always make sure to look at the currently open file and the current working directory. The currently open file might be in a different directory than the working directory.
6. Verify your edits: When editing files, it is easy to accidentally specify a wrong line number or to write code with incorrect indentation. Always check the code after you issue an edit to make sure that it reflects what you wanted to accomplish. If it didn't, issue another command to fix it.
7. Thoroughly test your solution: After making any changes to fix a bug, be sure to thoroughly test your solution to ensure the bug has been resolved. Re-run the bug reproduction script and verify that the issue has been addressed.
DOCUMENTATION:
It is recommend that you use the commands provided for interacting with files and your directory because they have been specially built for you.
They will make it much easier for you to look at files and make changes. Using these commands will help you be better at your task.
You can open an file by using either the read or write operations.
- If a file already exists you should read it before making any changes. Use the `edit` command to make changes once you have read it.
- If you are creating a new file use the write command. Use the `edit` command to make changes once you have created the new file.
Commands:
exit - Executed when task is complete
read <file_name> [<start_line>] [<end_line>] - Shows a given file's contents starting from <start_line> up to <end_line>. Default: start_line = 0, end_line = -1. By default the whole file will be read.
write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replacing the current lines between <start_line> and <end_line> with <changes>. Default start_line = 0 and end_line = -1. Calling this with no line args will replace the whole file.
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
ls - Use the ls command to view all the files in your current directory, this is a good starting point.
NOT ALLOWED - You cannot use interactive commands like python or node
Custom bash commands:
None
The following commands require an open file to be used: edit, scroll_up, scroll_down, goto
To modify the current file use 'edit'. To move through the current file use 'goto' or 'scroll_up'/'scroll_down'
when using write and edit do not surround the code with any "" just write the code.
----------
These are your past 4 actions:
===== Previous Actions =====
Memory 0:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 1:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 2:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 3:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
======= End Actions =======
Use these memories to provide additional context to the problem you are solving.
Remember that you have already completed these steps so you do not need to perform them again.
----------
RESPONSE FORMAT:
This is the format of the response you will make in order to solve the current issue.
You will be given multiple iterations to complete this task so break it into steps and solve them one by one.
Your output must contain the following:
- First, thoughts about what your next action should be and plan it out.
- You will have a memory of your thoughts so you can use this to remember things for the next step.
- Use your thoughts to think about what you are currently doing, what you have done on prior steps and how that relates to solving the problem.
- Second, create a piece of code that will execute your next action based on the thoughts you have.
- Remember that you can only have one action for each thought, do not include multiple actions.
Your code MUST be surrounded in triple back ticks EXACTLY like this:
```
<code>
```
Notes:
- Adhere to the format so that the program loop continues smoothly, it is very important to only give one command per output.
- DO NOT give more than one command within the triple backticks. This will just throw an error and nothing will happen as a result.
- Do not give multiple code blocks, if you do only the second one will be captured and run, this might give an error if the first one was necessary.
- To execute multiple commands you should write them down in your thoughts section so you can remember it on the next step and execute them then.
- The only commands you are not capable of executing are interactive commands like `python` or `node` by themselves.
- If you think that you have completed the task that has been given to you based on your previous actions and outputs then use ``` exit ``` as the command to let the system know that you are done.
- DO NOT make any copies of your previous memories those will be provided to you at each step, making copies just wastes time and energy. Think smarter not harder.
- The write and edit commands requires proper indentation in the content section ex. `write hw.py def hello():
print('Hello World')` this is how you would have to format your write command.
- The white spaces matter as the code changes will be added to the code so they must have proper syntax.
This is a template using the format described above
Items in <> are suggestions for you, fill them out based on the context of the problem you are solving.
[ FORMAT ]
Thoughts:
<Provide clear and concise thoughts on the next step to take, highlighting any important details or context that should be remembered.>
<You can use multiple lines to express your thoughts>
Action:
```
<command> <params>
```
[ END FORMAT ]
Do not provide anything extra just your thought and action.
You are currently trying to complete this task:
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
CURRENT WORKSPACE:
Open File: hello.sh on line 0
You can use these commands with the current file:
Navigation: `scroll_up`, `scroll_down`, and `goto <line>`
Modification: `edit <start_line> <end_line> <changes>`
Keep all of the guidelines above in mind when you are thinking and making code.
Please come up with a thought and action based on your current task and latest steps.
Make sure that you do not repeat the same actions, there will not be any changes in result if you do not changes anything.
Be very strict about the formatting that you use and make sure you follow the guidelines.
NEVER output multiple commands. ONLY take ONE STEP at a time.
When you have completed your task run the "exit" command.
Begin with your thought about the next step and then come up with an action to perform your thought.

View File

@ -0,0 +1,199 @@
----------
SYSTEM INFO:
You am an autonomous coding agent, here to provide solutions for coding issues.
You have been designed to assist you with a wide range of programming tasks, from code editing and debugging to testing and deployment.
You have access to a variety of tools and commands that you can use to help you solve problems efficiently.
INSTRUCTIONS:
Now, you're going to solve this issue on your own. You can use any bash commands or custom commands you wish to complete your task. Edit all the files you need to and run any checks or tests that you want.
Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.
When you're satisfied with all of the changes you've made, you can indicate that you are done by running the exit command.
Note however that you cannot use any interactive session commands (e.g. python, vim, node) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.
NOTE ABOUT THE write COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!
IMPORTANT TIPS:
1. Reproduce the bug: Always start by trying to replicate the bug that the issue discusses. If the issue includes code for reproducing the bug, we recommend that you re-implement that in your environment and run it to ensure you can reproduce the bug. Then, start trying to fix it. When you think you've fixed the bug, re-run the bug reproduction script to make sure that the issue has indeed been resolved.
If the bug reproduction script does not print anything when it successfully runs, we recommend adding a print("Script completed successfully, no errors.") command at the end of the file, so that you can be sure the script ran fine all the way through.
2. Try different commands: If you run a command and it doesn't work, try running a different command. A command that did not work once will not work the second time unless you modify it.
3. Navigate large files: If you open a file and need to get to an area around a specific line that is not in the first 100 lines, say line 583, you would use the 'read' command like this: 'read <file> 583'. This is a much faster way to read through the file.
4. Handle input files: If the bug reproduction script requires inputting/reading a specific file, such as 'buggy-input.png', and you'd like to understand how to input that file, conduct a search in the existing repository code to see whether someone else has already done that. Do this by running the command: 'search_dir "buggy-input.png"'. If that doesn't work, use the Linux 'find' command.
5. Understand your context: Always make sure to look at the currently open file and the current working directory. The currently open file might be in a different directory than the working directory.
6. Verify your edits: When editing files, it is easy to accidentally specify a wrong line number or to write code with incorrect indentation. Always check the code after you issue an edit to make sure that it reflects what you wanted to accomplish. If it didn't, issue another command to fix it.
7. Thoroughly test your solution: After making any changes to fix a bug, be sure to thoroughly test your solution to ensure the bug has been resolved. Re-run the bug reproduction script and verify that the issue has been addressed.
DOCUMENTATION:
It is recommend that you use the commands provided for interacting with files and your directory because they have been specially built for you.
They will make it much easier for you to look at files and make changes. Using these commands will help you be better at your task.
You can open an file by using either the read or write operations.
- If a file already exists you should read it before making any changes. Use the `edit` command to make changes once you have read it.
- If you are creating a new file use the write command. Use the `edit` command to make changes once you have created the new file.
Commands:
exit - Executed when task is complete
read <file_name> [<start_line>] [<end_line>] - Shows a given file's contents starting from <start_line> up to <end_line>. Default: start_line = 0, end_line = -1. By default the whole file will be read.
write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replacing the current lines between <start_line> and <end_line> with <changes>. Default start_line = 0 and end_line = -1. Calling this with no line args will replace the whole file.
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
ls - Use the ls command to view all the files in your current directory, this is a good starting point.
NOT ALLOWED - You cannot use interactive commands like python or node
Custom bash commands:
None
The following commands require an open file to be used: edit, scroll_up, scroll_down, goto
To modify the current file use 'edit'. To move through the current file use 'goto' or 'scroll_up'/'scroll_down'
when using write and edit do not surround the code with any "" just write the code.
----------
These are your past 4 actions:
===== Previous Actions =====
Memory 0:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 1:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 2:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 3:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
======= End Actions =======
Use these memories to provide additional context to the problem you are solving.
Remember that you have already completed these steps so you do not need to perform them again.
----------
RESPONSE FORMAT:
This is the format of the response you will make in order to solve the current issue.
You will be given multiple iterations to complete this task so break it into steps and solve them one by one.
Your output must contain the following:
- First, thoughts about what your next action should be and plan it out.
- You will have a memory of your thoughts so you can use this to remember things for the next step.
- Use your thoughts to think about what you are currently doing, what you have done on prior steps and how that relates to solving the problem.
- Second, create a piece of code that will execute your next action based on the thoughts you have.
- Remember that you can only have one action for each thought, do not include multiple actions.
Your code MUST be surrounded in triple back ticks EXACTLY like this:
```
<code>
```
Notes:
- Adhere to the format so that the program loop continues smoothly, it is very important to only give one command per output.
- DO NOT give more than one command within the triple backticks. This will just throw an error and nothing will happen as a result.
- Do not give multiple code blocks, if you do only the second one will be captured and run, this might give an error if the first one was necessary.
- To execute multiple commands you should write them down in your thoughts section so you can remember it on the next step and execute them then.
- The only commands you are not capable of executing are interactive commands like `python` or `node` by themselves.
- If you think that you have completed the task that has been given to you based on your previous actions and outputs then use ``` exit ``` as the command to let the system know that you are done.
- DO NOT make any copies of your previous memories those will be provided to you at each step, making copies just wastes time and energy. Think smarter not harder.
- The write and edit commands requires proper indentation in the content section ex. `write hw.py def hello():
print('Hello World')` this is how you would have to format your write command.
- The white spaces matter as the code changes will be added to the code so they must have proper syntax.
This is a template using the format described above
Items in <> are suggestions for you, fill them out based on the context of the problem you are solving.
[ FORMAT ]
Thoughts:
<Provide clear and concise thoughts on the next step to take, highlighting any important details or context that should be remembered.>
<You can use multiple lines to express your thoughts>
Action:
```
<command> <params>
```
[ END FORMAT ]
Do not provide anything extra just your thought and action.
You are currently trying to complete this task:
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
CURRENT WORKSPACE:
Open File: hello.sh on line 0
You can use these commands with the current file:
Navigation: `scroll_up`, `scroll_down`, and `goto <line>`
Modification: `edit <start_line> <end_line> <changes>`
Keep all of the guidelines above in mind when you are thinking and making code.
Please come up with a thought and action based on your current task and latest steps.
Make sure that you do not repeat the same actions, there will not be any changes in result if you do not changes anything.
Be very strict about the formatting that you use and make sure you follow the guidelines.
NEVER output multiple commands. ONLY take ONE STEP at a time.
When you have completed your task run the "exit" command.
Begin with your thought about the next step and then come up with an action to perform your thought.

View File

@ -0,0 +1,199 @@
----------
SYSTEM INFO:
You am an autonomous coding agent, here to provide solutions for coding issues.
You have been designed to assist you with a wide range of programming tasks, from code editing and debugging to testing and deployment.
You have access to a variety of tools and commands that you can use to help you solve problems efficiently.
INSTRUCTIONS:
Now, you're going to solve this issue on your own. You can use any bash commands or custom commands you wish to complete your task. Edit all the files you need to and run any checks or tests that you want.
Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.
When you're satisfied with all of the changes you've made, you can indicate that you are done by running the exit command.
Note however that you cannot use any interactive session commands (e.g. python, vim, node) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.
NOTE ABOUT THE write COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!
IMPORTANT TIPS:
1. Reproduce the bug: Always start by trying to replicate the bug that the issue discusses. If the issue includes code for reproducing the bug, we recommend that you re-implement that in your environment and run it to ensure you can reproduce the bug. Then, start trying to fix it. When you think you've fixed the bug, re-run the bug reproduction script to make sure that the issue has indeed been resolved.
If the bug reproduction script does not print anything when it successfully runs, we recommend adding a print("Script completed successfully, no errors.") command at the end of the file, so that you can be sure the script ran fine all the way through.
2. Try different commands: If you run a command and it doesn't work, try running a different command. A command that did not work once will not work the second time unless you modify it.
3. Navigate large files: If you open a file and need to get to an area around a specific line that is not in the first 100 lines, say line 583, you would use the 'read' command like this: 'read <file> 583'. This is a much faster way to read through the file.
4. Handle input files: If the bug reproduction script requires inputting/reading a specific file, such as 'buggy-input.png', and you'd like to understand how to input that file, conduct a search in the existing repository code to see whether someone else has already done that. Do this by running the command: 'search_dir "buggy-input.png"'. If that doesn't work, use the Linux 'find' command.
5. Understand your context: Always make sure to look at the currently open file and the current working directory. The currently open file might be in a different directory than the working directory.
6. Verify your edits: When editing files, it is easy to accidentally specify a wrong line number or to write code with incorrect indentation. Always check the code after you issue an edit to make sure that it reflects what you wanted to accomplish. If it didn't, issue another command to fix it.
7. Thoroughly test your solution: After making any changes to fix a bug, be sure to thoroughly test your solution to ensure the bug has been resolved. Re-run the bug reproduction script and verify that the issue has been addressed.
DOCUMENTATION:
It is recommend that you use the commands provided for interacting with files and your directory because they have been specially built for you.
They will make it much easier for you to look at files and make changes. Using these commands will help you be better at your task.
You can open an file by using either the read or write operations.
- If a file already exists you should read it before making any changes. Use the `edit` command to make changes once you have read it.
- If you are creating a new file use the write command. Use the `edit` command to make changes once you have created the new file.
Commands:
exit - Executed when task is complete
read <file_name> [<start_line>] [<end_line>] - Shows a given file's contents starting from <start_line> up to <end_line>. Default: start_line = 0, end_line = -1. By default the whole file will be read.
write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replacing the current lines between <start_line> and <end_line> with <changes>. Default start_line = 0 and end_line = -1. Calling this with no line args will replace the whole file.
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
ls - Use the ls command to view all the files in your current directory, this is a good starting point.
NOT ALLOWED - You cannot use interactive commands like python or node
Custom bash commands:
None
The following commands require an open file to be used: edit, scroll_up, scroll_down, goto
To modify the current file use 'edit'. To move through the current file use 'goto' or 'scroll_up'/'scroll_down'
when using write and edit do not surround the code with any "" just write the code.
----------
These are your past 4 actions:
===== Previous Actions =====
Memory 0:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 1:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 2:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 3:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
======= End Actions =======
Use these memories to provide additional context to the problem you are solving.
Remember that you have already completed these steps so you do not need to perform them again.
----------
RESPONSE FORMAT:
This is the format of the response you will make in order to solve the current issue.
You will be given multiple iterations to complete this task so break it into steps and solve them one by one.
Your output must contain the following:
- First, thoughts about what your next action should be and plan it out.
- You will have a memory of your thoughts so you can use this to remember things for the next step.
- Use your thoughts to think about what you are currently doing, what you have done on prior steps and how that relates to solving the problem.
- Second, create a piece of code that will execute your next action based on the thoughts you have.
- Remember that you can only have one action for each thought, do not include multiple actions.
Your code MUST be surrounded in triple back ticks EXACTLY like this:
```
<code>
```
Notes:
- Adhere to the format so that the program loop continues smoothly, it is very important to only give one command per output.
- DO NOT give more than one command within the triple backticks. This will just throw an error and nothing will happen as a result.
- Do not give multiple code blocks, if you do only the second one will be captured and run, this might give an error if the first one was necessary.
- To execute multiple commands you should write them down in your thoughts section so you can remember it on the next step and execute them then.
- The only commands you are not capable of executing are interactive commands like `python` or `node` by themselves.
- If you think that you have completed the task that has been given to you based on your previous actions and outputs then use ``` exit ``` as the command to let the system know that you are done.
- DO NOT make any copies of your previous memories those will be provided to you at each step, making copies just wastes time and energy. Think smarter not harder.
- The write and edit commands requires proper indentation in the content section ex. `write hw.py def hello():
print('Hello World')` this is how you would have to format your write command.
- The white spaces matter as the code changes will be added to the code so they must have proper syntax.
This is a template using the format described above
Items in <> are suggestions for you, fill them out based on the context of the problem you are solving.
[ FORMAT ]
Thoughts:
<Provide clear and concise thoughts on the next step to take, highlighting any important details or context that should be remembered.>
<You can use multiple lines to express your thoughts>
Action:
```
<command> <params>
```
[ END FORMAT ]
Do not provide anything extra just your thought and action.
You are currently trying to complete this task:
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
CURRENT WORKSPACE:
Open File: hello.sh on line 0
You can use these commands with the current file:
Navigation: `scroll_up`, `scroll_down`, and `goto <line>`
Modification: `edit <start_line> <end_line> <changes>`
Keep all of the guidelines above in mind when you are thinking and making code.
Please come up with a thought and action based on your current task and latest steps.
Make sure that you do not repeat the same actions, there will not be any changes in result if you do not changes anything.
Be very strict about the formatting that you use and make sure you follow the guidelines.
NEVER output multiple commands. ONLY take ONE STEP at a time.
When you have completed your task run the "exit" command.
Begin with your thought about the next step and then come up with an action to perform your thought.

View File

@ -0,0 +1,199 @@
----------
SYSTEM INFO:
You am an autonomous coding agent, here to provide solutions for coding issues.
You have been designed to assist you with a wide range of programming tasks, from code editing and debugging to testing and deployment.
You have access to a variety of tools and commands that you can use to help you solve problems efficiently.
INSTRUCTIONS:
Now, you're going to solve this issue on your own. You can use any bash commands or custom commands you wish to complete your task. Edit all the files you need to and run any checks or tests that you want.
Remember, YOU CAN ONLY ENTER ONE COMMAND AT A TIME. You should always wait for feedback after every command.
When you're satisfied with all of the changes you've made, you can indicate that you are done by running the exit command.
Note however that you cannot use any interactive session commands (e.g. python, vim, node) in this environment, but you can write scripts and run them. E.g. you can write a python script and then run it with `python <script_name>.py`.
NOTE ABOUT THE write COMMAND: Indentation really matters! When editing a file, make sure to insert appropriate indentation before each line!
IMPORTANT TIPS:
1. Reproduce the bug: Always start by trying to replicate the bug that the issue discusses. If the issue includes code for reproducing the bug, we recommend that you re-implement that in your environment and run it to ensure you can reproduce the bug. Then, start trying to fix it. When you think you've fixed the bug, re-run the bug reproduction script to make sure that the issue has indeed been resolved.
If the bug reproduction script does not print anything when it successfully runs, we recommend adding a print("Script completed successfully, no errors.") command at the end of the file, so that you can be sure the script ran fine all the way through.
2. Try different commands: If you run a command and it doesn't work, try running a different command. A command that did not work once will not work the second time unless you modify it.
3. Navigate large files: If you open a file and need to get to an area around a specific line that is not in the first 100 lines, say line 583, you would use the 'read' command like this: 'read <file> 583'. This is a much faster way to read through the file.
4. Handle input files: If the bug reproduction script requires inputting/reading a specific file, such as 'buggy-input.png', and you'd like to understand how to input that file, conduct a search in the existing repository code to see whether someone else has already done that. Do this by running the command: 'search_dir "buggy-input.png"'. If that doesn't work, use the Linux 'find' command.
5. Understand your context: Always make sure to look at the currently open file and the current working directory. The currently open file might be in a different directory than the working directory.
6. Verify your edits: When editing files, it is easy to accidentally specify a wrong line number or to write code with incorrect indentation. Always check the code after you issue an edit to make sure that it reflects what you wanted to accomplish. If it didn't, issue another command to fix it.
7. Thoroughly test your solution: After making any changes to fix a bug, be sure to thoroughly test your solution to ensure the bug has been resolved. Re-run the bug reproduction script and verify that the issue has been addressed.
DOCUMENTATION:
It is recommend that you use the commands provided for interacting with files and your directory because they have been specially built for you.
They will make it much easier for you to look at files and make changes. Using these commands will help you be better at your task.
You can open an file by using either the read or write operations.
- If a file already exists you should read it before making any changes. Use the `edit` command to make changes once you have read it.
- If you are creating a new file use the write command. Use the `edit` command to make changes once you have created the new file.
Commands:
exit - Executed when task is complete
read <file_name> [<start_line>] [<end_line>] - Shows a given file's contents starting from <start_line> up to <end_line>. Default: start_line = 0, end_line = -1. By default the whole file will be read.
write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replacing the current lines between <start_line> and <end_line> with <changes>. Default start_line = 0 and end_line = -1. Calling this with no line args will replace the whole file.
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
ls - Use the ls command to view all the files in your current directory, this is a good starting point.
NOT ALLOWED - You cannot use interactive commands like python or node
Custom bash commands:
None
The following commands require an open file to be used: edit, scroll_up, scroll_down, goto
To modify the current file use 'edit'. To move through the current file use 'goto' or 'scroll_up'/'scroll_down'
when using write and edit do not surround the code with any "" just write the code.
----------
These are your past 4 actions:
===== Previous Actions =====
Memory 0:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 1:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 2:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
Memory 3:
Previous Action:
action: write
args:
path: hello.sh
start: 0
end: -1
thought: Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
Output from Action:
observation: write
content:
extras:
path: hello.sh
======= End Actions =======
Use these memories to provide additional context to the problem you are solving.
Remember that you have already completed these steps so you do not need to perform them again.
----------
RESPONSE FORMAT:
This is the format of the response you will make in order to solve the current issue.
You will be given multiple iterations to complete this task so break it into steps and solve them one by one.
Your output must contain the following:
- First, thoughts about what your next action should be and plan it out.
- You will have a memory of your thoughts so you can use this to remember things for the next step.
- Use your thoughts to think about what you are currently doing, what you have done on prior steps and how that relates to solving the problem.
- Second, create a piece of code that will execute your next action based on the thoughts you have.
- Remember that you can only have one action for each thought, do not include multiple actions.
Your code MUST be surrounded in triple back ticks EXACTLY like this:
```
<code>
```
Notes:
- Adhere to the format so that the program loop continues smoothly, it is very important to only give one command per output.
- DO NOT give more than one command within the triple backticks. This will just throw an error and nothing will happen as a result.
- Do not give multiple code blocks, if you do only the second one will be captured and run, this might give an error if the first one was necessary.
- To execute multiple commands you should write them down in your thoughts section so you can remember it on the next step and execute them then.
- The only commands you are not capable of executing are interactive commands like `python` or `node` by themselves.
- If you think that you have completed the task that has been given to you based on your previous actions and outputs then use ``` exit ``` as the command to let the system know that you are done.
- DO NOT make any copies of your previous memories those will be provided to you at each step, making copies just wastes time and energy. Think smarter not harder.
- The write and edit commands requires proper indentation in the content section ex. `write hw.py def hello():
print('Hello World')` this is how you would have to format your write command.
- The white spaces matter as the code changes will be added to the code so they must have proper syntax.
This is a template using the format described above
Items in <> are suggestions for you, fill them out based on the context of the problem you are solving.
[ FORMAT ]
Thoughts:
<Provide clear and concise thoughts on the next step to take, highlighting any important details or context that should be remembered.>
<You can use multiple lines to express your thoughts>
Action:
```
<command> <params>
```
[ END FORMAT ]
Do not provide anything extra just your thought and action.
You are currently trying to complete this task:
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
CURRENT WORKSPACE:
Open File: hello.sh on line 0
You can use these commands with the current file:
Navigation: `scroll_up`, `scroll_down`, and `goto <line>`
Modification: `edit <start_line> <end_line> <changes>`
Keep all of the guidelines above in mind when you are thinking and making code.
Please come up with a thought and action based on your current task and latest steps.
Make sure that you do not repeat the same actions, there will not be any changes in result if you do not changes anything.
Be very strict about the formatting that you use and make sure you follow the guidelines.
NEVER output multiple commands. ONLY take ONE STEP at a time.
When you have completed your task run the "exit" command.
Begin with your thought about the next step and then come up with an action to perform your thought.

View File

@ -1,8 +1,7 @@
Thoughts:
To solve the task of writing a shell script named 'hello.sh' that prints 'hello', I need to create a new file named 'hello.sh'. I will then write the necessary shell script code into this file.
I need to create a shell script named 'hello.sh' that prints 'hello' when executed. I will use the 'write' command to create the script with the required content.
Action:
```
write hello.sh #!/bin/bash
echo "hello"
write hello.sh "echo 'hello'"
```

View File

@ -1,8 +1,7 @@
Thoughts:
The task is to write a shell script named 'hello.sh' that prints 'hello'. I have already created the file 'hello.sh' in a previous step. Now, I need to write the shell script code into this file. The script should include the shebang line to specify the shell interpreter and a command to print 'hello'.
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
```
write hello.sh #!/bin/bash
echo "hello"
edit 0 -1 "echo 'hello'"
```

View File

@ -1,7 +1,7 @@
Thoughts:
I need to verify the contents of the 'hello.sh' script to ensure that it correctly contains the shell script code to print 'hello'. This involves checking if the shebang line is present and if the print command is correctly written. If the script is correct, I can then proceed to test it to confirm its functionality.
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
```
read hello.sh
edit 0 -1 "echo 'hello'"
```

View File

@ -1,7 +1,7 @@
Thoughts:
The shell script 'hello.sh' has been written and contains the necessary commands to print 'hello'. The next step is to test the script to ensure it functions as expected. This involves running the script and checking the output. If the script runs successfully and prints 'hello', then the task is completed.
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
```
bash hello.sh
edit 0 -1 "echo 'hello'"
```

View File

@ -1,7 +1,7 @@
Thoughts:
The shell script 'hello.sh' has been successfully created and tested, and it correctly prints 'hello' as required. The script includes the shebang line and the echo command to print 'hello'. Since the script is functioning as expected and meets the task requirements, there are no further modifications or tests needed. It's time to conclude this task.
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
```
exit
edit 0 -1 "echo 'hello'"
```

View File

@ -0,0 +1,7 @@
Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
```
edit 0 -1 "echo 'hello'"
```

View File

@ -0,0 +1,7 @@
Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
```
edit 0 -1 "echo 'hello'"
```

View File

@ -0,0 +1,7 @@
Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
```
edit 0 -1 "echo 'hello'"
```

View File

@ -0,0 +1,7 @@
Thoughts:
I have already created the 'hello.sh' file, and now I need to add the code to the file that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
```
edit 0 -1 "echo 'hello'"
```

View File

@ -0,0 +1,7 @@
Thoughts:
I need to add the code to the 'hello.sh' script that will print 'hello' when executed. I will use the 'edit' command to add the necessary code to the file.
Action:
```
edit 0 -1 "echo 'hello'"
```

26
tests/integration/regenerate.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
set -eo pipefail
WORKSPACE_MOUNT_PATH=$(pwd)/workspace
# FIXME: SWEAgent hangs, so it goes last
agents=("MonologueAgent" "CodeActAgent" "PlannerAgent" "SWEAgent")
for agent in "${agents[@]}"; do
echo -e "\n\n\n\n========Generating test data for $agent========\n\n\n\n"
rm -rf logs
rm -rf _test_workspace
rm -rf tests/integration/mock/$agent/test_write_simple_script/*
mkdir _test_workspace
echo -e "/exit\n" | poetry run python ./opendevin/core/main.py \
-i 10 \
-t "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point." \
-c $agent \
-d "./_test_workspace"
mv logs/llm/**/* tests/integration/mock/$agent/test_write_simple_script/
done
rm -rf logs
rm -rf _test_workspace
echo "Done!"

View File

@ -14,7 +14,7 @@ from opendevin.core.main import main
reason='CodeActAgent does not support exec sandbox since exec sandbox is NOT stateful',
)
def test_write_simple_script():
task = "Write a shell script 'hello.sh' that prints 'hello'."
task = "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point."
asyncio.run(main(task))
# Verify the script file exists

View File

@ -8,8 +8,7 @@ from opendevin.core import config
from opendevin.core.schema.config import ConfigType
from opendevin.events.action.github import GitHubPushAction, GitHubSendPRAction
from opendevin.events.observation.commands import CmdOutputObservation
from opendevin.events.observation.error import AgentErrorObservation
from opendevin.events.observation.message import AgentMessageObservation
from opendevin.events.observation.error import ErrorObservation
from opendevin.events.stream import EventStream
from opendevin.llm.llm import LLM
@ -74,8 +73,8 @@ async def test_run_push_error_missing_token(
result = await push_action.run(agent_controller)
# Verify the result is an error due to missing token
assert isinstance(result, AgentErrorObservation)
assert result.message == 'Oops. Something went wrong: GITHUB_TOKEN is not set'
assert isinstance(result, ErrorObservation)
assert result.message == 'GITHUB_TOKEN is not set'
@pytest.mark.asyncio
@ -101,7 +100,6 @@ async def test_run_pull_request_created_successfully(mock_post, agent_controller
result = await pr_action.run(agent_controller)
# Verify the result is a success observation
assert isinstance(result, AgentMessageObservation)
assert 'Pull request created successfully' in result.content
assert 'https://github.com/example/pull/1' in result.content
@ -129,7 +127,7 @@ async def test_run_pull_request_creation_failed(mock_post, agent_controller):
result = await pr_action.run(agent_controller)
# Verify the result is an error observation
assert isinstance(result, AgentErrorObservation)
assert isinstance(result, ErrorObservation)
assert 'Failed to create pull request' in result.content
assert 'Status code: 400' in result.content
assert 'Bad Request' in result.content
@ -150,5 +148,5 @@ async def test_run_error_missing_token(agent_controller):
result = await pr_action.run(agent_controller)
# Verify the result is an error due to missing token
assert isinstance(result, AgentErrorObservation)
assert isinstance(result, ErrorObservation)
assert 'GITHUB_TOKEN is not set' in result.message

View File

@ -3,13 +3,13 @@ from opendevin.events.action import (
AddTaskAction,
AgentFinishAction,
AgentRecallAction,
AgentThinkAction,
BrowseURLAction,
CmdKillAction,
CmdRunAction,
FileReadAction,
FileWriteAction,
GitHubPushAction,
MessageAction,
ModifyTaskAction,
action_from_dict,
)
@ -18,52 +18,55 @@ from opendevin.events.action import (
def serialization_deserialization(original_action_dict, cls):
action_instance = action_from_dict(original_action_dict)
assert isinstance(
action_instance, Action), 'The action instance should be an instance of Action.'
action_instance, Action
), 'The action instance should be an instance of Action.'
assert isinstance(
action_instance, cls), f'The action instance should be an instance of {cls.__name__}.'
action_instance, cls
), f'The action instance should be an instance of {cls.__name__}.'
serialized_action_dict = action_instance.to_dict()
serialized_action_memory = action_instance.to_memory()
serialized_action_dict.pop('message')
assert serialized_action_dict == original_action_dict, 'The serialized action should match the original action dict.'
assert serialized_action_memory == original_action_dict, 'The serialized action in memory should match the original action dict.'
assert (
serialized_action_dict == original_action_dict
), 'The serialized action should match the original action dict.'
assert (
serialized_action_memory == original_action_dict
), 'The serialized action in memory should match the original action dict.'
def test_agent_think_action_serialization_deserialization():
def test_message_action_serialization_deserialization():
original_action_dict = {
'action': 'think',
'args': {'thought': 'This is a test.'}
'action': 'message',
'args': {
'content': 'This is a test.',
'wait_for_response': False,
},
}
serialization_deserialization(original_action_dict, AgentThinkAction)
serialization_deserialization(original_action_dict, MessageAction)
def test_agent_recall_action_serialization_deserialization():
original_action_dict = {
'action': 'recall',
'args': {'query': 'Test query.', 'thought': ''}
'args': {'query': 'Test query.', 'thought': ''},
}
serialization_deserialization(original_action_dict, AgentRecallAction)
def test_agent_finish_action_serialization_deserialization():
original_action_dict = {
'action': 'finish',
'args': {'outputs': {}, 'thought': ''}
}
original_action_dict = {'action': 'finish', 'args': {'outputs': {}, 'thought': ''}}
serialization_deserialization(original_action_dict, AgentFinishAction)
def test_cmd_kill_action_serialization_deserialization():
original_action_dict = {
'action': 'kill',
'args': {'id': '1337', 'thought': ''}
}
original_action_dict = {'action': 'kill', 'args': {'id': '1337', 'thought': ''}}
serialization_deserialization(original_action_dict, CmdKillAction)
def test_cmd_run_action_serialization_deserialization():
original_action_dict = {
'action': 'run',
'args': {'command': 'echo "Hello world"', 'background': True, 'thought': ''}
'args': {'command': 'echo "Hello world"', 'background': True, 'thought': ''},
}
serialization_deserialization(original_action_dict, CmdRunAction)
@ -71,7 +74,7 @@ def test_cmd_run_action_serialization_deserialization():
def test_browse_url_action_serialization_deserialization():
original_action_dict = {
'action': 'browse',
'args': {'thought': '', 'url': 'https://www.example.com'}
'args': {'thought': '', 'url': 'https://www.example.com'},
}
serialization_deserialization(original_action_dict, BrowseURLAction)
@ -79,7 +82,7 @@ def test_browse_url_action_serialization_deserialization():
def test_github_push_action_serialization_deserialization():
original_action_dict = {
'action': 'push',
'args': {'owner': 'myname', 'repo': 'myrepo', 'branch': 'main'}
'args': {'owner': 'myname', 'repo': 'myrepo', 'branch': 'main'},
}
serialization_deserialization(original_action_dict, GitHubPushAction)
@ -87,7 +90,7 @@ def test_github_push_action_serialization_deserialization():
def test_file_read_action_serialization_deserialization():
original_action_dict = {
'action': 'read',
'args': {'path': '/path/to/file.txt', 'start': 0, 'end': -1, 'thought': 'None'}
'args': {'path': '/path/to/file.txt', 'start': 0, 'end': -1, 'thought': 'None'},
}
serialization_deserialization(original_action_dict, FileReadAction)
@ -95,7 +98,13 @@ def test_file_read_action_serialization_deserialization():
def test_file_write_action_serialization_deserialization():
original_action_dict = {
'action': 'write',
'args': {'path': '/path/to/file.txt', 'content': 'Hello world', 'start': 0, 'end': 1, 'thought': 'None'}
'args': {
'path': '/path/to/file.txt',
'content': 'Hello world',
'start': 0,
'end': 1,
'thought': 'None',
},
}
serialization_deserialization(original_action_dict, FileWriteAction)
@ -103,7 +112,12 @@ def test_file_write_action_serialization_deserialization():
def test_add_task_action_serialization_deserialization():
original_action_dict = {
'action': 'add_task',
'args': {'parent': 'Test parent', 'goal': 'Test goal', 'subtasks': [], 'thought': ''}
'args': {
'parent': 'Test parent',
'goal': 'Test goal',
'subtasks': [],
'thought': '',
},
}
serialization_deserialization(original_action_dict, AddTaskAction)
@ -111,6 +125,6 @@ def test_add_task_action_serialization_deserialization():
def test_modify_task_action_serialization_deserialization():
original_action_dict = {
'action': 'modify_task',
'args': {'id': 1, 'state': 'Test state.', 'thought': ''}
'args': {'id': 1, 'state': 'Test state.', 'thought': ''},
}
serialization_deserialization(original_action_dict, ModifyTaskAction)

View File

@ -13,12 +13,21 @@ def test_observation_serialization_deserialization():
'content': 'foo.txt',
}
observation_instance = observation_from_dict(original_observation_dict)
assert isinstance(observation_instance, Observation), 'The observation instance should be an instance of Action.'
assert isinstance(observation_instance, CmdOutputObservation), 'The observation instance should be an instance of AgentThinkAction.'
assert isinstance(
observation_instance, Observation
), 'The observation instance should be an instance of Action.'
assert isinstance(
observation_instance, CmdOutputObservation
), 'The observation instance should be an instance of CmdOutputObservation.'
serialized_observation_dict = observation_instance.to_dict()
serialized_observation_memory = observation_instance.to_memory()
assert serialized_observation_dict == original_observation_dict, 'The serialized observation should match the original observation dict.'
assert (
serialized_observation_dict == original_observation_dict
), 'The serialized observation should match the original observation dict.'
original_observation_dict.pop('message')
assert serialized_observation_memory == original_observation_dict, 'The serialized observation in memory should match the original observation dict.'
assert (
serialized_observation_memory == original_observation_dict
), 'The serialized observation in memory should match the original observation dict.'
# Additional tests for various observation subclasses can be included here

View File

@ -1,21 +1,24 @@
import pytest
from agenthub.micro.agent import parse_response, LLMOutputError
from agenthub.micro.agent import LLMOutputError, parse_response
from opendevin.events.action import (
AgentThinkAction,
FileWriteAction,
MessageAction,
)
def test_parse_single_complete_json():
input_response = """
{
"action": "think",
"action": "message",
"args": {
"thought": "The following typos were fixed:\\n* 'futur' -> 'future'\\n* 'imagin' -> 'imagine'\\n* 'techological' -> 'technological'\\n* 'responsability' -> 'responsibility'\\nThe corrected file is ./short_essay.txt."
"content": "The following typos were fixed:\\n* 'futur' -> 'future'\\n* 'imagin' -> 'imagine'\\n* 'techological' -> 'technological'\\n* 'responsability' -> 'responsibility'\\nThe corrected file is ./short_essay.txt."
}
}
"""
expected = AgentThinkAction(thought="The following typos were fixed:\n* 'futur' -> 'future'\n* 'imagin' -> 'imagine'\n* 'techological' -> 'technological'\n* 'responsability' -> 'responsibility'\nThe corrected file is ./short_essay.txt.")
expected = MessageAction(
"The following typos were fixed:\n* 'futur' -> 'future'\n* 'imagin' -> 'imagine'\n* 'techological' -> 'technological'\n* 'responsability' -> 'responsibility'\nThe corrected file is ./short_essay.txt."
)
assert parse_response(input_response) == expected
@ -31,7 +34,9 @@ def test_parse_json_with_surrounding_text():
}
Some trailing text that is also not JSON formatted.
"""
expected = FileWriteAction(path="./updated_file.txt", content="Updated text content here...")
expected = FileWriteAction(
path='./updated_file.txt', content='Updated text content here...'
)
assert parse_response(input_response) == expected
@ -53,7 +58,7 @@ def test_parse_first_of_multiple_jsons():
}
}
"""
expected = FileWriteAction(path="./short_essay.txt", content="Text content here...")
expected = FileWriteAction(path='./short_essay.txt', content='Text content here...')
assert parse_response(input_response) == expected