[Arch] Remove supports for Background Commands (#2803)

* depracting docker exec box

* remove doc exec from workflow and docs

* remove background commands

* Update tests/unit/test_sandbox.py

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

* replace for-loop with assignment

* fix integration tests

* fix integration tests for shell script

* fix integration tests

* increase max iter to fix some monologue agent issue

* fix integration test again

* fix integration tests (seems related to run_user issue)

---------

Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
Xingyao Wang 2024-07-06 03:38:05 +08:00 committed by GitHub
parent 99284da476
commit a47713ecb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
137 changed files with 3684 additions and 1433 deletions

View File

@ -29,7 +29,6 @@ The `state` contains:
Here is a list of available Actions, which can be returned by `agent.step()`:
- [`CmdRunAction`](../opendevin/events/action/commands.py) - Runs a command inside a sandboxed terminal
- [`CmdKillAction`](../opendevin/events/action/commands.py) - Kills a background command
- [`IPythonRunCellAction`](../opendevin/events/action/commands.py) - Execute a block of Python code interactively (in Jupyter notebook) and receives `CmdOutputObservation`. Requires setting up `jupyter` [plugin](../opendevin/runtime/plugins) as a requirement.
- [`FileReadAction`](../opendevin/events/action/files.py) - Reads the content of a file
- [`FileWriteAction`](../opendevin/events/action/files.py) - Writes new content to a file
@ -47,8 +46,7 @@ You can use `action.to_dict()` and `action_from_dict` to serialize and deseriali
## Observations
There are also several types of Observations. These are typically available in the step following the corresponding Action.
But they may also appear as a result of asynchronous events (e.g. a message from the user, logs from a command running
in the background).
But they may also appear as a result of asynchronous events (e.g. a message from the user).
Here is a list of available Observations:

View File

@ -173,7 +173,7 @@ class CodeActAgent(Agent):
This includes gathering info on previous steps and prompting the model to make a command to execute.
Parameters:
- state (State): used to get updated info and background commands
- state (State): used to get updated info
Returns:
- CmdRunAction(command) - bash command to run

View File

@ -31,7 +31,6 @@ from opendevin.llm.llm import LLM
"""
FIXME: There are a few problems this surfaced
* FileWrites seem to add an unintended newline at the end of the file
* Why isn't the output of the background command split between two steps?
* Browser not working
"""
@ -39,8 +38,6 @@ ActionObs = TypedDict(
'ActionObs', {'action': Action, 'observations': list[Observation]}
)
BACKGROUND_CMD = 'echo "This is in the background" && sleep .1 && echo "This too"'
class DummyAgent(Agent):
VERSION = '1.0'
@ -94,26 +91,10 @@ class DummyAgent(Agent):
)
],
},
{
'action': CmdRunAction(command=BACKGROUND_CMD, background=True),
'observations': [
CmdOutputObservation(
'Background command started. To stop it, send a `kill` action with command_id 42',
command_id=42,
command=BACKGROUND_CMD,
),
CmdOutputObservation(
'This is in the background\nThis too\n',
command_id=42,
command=BACKGROUND_CMD,
),
],
},
{
'action': AgentRecallAction(query='who am I?'),
'observations': [
AgentRecallObservation('', memories=['I am a computer.']),
# CmdOutputObservation('This too\n', command_id=42, command=BACKGROUND_CMD),
],
},
{

View File

@ -1,2 +0,0 @@
* `kill` - kills a background command
* `command_id` - the ID of the background command to kill

View File

@ -1,3 +1,2 @@
* `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.

View File

@ -41,8 +41,7 @@ ASSISTANT:
{
"action": "run",
"args": {
"command": "ls",
"background": false
"command": "ls"
}
}

View File

@ -168,10 +168,7 @@ class MonologueAgent(Agent):
# the action prompt with initial thoughts and recent events
prompt = prompts.get_request_action_prompt(
goal,
self.initial_thoughts,
recent_events,
state.background_commands_obs,
goal, self.initial_thoughts, recent_events
)
messages: list[dict[str, str]] = [

View File

@ -3,9 +3,6 @@ from opendevin.core.utils import json
from opendevin.events.action import (
Action,
)
from opendevin.events.observation import (
CmdOutputObservation,
)
from opendevin.events.serialization.action import action_from_dict
ACTION_PROMPT = """
@ -32,9 +29,6 @@ Here are the possible actions:
* `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
* `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:
@ -48,9 +42,7 @@ Here are the possible actions:
* `wait_for_response` - set to `true` to wait for the user to respond before proceeding
* `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, kill, browse, push, and recall actions--do this with the `message` action.
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 `message` actions, you should consider taking a different action.
@ -153,7 +145,6 @@ def get_request_action_prompt(
task: str,
thoughts: list[dict],
recent_events: list[dict],
background_commands_obs: list[CmdOutputObservation] | None = None,
):
"""
Gets the action prompt formatted with appropriate values.
@ -161,15 +152,11 @@ def get_request_action_prompt(
Parameters:
- task (str): The current task the agent is trying to accomplish
- thoughts (list[dict]): The agent's current thoughts
- background_commands_obs (list[CmdOutputObservation]): list of all observed background commands running
Returns:
- str: Formatted prompt string with hint, task, monologue, and background commands included
"""
if background_commands_obs is None:
background_commands_obs = []
hint = ''
if len(recent_events) > 0:
latest_event = recent_events[-1]
@ -187,15 +174,6 @@ def get_request_action_prompt(
else:
hint = "You're just getting started! What should you do first?"
bg_commands_message = ''
if len(background_commands_obs) > 0:
bg_commands_message = 'The following commands are running in the background:'
for command_obs in background_commands_obs:
bg_commands_message += (
f'\n`{command_obs.command_id}`: {command_obs.command}'
)
bg_commands_message += '\nYou can end any process by sending a `kill` action with the numerical `command_id` above.'
user = 'opendevin' if config.run_as_devin else 'root'
monologue = thoughts + recent_events
@ -203,7 +181,6 @@ def get_request_action_prompt(
return ACTION_PROMPT % {
'task': task,
'monologue': json.dumps(monologue, indent=2),
'background_commands': bg_commands_message,
'hint': hint,
'user': user,
'timeout': config.sandbox.timeout,

View File

@ -77,9 +77,6 @@ It must be an object, and it must contain two fields:
* `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
* `command_id` - the ID of the background command to kill
* `browse` - opens a web page. Arguments:
* `url` - the URL to open
* `message` - make a plan, set a goal, record your thoughts, or ask for more input from the user. Arguments:
@ -94,7 +91,7 @@ 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, kill, browse, and recall actions--do this with the `message` action.
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 `message` actions, you should consider taking a different action.

View File

@ -112,7 +112,6 @@ L'agent reçoit ses paires action-observation précédentes, la tâche actuelle,
`NullAction`,
`CmdRunAction`,
`CmdKillAction`,
`BrowseURLAction`,
`GithubPushAction`,
`FileReadAction`,

View File

@ -112,7 +112,6 @@ Planner agent利用特殊的提示策略为解决问题创建长期计划。
`NullAction`,
`CmdRunAction`,
`CmdKillAction`,
`BrowseURLAction`,
`GithubPushAction`,
`FileReadAction`,

View File

@ -107,7 +107,6 @@ The agent is given its previous action-observation pairs, current task, and hint
`NullAction`,
`CmdRunAction`,
`CmdKillAction`,
`BrowseURLAction`,
`GithubPushAction`,
`FileReadAction`,
@ -134,4 +133,4 @@ The agent is given its previous action-observation pairs, current task, and hint
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `__init__` | Initializes an agent with `llm` |
| `step` | Checks to see if current step is completed, returns `AgentFinishAction` if True. Otherwise, creates a plan prompt and sends to model for inference, adding the result as the next action. |
| `search_memory` | Not yet implemented |
| `search_memory` | Not yet implemented |

View File

@ -44,13 +44,8 @@ class opendevin.action.base.Action {
class opendevin.action.base.NullAction {
action: str
}
class opendevin.action.bash.CmdKillAction {
id: int
action: str
}
class opendevin.action.bash.CmdRunAction {
command: str
background: bool
action: str
}
class opendevin.action.browse.BrowseURLAction {
@ -133,7 +128,6 @@ class opendevin.plan.Plan {
class opendevin.state.State {
plan: Plan
iteration: int
background_commands_obs: List[CmdOutputObservation]
history: List[Tuple[Action, Observation]]
updated_info: List[Tuple[Action, Observation]]
}
@ -144,7 +138,6 @@ class opendevin.observation.CmdOutputObservation {
observation: str
}
class opendevin.sandbox.sandbox.DockerInteractive {
background_commands: Dict[int, BackgroundCommand] {static}
instance_id: None
instance_id: None
workspace_dir: None
@ -187,7 +180,6 @@ opendevin.action.base.NotExecutableAction <|-- opendevin.action.agent.AgentThink
opendevin.action.base.Action <|-- opendevin.action.base.ExecutableAction
opendevin.action.base.Action <|-- opendevin.action.base.NotExecutableAction
opendevin.action.base.NotExecutableAction <|-- opendevin.action.base.NullAction
opendevin.action.base.ExecutableAction <|-- opendevin.action.bash.CmdKillAction
opendevin.action.base.ExecutableAction <|-- opendevin.action.bash.CmdRunAction
opendevin.action.base.ExecutableAction <|-- opendevin.action.browse.BrowseURLAction
opendevin.observation.Observation <|-- opendevin.observation.BrowserOutputObservation
@ -208,7 +200,6 @@ opendevin.state.State *-- opendevin.observation.CmdOutputObservation
opendevin.state.State *-- opendevin.action.base.Action
opendevin.state.State *-- opendevin.observation.Observation
opendevin.observation.Observation <|-- opendevin.observation.CmdOutputObservation
opendevin.sandbox.sandbox.DockerInteractive *-- opendevin.sandbox.sandbox.BackgroundCommand
opendevin.observation.Observation <|-- opendevin.observation.UserMessageObservation
opendevin.plan.Task *-- opendevin.plan.Task
opendevin.server.session.Session *-- opendevin.controller.agent_controller.AgentController

View File

@ -365,10 +365,6 @@ if __name__ == '__main__':
else:
print('FAIL')
bg_cmd = sandbox.execute_in_background(
"while true; do echo 'dot ' && sleep 10; done"
)
sys.stdout.flush()
try:
while True:
@ -380,16 +376,9 @@ if __name__ == '__main__':
if user_input.lower() == 'exit':
logger.info('Exiting...')
break
if user_input.lower() == 'kill':
sandbox.kill_background(bg_cmd.pid)
logger.info('Background process killed')
continue
exit_code, output = sandbox.execute(user_input)
logger.info('exit code: %d', exit_code)
logger.info(output)
if bg_cmd.pid in sandbox.background_commands:
logs = sandbox.read_logs(bg_cmd.pid)
logger.info('background logs: %s', logs)
sys.stdout.flush()
except KeyboardInterrupt:
logger.info('Exiting...')

View File

@ -88,7 +88,6 @@ For each problem, OpenDevin is given a set number of iterations to fix the faili
"action": "run",
"args": {
"command": "open Python__2.py",
"background": false,
"thought": "Let's start by opening the Python__2.py file to see the current implementation of the function."
}
},
@ -116,7 +115,6 @@ For each problem, OpenDevin is given a set number of iterations to fix the faili
"action": "run",
"args": {
"command": "edit 2:2 <<EOF\n return number % 1.0\nEOF",
"background": false,
"thought": "The current implementation of the function `truncate_number` is incorrect because it adds 1.0 to the fractional part of the number. This is not necessary and is causing the function to fail the test cases. \n\nThe correct implementation should only return the fractional part of the number. This can be achieved by using the modulus operator with 1.0, which will return the fractional part of the number.\n\nLet's correct the function implementation."
}
},
@ -144,7 +142,6 @@ For each problem, OpenDevin is given a set number of iterations to fix the faili
"action": "run",
"args": {
"command": "python3 Python__2.py",
"background": false,
"thought": "The function `truncate_number` has been updated. Now, let's run the Python file to see if the test cases pass."
}
},

View File

@ -199,10 +199,6 @@ if __name__ == '__main__':
assert exit_code == 0, 'Failed to reset the repo'
logger.info(f'git reset --hard: {output}')
bg_cmd = sandbox.execute_in_background(
"while true; do echo 'dot ' && sleep 10; done"
)
sys.stdout.flush()
try:
while True:
@ -214,16 +210,9 @@ if __name__ == '__main__':
if user_input.lower() == 'exit':
logger.info('Exiting...')
break
if user_input.lower() == 'kill':
sandbox.kill_background(bg_cmd.pid)
logger.info('Background process killed')
continue
exit_code, output = sandbox.execute(user_input)
logger.info('exit code: %d', exit_code)
logger.info(output)
if bg_cmd.pid in sandbox.background_commands:
logs = sandbox.read_logs(bg_cmd.pid)
logger.info('background logs: %s', logs)
sys.stdout.flush()
except KeyboardInterrupt:
logger.info('Exiting...')

View File

@ -17,9 +17,6 @@ enum ActionType {
// Runs a IPython command.
RUN_IPYTHON = "run_ipython",
// Kills a background command.
KILL = "kill",
// Opens a web page.
BROWSE = "browse",

View File

@ -24,7 +24,6 @@ from opendevin.events.action import (
ModifyTaskAction,
NullAction,
)
from opendevin.events.action.commands import CmdKillAction
from opendevin.events.event import Event
from opendevin.events.observation import (
AgentDelegateObservation,
@ -469,9 +468,6 @@ class AgentController:
):
# for loop detection, ignore command_id, which is the pid
return obj1.command == obj2.command and obj1.exit_code == obj2.exit_code
elif isinstance(obj1, CmdKillAction) and isinstance(obj2, CmdKillAction):
# for loop detection, ignore command_id, which is the pid
return obj1.thought == obj2.thought
else:
# this is the default comparison
return obj1 == obj2

View File

@ -12,7 +12,6 @@ from opendevin.events.action import (
MessageAction,
)
from opendevin.events.observation import (
CmdOutputObservation,
Observation,
)
from opendevin.storage import get_file_store
@ -42,7 +41,6 @@ class State:
root_task: RootTask = field(default_factory=RootTask)
iteration: int = 0
max_iterations: int = 100
background_commands_obs: list[CmdOutputObservation] = field(default_factory=list)
history: list[tuple[Action, Observation]] = field(default_factory=list)
inputs: dict = field(default_factory=dict)
outputs: dict = field(default_factory=dict)

View File

@ -26,15 +26,6 @@ class AgentNotRegisteredError(Exception):
super().__init__(message)
class SandboxInvalidBackgroundCommandError(Exception):
def __init__(self, id=None):
if id is not None:
message = f'Invalid background command id {id}'
else:
message = 'Invalid background command id'
super().__init__(message)
class TaskInvalidStateError(Exception):
def __init__(self, state=None):
if state is not None:

View File

@ -31,7 +31,6 @@ ColorType = Literal[
]
LOG_COLORS: Mapping[str, ColorType] = {
'BACKGROUND LOG': 'blue',
'ACTION': 'green',
'OBSERVATION': 'yellow',
'DETAIL': 'cyan',

View File

@ -32,10 +32,6 @@ class ActionTypeSchema(BaseModel):
"""Runs a IPython cell.
"""
KILL: str = Field(default='kill')
"""Kills a background command.
"""
BROWSE: str = Field(default='browse')
"""Opens a web page.
"""

View File

@ -8,7 +8,7 @@ from .agent import (
ChangeAgentStateAction,
)
from .browse import BrowseInteractiveAction, BrowseURLAction
from .commands import CmdKillAction, CmdRunAction, IPythonRunCellAction
from .commands import CmdRunAction, IPythonRunCellAction
from .empty import NullAction
from .files import FileReadAction, FileWriteAction
from .message import MessageAction
@ -18,7 +18,6 @@ __all__ = [
'Action',
'NullAction',
'CmdRunAction',
'CmdKillAction',
'BrowseURLAction',
'BrowseInteractiveAction',
'FileReadAction',

View File

@ -9,7 +9,6 @@ from .action import Action
@dataclass
class CmdRunAction(Action):
command: str
background: bool = False
thought: str = ''
action: str = ActionType.RUN
runnable: ClassVar[bool] = True
@ -26,21 +25,6 @@ class CmdRunAction(Action):
return ret
@dataclass
class CmdKillAction(Action):
command_id: int
thought: str = ''
action: str = ActionType.KILL
runnable: ClassVar[bool] = True
@property
def message(self) -> str:
return f'Killing command: {self.command_id}'
def __str__(self) -> str:
return f'**CmdKillAction**\n{self.command_id}'
@dataclass
class IPythonRunCellAction(Action):
code: str

View File

@ -9,7 +9,6 @@ from opendevin.events.action.agent import (
)
from opendevin.events.action.browse import BrowseInteractiveAction, BrowseURLAction
from opendevin.events.action.commands import (
CmdKillAction,
CmdRunAction,
IPythonRunCellAction,
)
@ -20,7 +19,6 @@ from opendevin.events.action.tasks import AddTaskAction, ModifyTaskAction
actions = (
NullAction,
CmdKillAction,
CmdRunAction,
IPythonRunCellAction,
BrowseURLAction,

View File

@ -6,7 +6,6 @@ import sys
from opendevin.core.config import config
from opendevin.core.logger import opendevin_logger as logger
from opendevin.core.schema import CancellableStream
from opendevin.runtime.docker.process import DockerProcess, Process
from opendevin.runtime.sandbox import Sandbox
# ===============================================================================
@ -29,8 +28,6 @@ class LocalBox(Sandbox):
def __init__(self, timeout: int = config.sandbox.timeout):
os.makedirs(config.workspace_base, exist_ok=True)
self.timeout = timeout
self.background_commands: dict[int, Process] = {}
self.cur_background_id = 0
atexit.register(self.cleanup)
super().__init__()
@ -89,42 +86,8 @@ class LocalBox(Sandbox):
f'Failed to copy {host_src} to {sandbox_dest} in sandbox'
)
def execute_in_background(self, cmd: str) -> Process:
process = subprocess.Popen(
cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
cwd=config.workspace_base,
)
bg_cmd = DockerProcess(
id=self.cur_background_id, command=cmd, result=process, pid=process.pid
)
self.background_commands[self.cur_background_id] = bg_cmd
self.cur_background_id += 1
return bg_cmd
def kill_background(self, id: int):
if id not in self.background_commands:
raise ValueError('Invalid background command id')
bg_cmd = self.background_commands[id]
assert isinstance(bg_cmd, DockerProcess)
bg_cmd.result.terminate() # terminate the process
bg_cmd.result.wait() # wait for process to terminate
self.background_commands.pop(id)
def read_logs(self, id: int) -> str:
if id not in self.background_commands:
raise ValueError('Invalid background command id')
bg_cmd = self.background_commands[id]
assert isinstance(bg_cmd, DockerProcess)
output = bg_cmd.result.stdout.read()
return output.decode('utf-8')
def close(self):
for id, bg_cmd in list(self.background_commands.items()):
self.kill_background(id)
pass
def cleanup(self):
self.close()
@ -135,10 +98,6 @@ class LocalBox(Sandbox):
if __name__ == '__main__':
local_box = LocalBox()
bg_cmd = local_box.execute_in_background(
"while true; do echo 'dot ' && sleep 10; done"
)
sys.stdout.flush()
try:
while True:
@ -150,16 +109,9 @@ if __name__ == '__main__':
if user_input.lower() == 'exit':
logger.info('Exiting...')
break
if user_input.lower() == 'kill':
local_box.kill_background(bg_cmd.pid)
logger.info('Background process killed')
continue
exit_code, output = local_box.execute(user_input)
logger.info('exit code: %d', exit_code)
logger.info(output)
if bg_cmd.pid in local_box.background_commands:
logs = local_box.read_logs(bg_cmd.pid)
logger.info('background logs: %s', logs)
sys.stdout.flush()
except KeyboardInterrupt:
logger.info('Exiting...')

View File

@ -1,129 +0,0 @@
import select
import sys
from opendevin.runtime.process import Process
class DockerProcess(Process):
"""
Represents a background command execution
"""
def __init__(self, id: int, command: str, result, pid: int):
"""
Initialize a DockerProcess instance.
Args:
id (int): The identifier of the command.
command (str): The command to be executed.
result: The result of the command execution.
pid (int): The process ID (PID) of the command.
"""
self.id = id
self._command = command
self.result = result
self._pid = pid
@property
def pid(self) -> int:
return self._pid
@property
def command(self) -> str:
return self._command
def parse_docker_exec_output(self, logs: bytes) -> tuple[bytes, bytes]:
"""
When you execute a command using `exec` in a docker container, the output produced will be in bytes. this function parses the output of a Docker exec command.
Example:
Considering you have a docker container named `my_container` up and running
$ docker exec my_container echo "Hello OpenDevin!"
>> b'\x00\x00\x00\x00\x00\x00\x00\x13Hello OpenDevin!'
Such binary logs will be processed by this function.
The function handles message types, padding, and byte order to create a usable result. The primary goal is to convert raw container logs into a more structured format for further analysis or display.
The function also returns a tail of bytes to ensure that no information is lost. It is a way to handle edge cases and maintain data integrity.
>> output_bytes = b'\x00\x00\x00\x00\x00\x00\x00\x13Hello OpenDevin!'
>> parsed_output, remaining_bytes = parse_docker_exec_output(output_bytes)
>> print(parsed_output)
b'Hello OpenDevin!'
>> print(remaining_bytes)
b''
Args:
logs (bytes): The raw output logs of the command.
Returns:
tuple[bytes, bytes]: A tuple containing the parsed output and any remaining data.
"""
res = b''
tail = b''
i = 0
byte_order = sys.byteorder
while i < len(logs):
prefix = logs[i : i + 8]
if len(prefix) < 8:
msg_type = prefix[0:1]
if msg_type in [b'\x00', b'\x01', b'\x02', b'\x03']:
tail = prefix
break
msg_type = prefix[0:1]
padding = prefix[1:4]
if (
msg_type in [b'\x00', b'\x01', b'\x02', b'\x03']
and padding == b'\x00\x00\x00'
):
msg_length = int.from_bytes(prefix[4:8], byteorder=byte_order)
res += logs[i + 8 : i + 8 + msg_length]
i += 8 + msg_length
else:
res += logs[i : i + 1]
i += 1
return res, tail
def read_logs(self) -> str:
"""
Read and decode the logs of the command.
This function continuously reads the standard output of a subprocess and
processes the output using the parse_docker_exec_output function to handle
binary log messages. It concatenates and decodes the output bytes into a
string, ensuring that no partial messages are lost during reading.
Dummy Example:
>> cmd = 'echo "Hello OpenDevin!"'
>> result = subprocess.Popen(
cmd, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, text=True, cwd='.'
)
>> bg_cmd = DockerProcess(id, cmd = cmd, result = result, pid)
>> logs = bg_cmd.read_logs()
>> print(logs)
Hello OpenDevin!
Returns:
str: The decoded logs(string) of the command.
"""
# TODO: get an exit code if process is exited
logs = b''
last_remains = b''
while True:
ready_to_read, _, _ = select.select([self.result.output], [], [], 0.1) # type: ignore[has-type]
if ready_to_read:
data = self.result.output.read(4096) # type: ignore[has-type]
if not data:
break
chunk, last_remains = self.parse_docker_exec_output(last_remains + data)
logs += chunk
else:
break
return (logs + last_remains).decode('utf-8', errors='replace')

View File

@ -14,11 +14,9 @@ from tenacity import retry, stop_after_attempt, wait_fixed
from opendevin.core.config import config
from opendevin.core.const.guide_url import TROUBLESHOOTING_URL
from opendevin.core.exceptions import SandboxInvalidBackgroundCommandError
from opendevin.core.logger import opendevin_logger as logger
from opendevin.core.schema import CancellableStream
from opendevin.runtime.docker.image_agnostic_util import get_od_sandbox_image
from opendevin.runtime.docker.process import DockerProcess, Process
from opendevin.runtime.plugins import AgentSkillsRequirement, JupyterRequirement
from opendevin.runtime.sandbox import Sandbox
from opendevin.runtime.utils import find_available_tcp_port
@ -203,9 +201,6 @@ class DockerSSHBox(Sandbox):
_ssh_port: int
ssh: pxssh.pxssh
cur_background_id = 0
background_commands: dict[int, Process] = {}
def __init__(
self,
container_image: str | None = None,
@ -452,12 +447,6 @@ class DockerSSHBox(Sandbox):
else:
return ['/bin/bash', '-c', cmd]
def read_logs(self, id) -> str:
if id not in self.background_commands:
raise SandboxInvalidBackgroundCommandError()
bg_cmd = self.background_commands[id]
return bg_cmd.read_logs()
def _send_interrupt(
self,
cmd: str,
@ -579,46 +568,6 @@ class DockerSSHBox(Sandbox):
data = f.read()
self.container.put_archive(os.path.dirname(sandbox_dest), data)
def execute_in_background(self, cmd: str) -> Process:
result = self.container.exec_run(
self.get_exec_cmd(cmd),
socket=True,
workdir=self.sandbox_workspace_dir,
environment=self._env,
)
result.output._sock.setblocking(0)
pid = self.get_pid(cmd)
bg_cmd = DockerProcess(self.cur_background_id, cmd, result, pid)
self.background_commands[bg_cmd.pid] = bg_cmd
self.cur_background_id += 1
return bg_cmd
def get_pid(self, cmd):
exec_result = self.container.exec_run('ps aux', environment=self._env)
processes = exec_result.output.decode('utf-8').splitlines()
cmd = ' '.join(self.get_exec_cmd(cmd))
for process in processes:
if cmd in process:
pid = process.split()[1] # second column is the pid
return pid
return None
def kill_background(self, id: int) -> Process:
if id not in self.background_commands:
raise SandboxInvalidBackgroundCommandError()
bg_cmd = self.background_commands[id]
if bg_cmd.pid is not None:
self.container.exec_run(
f'kill -9 {bg_cmd.pid}',
workdir=self.sandbox_workspace_dir,
environment=self._env,
)
assert isinstance(bg_cmd, DockerProcess)
bg_cmd.result.output.close()
self.background_commands.pop(id)
return bg_cmd
def start_docker_container(self):
try:
container = self.docker_client.containers.get(self.container_name)
@ -800,10 +749,6 @@ if __name__ == '__main__':
'---'
)
bg_cmd = ssh_box.execute_in_background(
"while true; do echo -n '.' && sleep 10; done"
)
sys.stdout.flush()
try:
while True:
@ -815,16 +760,9 @@ if __name__ == '__main__':
if user_input.lower() == 'exit':
logger.info('Exiting...')
break
if user_input.lower() == 'kill':
ssh_box.kill_background(bg_cmd.pid)
logger.info('Background process killed')
continue
exit_code, output = ssh_box.execute(user_input)
logger.info('exit code: %d', exit_code)
logger.info(output)
if bg_cmd.pid in ssh_box.background_commands:
logs = ssh_box.read_logs(bg_cmd.pid)
logger.info('background logs: %s', logs)
sys.stdout.flush()
except KeyboardInterrupt:
logger.info('Exiting...')

View File

@ -1,27 +0,0 @@
from e2b import Process as E2BSandboxProcess
from opendevin.runtime.docker.process import Process
class E2BProcess(Process):
def __init__(self, process: E2BSandboxProcess, cmd: str):
self._process = process
self._command = cmd
def kill(self):
self._process.kill()
def read_logs(self):
return '\n'.join([m.line for m in self._process.output_messages])
@property
def pid(self) -> int:
return int(self._process.process_id)
@property
def command(self) -> str:
return self._command
@property
def output_messages(self):
return self._process.output_messages

View File

@ -10,15 +10,11 @@ from e2b.sandbox.exception import (
from opendevin.core.config import config
from opendevin.core.logger import opendevin_logger as logger
from opendevin.core.schema import CancellableStream
from opendevin.runtime.e2b.process import E2BProcess
from opendevin.runtime.process import Process
from opendevin.runtime.sandbox import Sandbox
class E2BBox(Sandbox):
closed = False
cur_background_id = 0
background_commands: dict[int, Process] = {}
_cwd: str = '/home/user'
def __init__(
@ -65,14 +61,6 @@ class E2BBox(Sandbox):
tar.add(host_src, arcname=srcname)
return tar_filename
# TODO: This won't work if we didn't wait for the background process to finish
def read_logs(self, process_id: int) -> str:
proc = self.background_commands.get(process_id)
if proc is None:
raise ValueError(f'Process {process_id} not found')
assert isinstance(proc, E2BProcess)
return '\n'.join([m.line for m in proc.output_messages])
def execute(
self, cmd: str, stream: bool = False, timeout: int | None = None
) -> tuple[int, str | CancellableStream]:
@ -121,21 +109,6 @@ class E2BBox(Sandbox):
# Delete the local archive
os.remove(tar_filename)
def execute_in_background(self, cmd: str) -> Process:
process = self.sandbox.process.start(cmd)
e2b_process = E2BProcess(process, cmd)
self.cur_background_id += 1
self.background_commands[self.cur_background_id] = e2b_process
return e2b_process
def kill_background(self, process_id: int):
process = self.background_commands.get(process_id)
if process is None:
raise ValueError(f'Process {process_id} not found')
assert isinstance(process, E2BProcess)
process.kill()
return process
def close(self):
self.sandbox.close()

View File

@ -1,4 +1,3 @@
import asyncio
from abc import abstractmethod
from typing import Any, Optional
@ -11,7 +10,6 @@ from opendevin.events.action import (
AgentRecallAction,
BrowseInteractiveAction,
BrowseURLAction,
CmdKillAction,
CmdRunAction,
FileReadAction,
FileWriteAction,
@ -19,7 +17,6 @@ from opendevin.events.action import (
)
from opendevin.events.event import Event
from opendevin.events.observation import (
CmdOutputObservation,
ErrorObservation,
NullObservation,
Observation,
@ -76,14 +73,12 @@ class Runtime:
self.file_store = InMemoryFileStore()
self.event_stream = event_stream
self.event_stream.subscribe(EventStreamSubscriber.RUNTIME, self.on_event)
self._bg_task = asyncio.create_task(self._start_background_observation_loop())
def close(self):
if not self._is_external_sandbox:
self.sandbox.close()
if self.browser is not None:
self.browser.close()
self._bg_task.cancel()
def init_sandbox_plugins(self, plugins: list[PluginRequirement]) -> None:
self.sandbox.init_plugins(plugins)
@ -132,36 +127,10 @@ class Runtime:
observation._parent = action.id # type: ignore[attr-defined]
return observation
async def _start_background_observation_loop(self):
while True:
await self.submit_background_obs()
await asyncio.sleep(1)
async def submit_background_obs(self):
"""
Returns all observations that have accumulated in the runtime's background.
Right now, this is just background commands, but could include e.g. asynchronous
events happening in the browser.
"""
for _id, cmd in self.sandbox.background_commands.items():
output = cmd.read_logs()
if output:
self.event_stream.add_event(
CmdOutputObservation(
content=output, command_id=_id, command=cmd.command
),
EventSource.AGENT, # FIXME: use the original action's source
)
await asyncio.sleep(1)
@abstractmethod
async def run(self, action: CmdRunAction) -> Observation:
pass
@abstractmethod
async def kill(self, action: CmdKillAction) -> Observation:
pass
@abstractmethod
async def run_ipython(self, action: IPythonRunCellAction) -> Observation:
pass

View File

@ -4,12 +4,10 @@ from abc import ABC, abstractmethod
from opendevin.core.config import config
from opendevin.core.schema import CancellableStream
from opendevin.runtime.docker.process import Process
from opendevin.runtime.plugins.mixin import PluginMixin
class Sandbox(ABC, PluginMixin):
background_commands: dict[int, Process] = {}
_env: dict[str, str] = {}
is_initial_session: bool = True
@ -33,18 +31,6 @@ class Sandbox(ABC, PluginMixin):
) -> tuple[int, str | CancellableStream]:
pass
@abstractmethod
def execute_in_background(self, cmd: str) -> Process:
pass
@abstractmethod
def kill_background(self, id: int) -> Process:
pass
@abstractmethod
def read_logs(self, id: int) -> str:
pass
@abstractmethod
def close(self):
pass

View File

@ -3,7 +3,6 @@ from opendevin.events.action import (
AgentRecallAction,
BrowseInteractiveAction,
BrowseURLAction,
CmdKillAction,
CmdRunAction,
FileReadAction,
FileWriteAction,
@ -36,27 +35,15 @@ class ServerRuntime(Runtime):
self.file_store = LocalFileStore(config.workspace_base)
async def run(self, action: CmdRunAction) -> Observation:
return self._run_command(action.command, background=action.background)
async def kill(self, action: CmdKillAction) -> Observation:
cmd = self.sandbox.kill_background(action.command_id)
return CmdOutputObservation(
content=f'Background command with id {action.command_id} has been killed.',
command_id=action.command_id,
command=cmd.command,
exit_code=0,
)
return self._run_command(action.command)
async def run_ipython(self, action: IPythonRunCellAction) -> Observation:
obs = self._run_command(
("cat > /tmp/opendevin_jupyter_temp.py <<'EOL'\n" f'{action.code}\n' 'EOL'),
background=False,
)
# run the code
obs = self._run_command(
('cat /tmp/opendevin_jupyter_temp.py | execute_cli'), background=False
)
obs = self._run_command('cat /tmp/opendevin_jupyter_temp.py | execute_cli')
output = obs.content
if 'pip install' in action.code:
print(output)
@ -74,19 +61,21 @@ class ServerRuntime(Runtime):
"cat > /tmp/opendevin_jupyter_temp.py <<'EOL'\n"
f'{restart_kernel}\n'
'EOL'
),
background=False,
)
)
obs = self._run_command(
('cat /tmp/opendevin_jupyter_temp.py | execute_cli'),
background=False,
'cat /tmp/opendevin_jupyter_temp.py | execute_cli'
)
output = '[Package installed successfully]'
if "{'status': 'ok', 'restart': True}" != obs.content.strip():
print(obs.content)
output += '\n[But failed to restart the kernel to load the package]'
output += (
'\n[But failed to restart the kernel to load the package]'
)
else:
output += '\n[Kernel restarted successfully to load the package]'
output += (
'\n[Kernel restarted successfully to load the package]'
)
# re-init the kernel after restart
if action.kernel_init_code:
@ -96,13 +85,14 @@ class ServerRuntime(Runtime):
f'{action.kernel_init_code}\n'
'EOL'
),
background=False,
)
obs = self._run_command(
'cat /tmp/opendevin_jupyter_init.py | execute_cli',
background=False,
)
elif is_single_package and f'Requirement already satisfied: {package_names}' in output:
elif (
is_single_package
and f'Requirement already satisfied: {package_names}' in output
):
output = '[Package already installed]'
return IPythonRunCellObservation(content=output, code=action.code)
@ -127,13 +117,7 @@ class ServerRuntime(Runtime):
async def recall(self, action: AgentRecallAction) -> Observation:
return NullObservation('')
def _run_command(self, command: str, background=False) -> Observation:
if background:
return self._run_background(command)
else:
return self._run_immediately(command)
def _run_immediately(self, command: str) -> Observation:
def _run_command(self, command: str) -> Observation:
try:
exit_code, output = self.sandbox.execute(command)
if 'pip install' in command:
@ -142,20 +126,13 @@ class ServerRuntime(Runtime):
print(output)
if 'Successfully installed' in output:
output = '[Package installed successfully]'
elif is_single_package and f'Requirement already satisfied: {package_names}' in output:
elif (
is_single_package
and f'Requirement already satisfied: {package_names}' in output
):
output = '[Package already installed]'
return CmdOutputObservation(
command_id=-1, content=str(output), command=command, exit_code=exit_code
)
except UnicodeDecodeError:
return ErrorObservation('Command output could not be decoded as utf-8')
def _run_background(self, command: str) -> Observation:
bg_cmd = self.sandbox.execute_in_background(command)
content = f'Background command started. To stop it, send a `kill` action with command_id {bg_cmd.pid}'
return CmdOutputObservation(
content=content,
command_id=bg_cmd.pid,
command=command,
exit_code=0,
)

View File

@ -60,9 +60,6 @@ This list may grow over time.
* `content` - the content to write to the file
* `run` - runs a command.
* `command` - the command to run
* `background` - if true, run the command in the background
* `kill` - kills a background command
* `id` - the ID of the background command to kill
* `browse` - opens a web page.
* `url` - the URL to open
* `recall` - searches long-term memory

View File

@ -217,16 +217,12 @@ async def websocket_endpoint(websocket: WebSocket):
```
- Run a command:
```json
{"action": "run", "args": {"command": "ls -l", "background": false, "thought": ""}}
{"action": "run", "args": {"command": "ls -l", "thought": ""}}
```
- Run an IPython command:
```json
{"action": "run_ipython", "args": {"command": "print('Hello, IPython!')"}}
```
- Kill a background command:
```json
{"action": "kill", "args": {"id": "command_id"}}
```
- Open a web page:
```json
{"action": "browse", "args": {"url": "https://arxiv.org/html/2402.01030v2"}}

View File

@ -388,4 +388,4 @@ NOW, LET'S START!
Browse localhost:8000, and tell me the ultimate answer to life. Do not ask me for confirmation at any point.
ENVIRONMENT REMINDER: You have 9 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 14 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -400,4 +400,4 @@ Certainly! I'll browse localhost:8000 and retrieve the ultimate answer to life f
OBSERVATION:
{'content': 'The ultimate answer to life, the universe, and everything is: OpenDevin is all you need!'}
ENVIRONMENT REMINDER: You have 8 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 13 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -388,4 +388,4 @@ NOW, LET'S START!
Fix typos in bad.txt. Do not ask me for confirmation at any point.
ENVIRONMENT REMINDER: You have 9 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 14 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -390,19 +390,15 @@ Fix typos in bad.txt. Do not ask me for confirmation at any point.
----------
Certainly! I'll fix the typos in the bad.txt file. Let's start by opening the file and examining its contents.
<execute_ipython>
open_file('bad.txt')
</execute_ipython>
Sure! Let's start by locating the `bad.txt` file and examining its contents.
<execute_bash>
find . -name "bad.txt"
</execute_bash>
----------
OBSERVATION:
[File: /workspace/bad.txt (4 lines total)]
1|This is a stupid typoo.
2|Really?
3|No mor typos!
4|Enjoy!
./bad.txt
[Command -1 finished with exit code 0]
ENVIRONMENT REMINDER: You have 8 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 13 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -390,9 +390,22 @@ Fix typos in bad.txt. Do not ask me for confirmation at any point.
----------
Certainly! I'll fix the typos in the bad.txt file. Let's start by opening the file and examining its contents.
Sure! Let's start by locating the `bad.txt` file and examining its contents.
<execute_bash>
find . -name "bad.txt"
</execute_bash>
----------
OBSERVATION:
./bad.txt
[Command -1 finished with exit code 0]
----------
Let's open the `bad.txt` file and review its contents to identify and fix any typos.
<execute_ipython>
open_file('bad.txt')
open_file('./bad.txt')
</execute_ipython>
----------
@ -405,28 +418,4 @@ OBSERVATION:
4|Enjoy!
----------
Thank you for showing me the contents of the file. I can see there are a few typos that need to be fixed. I'll correct them one by one.
Let's start with the first line:
<execute_ipython>
edit_file(
'bad.txt',
to_replace="This is a stupid typoo.",
new_content="This is a stupid typo."
)
</execute_ipython>
----------
OBSERVATION:
[File: /workspace/bad.txt (4 lines total after edit)]
1|This is a stupid typo.
2|Really?
3|No mor typos!
4|Enjoy!
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
ENVIRONMENT REMINDER: You have 7 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 12 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -390,9 +390,22 @@ Fix typos in bad.txt. Do not ask me for confirmation at any point.
----------
Certainly! I'll fix the typos in the bad.txt file. Let's start by opening the file and examining its contents.
Sure! Let's start by locating the `bad.txt` file and examining its contents.
<execute_bash>
find . -name "bad.txt"
</execute_bash>
----------
OBSERVATION:
./bad.txt
[Command -1 finished with exit code 0]
----------
Let's open the `bad.txt` file and review its contents to identify and fix any typos.
<execute_ipython>
open_file('bad.txt')
open_file('./bad.txt')
</execute_ipython>
----------
@ -407,36 +420,17 @@ OBSERVATION:
----------
Thank you for showing me the contents of the file. I can see there are a few typos that need to be fixed. I'll correct them one by one.
Let's correct the typos in the `bad.txt` file.
Let's start with the first line:
1. "stupid typoo" should be "stupid typo".
2. "No mor typos!" should be "No more typos!".
I will make these corrections now.
<execute_ipython>
edit_file(
'bad.txt',
to_replace="This is a stupid typoo.",
new_content="This is a stupid typo."
)
</execute_ipython>
----------
OBSERVATION:
[File: /workspace/bad.txt (4 lines total after edit)]
1|This is a stupid typo.
2|Really?
3|No mor typos!
4|Enjoy!
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
----------
Thank you for the update. Now let's fix the third line:
<execute_ipython>
edit_file(
'bad.txt',
to_replace="No mor typos!",
new_content="No more typos!"
'./bad.txt',
to_replace="This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!",
new_content="This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!"
)
</execute_ipython>
@ -451,4 +445,4 @@ OBSERVATION:
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
ENVIRONMENT REMINDER: You have 6 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 11 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -1,471 +0,0 @@
----------
A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.
The assistant can use an interactive Python (Jupyter Notebook) environment, executing code with <execute_ipython>.
<execute_ipython>
print("Hello World!")
</execute_ipython>
The assistant can execute bash commands on behalf of the user by wrapping them with <execute_bash> and </execute_bash>.
For example, you can list the files in the current directory by <execute_bash> ls </execute_bash>.
Important, however: do not run interactive commands. You do not have access to stdin.
Also, you need to handle commands that may run indefinitely and not return a result. For such cases, you should redirect the output to a file and run the command in the background to avoid blocking the execution.
For example, to run a Python script that might run indefinitely without returning immediately, you can use the following format: <execute_bash> python3 app.py > server.log 2>&1 & </execute_bash>
Also, if a command execution result saying like: Command: "npm start" timed out. Sending SIGINT to the process, you should also retry with running the command in the background.
The assistant can browse the Internet with <execute_browse> and </execute_browse>.
For example, <execute_browse> Tell me the usa's president using google search </execute_browse>.
Or <execute_browse> Tell me what is in http://example.com </execute_browse>.
The assistant can install Python packages using the %pip magic command in an IPython environment by using the following syntax: <execute_ipython> %pip install [package needed] </execute_ipython> and should always import packages and define variables before starting to use them.
To interact with GitHub, use the $GITHUB_TOKEN environment variable.
For example, to push a branch `my_branch` to the GitHub repo `owner/repo`:
<execute_bash> git push https://$GITHUB_TOKEN@github.com/owner/repo.git my_branch </execute_bash>
If $GITHUB_TOKEN is not set, ask the user to set it.
Apart from the standard Python library, the assistant can also use the following functions (already imported) in <execute_ipython> environment:
open_file(path: str, line_number: int | None = 1, context_lines: int | None = 100) -> None:
Opens the file at the given path in the editor. If line_number is provided, the window will be moved to include that line.
It only shows the first 100 lines by default! Max `context_lines` supported is 2000, use `scroll up/down`
to view the file if you want to see more.
Args:
path: str: The path to the file to open, preferred absolute path.
line_number: int | None = 1: The line number to move to. Defaults to 1.
context_lines: int | None = 100: Only shows this number of lines in the context window (usually from line 1), with line_number as the center (if possible). Defaults to 100.
goto_line(line_number: int) -> None:
Moves the window to show the specified line number.
Args:
line_number: int: The line number to move to.
scroll_down() -> None:
Moves the window down by 100 lines.
Args:
None
scroll_up() -> None:
Moves the window up by 100 lines.
Args:
None
create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Args:
filename: str: The name of the file to create.
edit_file(file_name: str, to_replace: str, new_content: str) -> None:
Edit a file. This will search for `to_replace` in the given file and replace it with `new_content`.
Every *to_replace* must *EXACTLY MATCH* the existing source code, character for character, including all comments, docstrings, etc.
Include enough lines to make code in `to_replace` unique. `to_replace` should NOT be empty.
`edit_file` will only replace the *first* matching occurrences.
For example, given a file "/workspace/example.txt" with the following content:
```
line 1
line 2
line 2
line 3
```
EDITING: If you want to replace the second occurrence of "line 2", you can make `to_replace` unique:
edit_file(
'/workspace/example.txt',
to_replace='line 2
line 3',
new_content='new line
line 3',
)
This will replace only the second "line 2" with "new line". The first "line 2" will remain unchanged.
The resulting file will be:
```
line 1
line 2
new line
line 3
```
REMOVAL: If you want to remove "line 2" and "line 3", you can set `new_content` to an empty string:
edit_file(
'/workspace/example.txt',
to_replace='line 2
line 3',
new_content='',
)
Args:
file_name: str: The name of the file to edit.
to_replace: str: The content to search for and replace.
new_content: str: The new content to replace the old content with.
insert_content_at_line(file_name: str, line_number: int, content: str) -> None:
Insert content at the given line number in a file.
This will NOT modify the content of the lines before OR after the given line number.
For example, if the file has the following content:
```
line 1
line 2
line 3
```
and you call `insert_content_at_line('file.txt', 2, 'new line')`, the file will be updated to:
```
line 1
new line
line 2
line 3
```
Args:
file_name: str: The name of the file to edit.
line_number: int: The line number (starting from 1) to insert the content after.
content: str: The content to insert.
search_dir(search_term: str, dir_path: str = './') -> None:
Searches for search_term in all files in dir. If dir is not provided, searches in the current directory.
Args:
search_term: str: The term to search for.
dir_path: Optional[str]: The path to the directory to search.
search_file(search_term: str, file_path: Optional[str] = None) -> None:
Searches for search_term in file. If file is not provided, searches in the current open file.
Args:
search_term: str: The term to search for.
file_path: Optional[str]: The path to the file to search.
find_file(file_name: str, dir_path: str = './') -> None:
Finds all files with the given name in the specified directory.
Args:
file_name: str: The name of the file to find.
dir_path: Optional[str]: The path to the directory to search.
parse_pdf(file_path: str) -> None:
Parses the content of a PDF file and prints it.
Args:
file_path: str: The path to the file to open.
parse_docx(file_path: str) -> None:
Parses the content of a DOCX file and prints it.
Args:
file_path: str: The path to the file to open.
parse_latex(file_path: str) -> None:
Parses the content of a LaTex file and prints it.
Args:
file_path: str: The path to the file to open.
parse_pptx(file_path: str) -> None:
Parses the content of a pptx file and prints it.
Args:
file_path: str: The path to the file to open.
Please note that THE `edit_file` and `insert_content_at_line` FUNCTIONS REQUIRE PROPER INDENTATION. If the assistant would like to add the line ' print(x)', it must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.
Responses should be concise.
The assistant should attempt fewer things at a time instead of putting too many commands OR too much code in one "execute" block.
Include ONLY ONE <execute_ipython>, <execute_bash>, or <execute_browse> per response, unless the assistant is finished with the task or needs more input or action from the user in order to proceed.
If the assistant is finished with the task you MUST include <finish></finish> in your response.
IMPORTANT: Execute code using <execute_ipython>, <execute_bash>, or <execute_browse> whenever possible.
When handling files, try to use full paths and pwd to avoid errors.
----------
Here is an example of how you can interact with the environment for task solving:
--- START OF EXAMPLE ---
USER: Create a list of numbers from 1 to 10, and display them in a web page at port 5000.
ASSISTANT:
Sure! Let me create a Python file `app.py`:
<execute_ipython>
create_file('app.py')
</execute_ipython>
USER:
OBSERVATION:
[File: /workspace/app.py (1 lines total)]
1|
[File app.py created.]
ASSISTANT:
Now I will write the Python code for starting a web server and save it to the file `app.py`:
<execute_ipython>
EDITED_CODE="""from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
numbers = list(range(1, 11))
return str(numbers)
if __name__ == '__main__':
app.run(port=5000)"""
insert_content_at_line(
'app.py',
1,
EDITED_CODE,
)
</execute_ipython>
USER:
OBSERVATION:
1|from flask import Flask
2|app = Flask(__name__)
3|
4|@app.route('/')
5|def index():
6| numbers = list(range(1, 11))
7| return str(numbers)
8|
9|if __name__ == '__main__':
10| app.run(port=5000)
11|
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
ASSISTANT:
I have created a Python file `app.py` that will display a list of numbers from 1 to 10 when you run it. Let me run the Python file for you:
<execute_bash>
python3 app.py > server.log 2>&1 &
</execute_bash>
USER:
OBSERVATION:
[1] 121[1]+ Exit 1 python3 app.py > server.log 2>&1
ASSISTANT: Looks like the server is running with PID 121 then crashed. Let me check the server log:
<execute_bash>
cat server.log
</execute_bash>
USER:
OBSERVATION:
Traceback (most recent call last):
File "/workspace/app.py", line 2, in <module>
from flask import Flask
ModuleNotFoundError: No module named 'flask'
ASSISTANT:
It seems that Flask is not installed. Let me install Flask for you:
<execute_bash>
pip install flask
</execute_bash>
USER:
OBSERVATION:
Defaulting to user installation because normal site-packages is not writeable
Collecting flask
Using cached flask-3.0.3-py3-none-any.whl (101 kB)
Collecting blinker>=1.6.2
Using cached blinker-1.7.0-py3-none-any.whl (13 kB)
Collecting Werkzeug>=3.0.0
Using cached werkzeug-3.0.2-py3-none-any.whl (226 kB)
Collecting click>=8.1.3
Using cached click-8.1.7-py3-none-any.whl (97 kB)
Collecting itsdangerous>=2.1.2
Using cached itsdangerous-2.2.0-py3-none-any.whl (16 kB)
Requirement already satisfied: Jinja2>=3.1.2 in /home/opendevin/.local/lib/python3.10/site-packages (from flask) (3.1.3)
Requirement already satisfied: MarkupSafe>=2.0 in /home/opendevin/.local/lib/python3.10/site-packages (from Jinja2>=3.1.2->flask) (2.1.5)
Installing collected packages: Werkzeug, itsdangerous, click, blinker, flask
Successfully installed Werkzeug-3.0.2 blinker-1.7.0 click-8.1.7 flask-3.0.3 itsdangerous-2.2.0
ASSISTANT:
Now that Flask is installed, let me run the Python file again:
<execute_bash>
python3 app.py > server.log 2>&1 &
</execute_bash>
USER:
OBSERVATION:
[1] 124
ASSISTANT:
Let me check the server log again:
<execute_bash>
cat server.log
</execute_bash>
USER:
OBSERVATION:
* Serving Flask app 'app'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
ASSISTANT:
The server is running on port 5000 with PID 124. You can access the list of numbers by visiting http://127.0.0.1:5000. If you have any further questions, feel free to ask!
USER: Now browse the newly started server's homepage and show me the content.
ASSISTANT:
Sure! Let me browse the server's homepage at http://127.0.0.1:5000:
<execute_browse>
Get the content on "http://127.0.0.1:5000"
</execute_browse>
USER:
OBSERVATION:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
ASSISTANT:
The content of the server's homepage is "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]". If you have any further questions, feel free to ask!
USER: Now kill the server, make it display the numbers in a table format.
ASSISTANT:
Sure! Let me stop the server first:
<execute_bash>
kill 124
</execute_bash>
USER:
OBSERVATION:
[1]+ Terminated python3 app.py > server.log 2>&1
ASSISTANT:
The server has been stopped. Let me open the Python file and modify it.
<execute_ipython>
open_file('app.py')
</execute_ipython>
USER:
[File: /workspace/app.py (11 lines total)]
1|from flask import Flask
2|app = Flask(__name__)
3|
4|@app.route('/')
5|def index():
6| numbers = list(range(1, 11))
7| return str(numbers)
8|
9|if __name__ == '__main__':
10| app.run(port=5000)
11|
ASSISTANT:
I should edit the file to display the numbers in a table format. I should include correct indentation. Let me update the file:
<execute_ipython>
edit_file(
'app.py',
to_replace=" return str(numbers)",
new_content=" return '<table>' + ''.join([f'<tr><td>{i}</td></tr>' for i in numbers]) + '</table>'",
)
</execute_ipython>
USER:
Observation:
[File: /workspace/app.py (11 lines total after edit)]
1|from flask import Flask
2|app = Flask(__name__)
3|
4|@app.route('/')
5|def index():
6| numbers = list(range(1, 11))
7| return '<table>' + ''.join([f'<tr><td>{i}</td></tr>' for i in numbers]) + '</table>'
8|
9|if __name__ == '__main__':
10| app.run(port=5000)
11|
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
ASSISTANT:
Running the updated file:
<execute_bash>
python3 app.py > server.log 2>&1 &
</execute_bash>
USER:
Observation:
[1] 126
ASSISTANT:
The server is running on port 5000 with PID 126. You can access the list of numbers in a table format by visiting http://127.0.0.1:5000. Let me know if you have any further requests!
<finish></finish>
--- END OF EXAMPLE ---
NOW, LET'S START!
----------
Fix typos in bad.txt. Do not ask me for confirmation at any point.
----------
Certainly! I'll fix the typos in the bad.txt file. Let's start by opening the file and examining its contents.
<execute_ipython>
open_file('bad.txt')
</execute_ipython>
----------
OBSERVATION:
[File: /workspace/bad.txt (4 lines total)]
1|This is a stupid typoo.
2|Really?
3|No mor typos!
4|Enjoy!
----------
Thank you for showing me the contents of the file. I can see there are a few typos that need to be fixed. I'll correct them one by one.
Let's start with the first line:
<execute_ipython>
edit_file(
'bad.txt',
to_replace="This is a stupid typoo.",
new_content="This is a stupid typo."
)
</execute_ipython>
----------
OBSERVATION:
[File: /workspace/bad.txt (4 lines total after edit)]
1|This is a stupid typo.
2|Really?
3|No mor typos!
4|Enjoy!
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
----------
Thank you for the update. Now let's fix the third line:
<execute_ipython>
edit_file(
'bad.txt',
to_replace="No mor typos!",
new_content="No more typos!"
)
</execute_ipython>
----------
OBSERVATION:
[File: /workspace/bad.txt (4 lines total after edit)]
1|This is a stupid typo.
2|Really?
3|No more typos!
4|Enjoy!
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
----------
Great! All the typos in the file have been corrected. Let's review the final content of the file to make sure everything is in order:
<execute_ipython>
open_file('bad.txt')
</execute_ipython>
----------
OBSERVATION:
[File: /workspace/bad.txt (4 lines total)]
1|This is a stupid typo.
2|Really?
3|No more typos!
4|Enjoy!
ENVIRONMENT REMINDER: You have 5 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -1,4 +1,4 @@
Certainly! I'll fix the typos in the bad.txt file. Let's start by opening the file and examining its contents.
Sure! Let's start by locating the `bad.txt` file and examining its contents.
<execute_ipython>
open_file('bad.txt')
<execute_bash>
find . -name "bad.txt"

View File

@ -1,10 +1,4 @@
Thank you for showing me the contents of the file. I can see there are a few typos that need to be fixed. I'll correct them one by one.
Let's start with the first line:
Let's open the `bad.txt` file and review its contents to identify and fix any typos.
<execute_ipython>
edit_file(
'bad.txt',
to_replace="This is a stupid typoo.",
new_content="This is a stupid typo."
)
open_file('./bad.txt')

View File

@ -1,8 +1,12 @@
Thank you for the update. Now let's fix the third line:
Let's correct the typos in the `bad.txt` file.
1. "stupid typoo" should be "stupid typo".
2. "No mor typos!" should be "No more typos!".
I will make these corrections now.
<execute_ipython>
edit_file(
'bad.txt',
to_replace="No mor typos!",
new_content="No more typos!"
'./bad.txt',
to_replace="This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!",
new_content="This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!"
)

View File

@ -1,4 +1,11 @@
Great! All the typos in the file have been corrected. Let's review the final content of the file to make sure everything is in order:
The typos in `bad.txt` have been corrected. Here are the updated contents:
<execute_ipython>
open_file('bad.txt')
```
This is a stupid typo.
Really?
No more typos!
Enjoy!
```
If you have any further requests, feel free to let me know!
<finish></finish>

View File

@ -1,8 +0,0 @@
The file has been successfully corrected. All typos have been fixed, and the content is now correct. Here's a summary of the changes made:
1. Changed "typoo" to "typo" in the first line.
2. Changed "mor" to "more" in the third line.
The task is complete, and there are no more typos to fix in the file.
<finish></finish>

View File

@ -388,4 +388,4 @@ NOW, LET'S START!
Use Jupyter IPython to write a text file containing 'hello world' to '/workspace/test.txt'. Do not ask me for confirmation at any point.
ENVIRONMENT REMINDER: You have 9 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 14 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -403,4 +403,4 @@ OBSERVATION:
File created successfully.
ENVIRONMENT REMINDER: You have 8 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 13 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -418,4 +418,4 @@ OBSERVATION:
Content of /workspace/test.txt: hello world
ENVIRONMENT REMINDER: You have 7 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 12 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -388,4 +388,4 @@ NOW, LET'S START!
Install and import pymsgbox==1.0.9 and print it's version in /workspace/test.txt. Do not ask me for confirmation at any point.
ENVIRONMENT REMINDER: You have 9 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 14 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -401,4 +401,4 @@ OBSERVATION:
[Package installed successfully]
[Kernel restarted successfully to load the package]
ENVIRONMENT REMINDER: You have 8 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 13 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -417,4 +417,4 @@ OBSERVATION:
Version written to /workspace/test.txt
ENVIRONMENT REMINDER: You have 7 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 12 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -430,4 +430,4 @@ OBSERVATION:
pymsgbox version: 1.0.9
[Command -1 finished with exit code 0]
ENVIRONMENT REMINDER: You have 6 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 11 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -388,4 +388,4 @@ NOW, LET'S START!
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
ENVIRONMENT REMINDER: You have 9 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 14 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -403,4 +403,4 @@ OBSERVATION:
[Command -1 finished with exit code 0]
ENVIRONMENT REMINDER: You have 8 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 13 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -417,4 +417,4 @@ OBSERVATION:
echo "hello"
[Command -1 finished with exit code 0]
ENVIRONMENT REMINDER: You have 7 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 12 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -430,4 +430,4 @@ OBSERVATION:
hello
[Command -1 finished with exit code 0]
ENVIRONMENT REMINDER: You have 6 turns left to complete the task. When finished reply with <finish></finish>.
ENVIRONMENT REMINDER: You have 11 turns left to complete the task. When finished reply with <finish></finish>.

View File

@ -584,4 +584,4 @@ NOW, LET'S START!
Fix typos in bad.txt. Do not ask me for confirmation at any point.
ENVIRONMENT REMINDER: You have 9 turns left to complete the task.
ENVIRONMENT REMINDER: You have 14 turns left to complete the task.

View File

@ -594,11 +594,11 @@ open_file('bad.txt')
----------
OBSERVATION:
[File: /workspace/bad.txt (4 lines total)]
1|This is a stupid typoo.
2|Really?
3|No mor typos!
4|Enjoy!
[File: /workspace/bad.txt (4 lines total)]
1|This is a stupid typoo.
2|Really?
3|No mor typos!
4|Enjoy!
ENVIRONMENT REMINDER: You have 8 turns left to complete the task.
ENVIRONMENT REMINDER: You have 13 turns left to complete the task.

View File

@ -594,11 +594,11 @@ open_file('bad.txt')
----------
OBSERVATION:
[File: /workspace/bad.txt (4 lines total)]
1|This is a stupid typoo.
2|Really?
3|No mor typos!
4|Enjoy!
[File: /workspace/bad.txt (4 lines total)]
1|This is a stupid typoo.
2|Really?
3|No mor typos!
4|Enjoy!
----------
@ -617,18 +617,18 @@ edit_file('bad.txt', 'No mor typos!', 'No more typos!')
----------
OBSERVATION:
[File: /workspace/bad.txt (4 lines total after edit)]
1|This is a stupid typo.
2|Really?
3|No mor typos!
4|Enjoy!
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
[File: /workspace/bad.txt (4 lines total after edit)]
1|This is a stupid typo.
2|Really?
3|No more typos!
4|Enjoy!
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
[File: /workspace/bad.txt (4 lines total after edit)]
1|This is a stupid typo.
2|Really?
3|No mor typos!
4|Enjoy!
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
[File: /workspace/bad.txt (4 lines total after edit)]
1|This is a stupid typo.
2|Really?
3|No more typos!
4|Enjoy!
[File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
ENVIRONMENT REMINDER: You have 7 turns left to complete the task.
ENVIRONMENT REMINDER: You have 12 turns left to complete the task.

View File

@ -584,4 +584,4 @@ NOW, LET'S START!
Use Jupyter IPython to write a text file containing 'hello world' to '/workspace/test.txt'. Do not ask me for confirmation at any point.
ENVIRONMENT REMINDER: You have 9 turns left to complete the task.
ENVIRONMENT REMINDER: You have 14 turns left to complete the task.

View File

@ -597,4 +597,4 @@ with open('/workspace/test.txt', 'w') as f:
OBSERVATION:
[Code executed successfully with no output]
ENVIRONMENT REMINDER: You have 8 turns left to complete the task.
ENVIRONMENT REMINDER: You have 13 turns left to complete the task.

View File

@ -584,4 +584,4 @@ NOW, LET'S START!
Install and import pymsgbox==1.0.9 and print it's version in /workspace/test.txt. Do not ask me for confirmation at any point.
ENVIRONMENT REMINDER: You have 9 turns left to complete the task.
ENVIRONMENT REMINDER: You have 14 turns left to complete the task.

View File

@ -597,4 +597,4 @@ OBSERVATION:
[Package installed successfully]
[Command -1 finished with exit code 0]
ENVIRONMENT REMINDER: You have 8 turns left to complete the task.
ENVIRONMENT REMINDER: You have 13 turns left to complete the task.

View File

@ -614,4 +614,4 @@ with open("/workspace/test.txt", "w") as file:
OBSERVATION:
[Code executed successfully with no output]
ENVIRONMENT REMINDER: You have 7 turns left to complete the task.
ENVIRONMENT REMINDER: You have 12 turns left to complete the task.

View File

@ -627,4 +627,4 @@ OBSERVATION:
pymsgbox version: 1.0.9
[Command -1 finished with exit code 0]
ENVIRONMENT REMINDER: You have 6 turns left to complete the task.
ENVIRONMENT REMINDER: You have 11 turns left to complete the task.

View File

@ -584,4 +584,4 @@ NOW, LET'S START!
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
ENVIRONMENT REMINDER: You have 9 turns left to complete the task.
ENVIRONMENT REMINDER: You have 14 turns left to complete the task.

View File

@ -597,4 +597,4 @@ OBSERVATION:
[Command -1 finished with exit code 0]
ENVIRONMENT REMINDER: You have 8 turns left to complete the task.
ENVIRONMENT REMINDER: You have 13 turns left to complete the task.

View File

@ -610,4 +610,4 @@ OBSERVATION:
echo "hello"
[Command -1 finished with exit code 0]
ENVIRONMENT REMINDER: You have 7 turns left to complete the task.
ENVIRONMENT REMINDER: You have 12 turns left to complete the task.

View File

@ -623,4 +623,4 @@ OBSERVATION:
hello
[Command -1 finished with exit code 0]
ENVIRONMENT REMINDER: You have 6 turns left to complete the task.
ENVIRONMENT REMINDER: You have 11 turns left to complete the task.

View File

@ -14,7 +14,6 @@ might be helpful for your software engineering team.
## Available Actions
* `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.
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
@ -64,8 +63,7 @@ ASSISTANT:
{
"action": "run",
"args": {
"command": "ls",
"background": false
"command": "ls"
}
}

View File

@ -14,7 +14,6 @@ might be helpful for your software engineering team.
## Available Actions
* `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.
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
@ -42,7 +41,7 @@ as well as observations you've made. This only includes the MOST RECENT
actions and observations--more may have happened before that.
They are time-ordered, with your most recent action at the bottom.
[[{"source": "agent", "action": "run", "args": {"command": "ls", "background": false, "thought": ""}}, {"source": "agent", "observation": "run", "content": "bad.txt", "extras": {"command_id": -1, "command": "ls", "exit_code": 0}}]]
[[{"action": "null", "args": {}}, {"source": "agent", "observation": "error", "content": "action={'action': 'run', 'args': {'command': 'ls', 'background': False}} has the wrong arguments", "extras": {}}]]
## Format
Your response MUST be in JSON format. It must be an object, and it must contain two fields:
@ -64,8 +63,7 @@ ASSISTANT:
{
"action": "run",
"args": {
"command": "ls",
"background": false
"command": "ls"
}
}

View File

@ -14,7 +14,6 @@ might be helpful for your software engineering team.
## Available Actions
* `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.
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
@ -42,7 +41,7 @@ as well as observations you've made. This only includes the MOST RECENT
actions and observations--more may have happened before that.
They are time-ordered, with your most recent action at the bottom.
[[{"source": "agent", "action": "run", "args": {"command": "ls", "background": false, "thought": ""}}, {"source": "agent", "observation": "run", "content": "bad.txt", "extras": {"command_id": -1, "command": "ls", "exit_code": 0}}], [{"source": "agent", "action": "read", "args": {"path": "bad.txt", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "read", "content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n", "extras": {"path": "bad.txt"}}]]
[[{"action": "null", "args": {}}, {"source": "agent", "observation": "error", "content": "action={'action': 'run', 'args': {'command': 'ls', 'background': False}} has the wrong arguments", "extras": {}}], [{"source": "agent", "action": "read", "args": {"path": "bad.txt", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "read", "content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n", "extras": {"path": "bad.txt"}}]]
## Format
Your response MUST be in JSON format. It must be an object, and it must contain two fields:
@ -64,8 +63,7 @@ ASSISTANT:
{
"action": "run",
"args": {
"command": "ls",
"background": false
"command": "ls"
}
}

View File

@ -24,7 +24,6 @@ The engineering team needs to correct the typos in this file.
## Available Actions
* `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.
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write

View File

@ -24,7 +24,6 @@ The engineering team needs to correct the typos in this file.
## Available Actions
* `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.
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write

View File

@ -24,7 +24,6 @@ The engineering team needs to correct the typos in this file.
## Available Actions
* `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.
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write

View File

@ -14,7 +14,6 @@ validating if the task is solved, nothing else.
## Available Actions
* `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.
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read

View File

@ -14,7 +14,6 @@ validating if the task is solved, nothing else.
## Available Actions
* `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.
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read

View File

@ -14,7 +14,6 @@ might be helpful for your software engineering team.
## Available Actions
* `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.
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
@ -64,8 +63,7 @@ ASSISTANT:
{
"action": "run",
"args": {
"command": "ls",
"background": false
"command": "ls"
}
}

View File

@ -14,7 +14,6 @@ might be helpful for your software engineering team.
## Available Actions
* `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.
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
@ -42,7 +41,7 @@ as well as observations you've made. This only includes the MOST RECENT
actions and observations--more may have happened before that.
They are time-ordered, with your most recent action at the bottom.
[[{"source": "agent", "action": "run", "args": {"command": "ls", "background": false, "thought": ""}}, {"source": "agent", "observation": "run", "content": "", "extras": {"command_id": -1, "command": "ls", "exit_code": 0}}]]
[[{"action": "null", "args": {}}, {"source": "agent", "observation": "error", "content": "action={'action': 'run', 'args': {'command': 'ls', 'background': False}} has the wrong arguments", "extras": {}}]]
## Format
Your response MUST be in JSON format. It must be an object, and it must contain two fields:
@ -64,8 +63,7 @@ ASSISTANT:
{
"action": "run",
"args": {
"command": "ls",
"background": false
"command": "ls"
}
}

View File

@ -17,7 +17,6 @@ The codebase appears to be empty. Engineers should start everything from scratch
## Available Actions
* `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.
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write

View File

@ -17,7 +17,6 @@ The codebase appears to be empty. Engineers should start everything from scratch
## Available Actions
* `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.
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write

View File

@ -17,7 +17,6 @@ The codebase appears to be empty. Engineers should start everything from scratch
## Available Actions
* `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.
* `write` - writes the content to a file. Arguments:
* `path` - the path of the file to write
@ -42,7 +41,7 @@ as well as observations you've made. This only includes the MOST RECENT
actions and observations--more may have happened before that.
They are time-ordered, with your most recent action at the bottom.
[[{"source": "agent", "action": "write", "args": {"path": "hello.sh", "content": "#!/bin/bash\necho 'hello'", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "write", "content": "", "extras": {"path": "hello.sh"}}], [{"source": "agent", "action": "run", "args": {"command": "bash hello.sh", "background": false, "thought": ""}}, {"source": "agent", "observation": "run", "content": "hello", "extras": {"command_id": -1, "command": "bash hello.sh", "exit_code": 0}}]]
[[{"source": "agent", "action": "write", "args": {"path": "hello.sh", "content": "#!/bin/bash\necho 'hello'", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "write", "content": "", "extras": {"path": "hello.sh"}}], [{"action": "null", "args": {}}, {"source": "agent", "observation": "error", "content": "action={'action': 'run', 'args': {'command': 'bash hello.sh', 'background': False}} has the wrong arguments", "extras": {}}]]
## Format
Your response MUST be in JSON format. It must be an object, and it must contain two fields:

View File

@ -14,7 +14,6 @@ validating if the task is solved, nothing else.
## Available Actions
* `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.
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read

View File

@ -14,7 +14,6 @@ validating if the task is solved, nothing else.
## Available Actions
* `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.
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read

View File

@ -14,7 +14,6 @@ validating if the task is solved, nothing else.
## Available Actions
* `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.
* `read` - reads the content of a file. Arguments:
* `path` - the path of the file to read
@ -40,7 +39,7 @@ as well as observations you've made. This only includes the MOST RECENT
actions and observations--more may have happened before that.
They are time-ordered, with your most recent action at the bottom.
[[{"source": "agent", "action": "read", "args": {"path": "hello.sh", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "read", "content": "#!/bin/bash\necho 'hello'\n", "extras": {"path": "hello.sh"}}], [{"source": "agent", "action": "run", "args": {"command": "bash hello.sh", "background": false, "thought": ""}}, {"source": "agent", "observation": "run", "content": "hello", "extras": {"command_id": -1, "command": "bash hello.sh", "exit_code": 0}}]]
[[{"source": "agent", "action": "read", "args": {"path": "hello.sh", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "read", "content": "#!/bin/bash\necho 'hello'\n", "extras": {"path": "hello.sh"}}], [{"action": "null", "args": {}}, {"source": "agent", "observation": "error", "content": "action={'action': 'run', 'args': {'command': 'bash hello.sh', 'background': False}} has the wrong arguments", "extras": {}}]]
## Format
Your response MUST be in JSON format. It must be an object, and it must contain two fields:

View File

@ -26,7 +26,6 @@ To achieve this goal, you should:
* `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.
* `message` - make a plan, set a goal, record your thoughts, or ask for more input from the user. Arguments:
* `content` - the thought to record

View File

@ -26,7 +26,6 @@ To achieve this goal, you should:
* `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.
* `message` - make a plan, set a goal, record your thoughts, or ask for more input from the user. Arguments:
* `content` - the thought to record

View File

@ -26,7 +26,6 @@ To achieve this goal, you should:
* `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.
* `message` - make a plan, set a goal, record your thoughts, or ask for more input from the user. Arguments:
* `content` - the thought to record
@ -52,7 +51,7 @@ as well as observations you've made. This only includes the MOST RECENT
actions and observations--more may have happened before that.
They are time-ordered, with your most recent action at the bottom.
[[{"source": "agent", "action": "read", "args": {"path": "./bad.txt", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "read", "content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n", "extras": {"path": "./bad.txt"}}], [{"source": "agent", "action": "message", "args": {"content": "The content of 'bad.txt' has been read. The following typos have been identified:\n1. 'typoo' should be 'typo'\n2. 'mor' should be 'more'\nI will now proceed to fix these typos and overwrite the file with the corrected content.", "wait_for_response": false}}, {"observation": "null", "content": "", "extras": {}}]]
[[{"source": "agent", "action": "read", "args": {"path": "./bad.txt", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "read", "content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n", "extras": {"path": "./bad.txt"}}], [{"source": "agent", "action": "message", "args": {"content": "I have identified the following typos in the file 'bad.txt':\n\n1. 'typoo' should be 'typo'\n2. 'mor' should be 'more'\n\nI will now proceed to fix these typos and overwrite the file with the corrected content.", "wait_for_response": false}}, {"observation": "null", "content": "", "extras": {}}]]
## Format
Your response MUST be in JSON format. It must be an object, and it must contain two fields:

View File

@ -26,7 +26,6 @@ To achieve this goal, you should:
* `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.
* `message` - make a plan, set a goal, record your thoughts, or ask for more input from the user. Arguments:
* `content` - the thought to record
@ -52,7 +51,7 @@ as well as observations you've made. This only includes the MOST RECENT
actions and observations--more may have happened before that.
They are time-ordered, with your most recent action at the bottom.
[[{"source": "agent", "action": "read", "args": {"path": "./bad.txt", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "read", "content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n", "extras": {"path": "./bad.txt"}}], [{"source": "agent", "action": "message", "args": {"content": "The content of 'bad.txt' has been read. The following typos have been identified:\n1. 'typoo' should be 'typo'\n2. 'mor' should be 'more'\nI will now proceed to fix these typos and overwrite the file with the corrected content.", "wait_for_response": false}}, {"observation": "null", "content": "", "extras": {}}], [{"source": "agent", "action": "write", "args": {"path": "./bad.txt", "content": "This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!\n", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "write", "content": "", "extras": {"path": "./bad.txt"}}]]
[[{"source": "agent", "action": "read", "args": {"path": "./bad.txt", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "read", "content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n", "extras": {"path": "./bad.txt"}}], [{"source": "agent", "action": "message", "args": {"content": "I have identified the following typos in the file 'bad.txt':\n\n1. 'typoo' should be 'typo'\n2. 'mor' should be 'more'\n\nI will now proceed to fix these typos and overwrite the file with the corrected content.", "wait_for_response": false}}, {"observation": "null", "content": "", "extras": {}}], [{"source": "agent", "action": "write", "args": {"path": "./bad.txt", "content": "This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!\n", "start": 0, "end": -1, "thought": ""}}, {"source": "agent", "observation": "write", "content": "", "extras": {"path": "./bad.txt"}}]]
## Format
Your response MUST be in JSON format. It must be an object, and it must contain two fields:

View File

@ -1,7 +1,6 @@
{
"action": "message",
"args": {
"content": "The content of 'bad.txt' has been read. The following typos have been identified:\n1. 'typoo' should be 'typo'\n2. 'mor' should be 'more'\nI will now proceed to fix these typos and overwrite the file with the corrected content.",
"wait_for_response": false
"content": "I have identified the following typos in the file 'bad.txt':\n\n1. 'typoo' should be 'typo'\n2. 'mor' should be 'more'\n\nI will now proceed to fix these typos and overwrite the file with the corrected content."
}
}

View File

@ -35,7 +35,6 @@ If the last item in the history is an error, you should try to fix it.
## Available Actions
* `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.
* `reject` - reject the task. Arguments:
* `outputs` - a dictionary with only a `reason` attribute

View File

@ -28,14 +28,13 @@ as well as observations you've made. This only includes the MOST RECENT
actions and observations--more may have happened before that.
They are time-ordered, with your most recent action at the bottom.
[[{"source": "agent", "action": "run", "args": {"command": "git status", "background": false, "thought": ""}}, {"source": "agent", "observation": "run", "content": "fatal: not a git repository (or any parent up to mount point /)\r\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).", "extras": {"command_id": -1, "command": "git status", "exit_code": 128}}]]
[[{"source": "agent", "action": "run", "args": {"command": "git status", "thought": ""}}, {"source": "agent", "observation": "run", "content": "fatal: not a git repository (or any parent up to mount point /)\r\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).", "extras": {"command_id": -1, "command": "git status", "exit_code": 128}}]]
If the last item in the history is an error, you should try to fix it.
## Available Actions
* `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.
* `reject` - reject the task. Arguments:
* `outputs` - a dictionary with only a `reason` attribute

View File

@ -28,14 +28,13 @@ as well as observations you've made. This only includes the MOST RECENT
actions and observations--more may have happened before that.
They are time-ordered, with your most recent action at the bottom.
[[{"source": "agent", "action": "run", "args": {"command": "git status", "background": false, "thought": ""}}, {"source": "agent", "observation": "run", "content": "fatal: not a git repository (or any parent up to mount point /)\r\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).", "extras": {"command_id": -1, "command": "git status", "exit_code": 128}}], [{"action": "null", "args": {}}, {"source": "agent", "observation": "error", "content": "action={'action': 'reject', 'args': {'reason': 'Not a valid git repository.'}} has the wrong arguments", "extras": {}}]]
[[{"source": "agent", "action": "run", "args": {"command": "git status", "thought": ""}}, {"source": "agent", "observation": "run", "content": "fatal: not a git repository (or any parent up to mount point /)\r\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).", "extras": {"command_id": -1, "command": "git status", "exit_code": 128}}], [{"action": "null", "args": {}}, {"source": "agent", "observation": "error", "content": "action={'action': 'reject', 'args': {'reason': 'Not a valid git repository.'}} has the wrong arguments", "extras": {}}]]
If the last item in the history is an error, you should try to fix it.
## Available Actions
* `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.
* `reject` - reject the task. Arguments:
* `outputs` - a dictionary with only a `reason` attribute

View File

@ -28,14 +28,13 @@ as well as observations you've made. This only includes the MOST RECENT
actions and observations--more may have happened before that.
They are time-ordered, with your most recent action at the bottom.
[[{"source": "agent", "action": "run", "args": {"command": "git status", "background": false, "thought": ""}}, {"source": "agent", "observation": "run", "content": "fatal: not a git repository (or any parent up to mount point /)\r\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).", "extras": {"command_id": -1, "command": "git status", "exit_code": 128}}], [{"action": "null", "args": {}}, {"source": "agent", "observation": "error", "content": "action={'action': 'reject', 'args': {'reason': 'Not a valid git repository.'}} has the wrong arguments", "extras": {}}], [{"action": "null", "args": {}}, {"source": "agent", "observation": "error", "content": "action={'action': 'reject', 'args': {'reason': 'Not a valid git repository.'}} has the wrong arguments", "extras": {}}]]
[[{"source": "agent", "action": "run", "args": {"command": "git status", "thought": ""}}, {"source": "agent", "observation": "run", "content": "fatal: not a git repository (or any parent up to mount point /)\r\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).", "extras": {"command_id": -1, "command": "git status", "exit_code": 128}}], [{"action": "null", "args": {}}, {"source": "agent", "observation": "error", "content": "action={'action': 'reject', 'args': {'reason': 'Not a valid git repository.'}} has the wrong arguments", "extras": {}}], [{"action": "null", "args": {}}, {"source": "agent", "observation": "error", "content": "action={'action': 'reject', 'args': {'reason': 'Not a valid git repository.'}} has the wrong arguments", "extras": {}}]]
If the last item in the history is an error, you should try to fix it.
## Available Actions
* `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.
* `reject` - reject the task. Arguments:
* `outputs` - a dictionary with only a `reason` attribute

View File

@ -135,7 +135,6 @@ This is your internal monologue, in JSON format:
"action": "run",
"args": {
"command": "echo \"hello world\"",
"background": false,
"thought": ""
}
},
@ -183,7 +182,6 @@ This is your internal monologue, in JSON format:
"action": "run",
"args": {
"command": "node test.js",
"background": false,
"thought": ""
}
},
@ -343,9 +341,6 @@ Here are the possible actions:
* `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
* `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:
@ -359,9 +354,7 @@ Here are the possible actions:
* `wait_for_response` - set to `true` to wait for the user to respond before proceeding
* `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, kill, browse, push, and recall actions--do this with the `message` action.
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 `message` actions, you should consider taking a different action.

View File

@ -135,7 +135,6 @@ This is your internal monologue, in JSON format:
"action": "run",
"args": {
"command": "echo \"hello world\"",
"background": false,
"thought": ""
}
},
@ -183,7 +182,6 @@ This is your internal monologue, in JSON format:
"action": "run",
"args": {
"command": "node test.js",
"background": false,
"thought": ""
}
},
@ -329,21 +327,20 @@ This is your internal monologue, in JSON format:
},
{
"source": "agent",
"action": "write",
"action": "run",
"args": {
"path": "hello.sh",
"content": "#!/bin/bash\necho 'hello'",
"start": 0,
"end": -1,
"command": "pwd",
"thought": ""
}
},
{
"source": "agent",
"observation": "write",
"content": "",
"observation": "run",
"content": "/workspace",
"extras": {
"path": "hello.sh"
"command_id": -1,
"command": "pwd",
"exit_code": 0
}
}
]
@ -362,9 +359,6 @@ Here are the possible actions:
* `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
* `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:
@ -378,9 +372,7 @@ Here are the possible actions:
* `wait_for_response` - set to `true` to wait for the user to respond before proceeding
* `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, kill, browse, push, and recall actions--do this with the `message` action.
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 `message` actions, you should consider taking a different action.

View File

@ -135,7 +135,6 @@ This is your internal monologue, in JSON format:
"action": "run",
"args": {
"command": "echo \"hello world\"",
"background": false,
"thought": ""
}
},
@ -183,7 +182,6 @@ This is your internal monologue, in JSON format:
"action": "run",
"args": {
"command": "node test.js",
"background": false,
"thought": ""
}
},
@ -327,41 +325,39 @@ This is your internal monologue, in JSON format:
"wait_for_response": false
}
},
{
"source": "agent",
"action": "write",
"args": {
"path": "hello.sh",
"content": "#!/bin/bash\necho 'hello'",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"source": "agent",
"observation": "write",
"content": "",
"extras": {
"path": "hello.sh"
}
},
{
"source": "agent",
"action": "run",
"args": {
"command": "bash hello.sh",
"background": false,
"command": "pwd",
"thought": ""
}
},
{
"source": "agent",
"observation": "run",
"content": "hello",
"content": "/workspace",
"extras": {
"command_id": -1,
"command": "bash hello.sh",
"command": "pwd",
"exit_code": 0
}
},
{
"source": "agent",
"action": "run",
"args": {
"command": "ls",
"thought": "I need to see the contents of the current directory to ensure there are no conflicts and to understand the environment better."
}
},
{
"source": "agent",
"observation": "run",
"content": "",
"extras": {
"command_id": -1,
"command": "ls",
"exit_code": 0
}
}
@ -381,9 +377,6 @@ Here are the possible actions:
* `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
* `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:
@ -397,9 +390,7 @@ Here are the possible actions:
* `wait_for_response` - set to `true` to wait for the user to respond before proceeding
* `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, kill, browse, push, and recall actions--do this with the `message` action.
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 `message` actions, you should consider taking a different action.

View File

@ -135,7 +135,6 @@ This is your internal monologue, in JSON format:
"action": "run",
"args": {
"command": "echo \"hello world\"",
"background": false,
"thought": ""
}
},
@ -183,7 +182,6 @@ This is your internal monologue, in JSON format:
"action": "run",
"args": {
"command": "node test.js",
"background": false,
"thought": ""
}
},
@ -327,41 +325,39 @@ This is your internal monologue, in JSON format:
"wait_for_response": false
}
},
{
"source": "agent",
"action": "write",
"args": {
"path": "hello.sh",
"content": "#!/bin/bash\necho 'hello'",
"start": 0,
"end": -1,
"thought": ""
}
},
{
"source": "agent",
"observation": "write",
"content": "",
"extras": {
"path": "hello.sh"
}
},
{
"source": "agent",
"action": "run",
"args": {
"command": "bash hello.sh",
"background": false,
"command": "pwd",
"thought": ""
}
},
{
"source": "agent",
"observation": "run",
"content": "hello",
"content": "/workspace",
"extras": {
"command_id": -1,
"command": "bash hello.sh",
"command": "pwd",
"exit_code": 0
}
},
{
"source": "agent",
"action": "run",
"args": {
"command": "ls",
"thought": "I need to see the contents of the current directory to ensure there are no conflicts and to understand the environment better."
}
},
{
"source": "agent",
"observation": "run",
"content": "",
"extras": {
"command_id": -1,
"command": "ls",
"exit_code": 0
}
},
@ -369,7 +365,7 @@ This is your internal monologue, in JSON format:
"source": "agent",
"action": "message",
"args": {
"content": "I have successfully created and executed the 'hello.sh' script, which printed 'hello' as expected. I believe I have completed the task as specified.",
"content": "The current directory is /workspace and it appears to be empty. This is a good place to create the 'hello.sh' script without any conflicts.",
"wait_for_response": false
}
}
@ -389,9 +385,6 @@ Here are the possible actions:
* `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
* `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:
@ -405,9 +398,7 @@ Here are the possible actions:
* `wait_for_response` - set to `true` to wait for the user to respond before proceeding
* `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, kill, browse, push, and recall actions--do this with the `message` action.
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 `message` actions, you should consider taking a different action.

Some files were not shown because too many files have changed in this diff Show More