Add integration test framework with mock llm (#1301)

* Add integration test framework with mock llm

* Fix MonologueAgent and PlannerAgent tests

* Remove adhoc logging

* Use existing logs

* Fix SWEAgent and PlannerAgent

* Check-in test log files

* conftest: look up under test name folder only

* Add docstring to conftest

* Finish dev doc

* Avoid non-determinism

* Remove dependency on llm embedding model

* Init embedding model only for MonologueAgent

* Add adhoc fix for sandbox discrepancy

* Test ssh and exec sandboxes

* CI: fix missing sandbox type

* conftest: Remove hack

* Reword comment for TODO
This commit is contained in:
Boxuan Li 2024-04-25 07:56:53 -07:00 committed by GitHub
parent bf5a2afd83
commit e7b5ddfe06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
48 changed files with 4053 additions and 30 deletions

View File

@ -0,0 +1,70 @@
name: Run Integration Tests
on: [push, pull_request]
jobs:
on-linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: SWEAgent-py311-ssh
python-version: "3.11"
agent: "SWEAgent"
embedding-model: "none"
sandbox: "ssh"
- name: PlannerAgent-py311-ssh
python-version: "3.11"
agent: "PlannerAgent"
embedding-model: "none"
sandbox: "ssh"
- name: MonologueAgent-py311-ssh
python-version: "3.11"
agent: "MonologueAgent"
embedding-model: "local"
sandbox: "ssh"
- name: CodeActAgent-py311-ssh
python-version: "3.11"
agent: "CodeActAgent"
embedding-model: "none"
sandbox: "ssh"
- name: SWEAgent-py311-exec
python-version: "3.11"
agent: "SWEAgent"
embedding-model: "none"
sandbox: "exec"
- name: PlannerAgent-py311-exec
python-version: "3.11"
agent: "PlannerAgent"
embedding-model: "none"
sandbox: "exec"
- name: MonologueAgent-py311-exec
python-version: "3.11"
agent: "MonologueAgent"
embedding-model: "local"
sandbox: "exec"
- name: CodeActAgent-py311-exec
python-version: "3.11"
agent: "CodeActAgent"
embedding-model: "none"
sandbox: "exec"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Build Environment
run: make build
- name: Run Integration Tests
env:
SANDBOX_TYPE: ${{ matrix.sandbox }}
AGENT: ${{ matrix.agent }}
MAX_ITERATIONS: 10
LLM_EMBEDDING_MODEL: ${{ matrix.embedding-model }}
run: |
rm -rf workspace
mkdir workspace
WORKSPACE_BASE="$GITHUB_WORKSPACE/workspace" WORKSPACE_MOUNT_PATH="$GITHUB_WORKSPACE/workspace" poetry run pytest -s ./tests/integration

View File

@ -1,20 +0,0 @@
name: Run Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Set up environment
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry install --without evaluation
- name: Run tests
run: |
poetry run pytest ./tests

View File

@ -1,4 +1,4 @@
name: Build & Run Tests
name: Run Unit Tests
on: [push, pull_request]
@ -26,7 +26,7 @@ jobs:
- name: Build Environment
run: make build
- name: Run Tests
run: poetry run pytest ./tests
run: poetry run pytest ./tests/unit
on-linux:
runs-on: ubuntu-latest
strategy:
@ -44,4 +44,4 @@ jobs:
- name: Build Environment
run: make build
- name: Run Tests
run: poetry run pytest ./tests
run: poetry run pytest ./tests/unit

1
.gitignore vendored
View File

@ -57,7 +57,6 @@ cover/
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

View File

@ -85,5 +85,6 @@ Please refer to the README in each module:
- [mock server](./opendevin/mock/README.md)
## Tests
TODO: make sure code pass the test before submit.
Please navigate to `tests` folder to see existing test suites.
At the moment, we have two kinds of tests: `unit` and `integration`. Please refer to the README for each test suite. These tests also run on CI to ensure quality of
the project.

View File

@ -73,6 +73,11 @@ elif embedding_strategy == 'azureopenai':
azure_endpoint=config.get('LLM_BASE_URL', required=True),
api_version=config.get('LLM_API_VERSION', required=True),
)
elif (embedding_strategy is not None) and (embedding_strategy.lower() == 'none'):
# TODO: this works but is not elegant enough. The incentive is when
# monologue agent is not used, there is no reason we need to initialize an
# embedding model
embed_model = None
else:
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
embed_model = HuggingFaceEmbedding(

View File

@ -95,7 +95,7 @@ def get_parser():
parser.add_argument(
'-c',
'--agent-cls',
default='MonologueAgent',
default=config.get(ConfigType.AGENT),
type=str,
help='The agent class to use',
)

View File

@ -1,4 +1,3 @@
from litellm import completion as litellm_completion
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_random_exponential
from litellm.exceptions import APIConnectionError, RateLimitError, ServiceUnavailableError

View File

@ -20,11 +20,13 @@ def read_task_from_stdin() -> str:
return sys.stdin.read()
async def main():
async def main(task_str: str = ''):
"""Main coroutine to run the agent controller with task input flexibility."""
# Determine the task source
if args.file:
if task_str:
task = task_str
elif args.file:
task = read_task_from_file(args.file)
elif args.task:
task = args.task

101
tests/integration/README.md Normal file
View File

@ -0,0 +1,101 @@
## Introduction
This folder contains backend integration tests that rely on a mock LLM. It serves
two purposes:
1. Ensure the quality of development, including OpenDevin framework and agents.
2. Help contributors learn the workflow of OpenDevin, and examples of real interactions
with (powerful) LLM, without spending real money.
Why don't we launch an open-source model, e.g. LLAMA3? There are two reasons:
1. LLMs cannot guarantee determinism, meaning the test behavior might change.
2. CI machines are not powerful enough to run any LLM that is sophisticated enough
to finish the tasks defined in tests.
Note: integration tests are orthogonal to evaluations/benchmarks
as they serve different purposes. Although benchmarks could also
capture bugs, some of which may not be caught by tests, benchmarks
require real LLMs which are non-deterministic and costly.
We run integration test suite for every single commit, which is
not possible with benchmarks.
Known limitations:
1. To avoid the potential impact of non-determinism, we remove all special
characters and numbers (often used as PIDs) when doing the comparison. If two
prompts for the same task only differ in non-alpha characters, a wrong mock
response might be picked up.
2. It is required that the agent itself doesn't do anything non-deterministic,
including but not limited to using randomly generated numbers.
The folder is organised as follows:
```
├── README.md
├── conftest.py
├── mock
│   ├── [AgentName]
│   │   └── [TestName]
│   │   ├── prompt_*.log
│   │   ├── response_*.log
└── [TestFiles].py
```
where `conftest.py` defines the infrastructure needed to load real-world LLM prompts
and responses for mocking purpose. Prompts and responses generated during real runs
of agents with real LLMs are stored under `mock/AgentName/TestName` folders.
## Run Integration Tests
Take a look at `run-integration-tests.yml` to learn how integration tests are
launched in CI environment. Assuming you want to use `workspace` for testing, an
example is as follows:
```bash
rm -rf workspace; AGENT=PlannerAgent \
WORKSPACE_BASE="/Users/admin/OpenDevin/workspace" WORKSPACE_MOUNT_PATH="/Users/admin/OpenDevin/workspace" MAX_ITERATIONS=10 \
poetry run pytest -s ./tests/integration
```
Note: in order to run integration tests correctly, please ensure your workspace is empty.
## Write Integration Tests
To write an integraion test, there are essentially two steps:
1. Decide your task prompt, and the result you want to verify.
2. Either construct LLM responses by yourself, or run OpenDevin with a real LLM. The system prompts and
LLM responses are recorded as logs, which you could then copy to test folder.
The following paragraphs describe how to do it.
Your `config.toml` should look like this:
```toml
LLM_MODEL="gpt-4-turbo"
LLM_API_KEY="<your-api-key>"
LLM_EMBEDDING_MODEL="openai"
WORKSPACE_MOUNT_PATH="<absolute-path-of-your-workspace>"
```
You can choose any model you'd like to generate the mock responses.
You can even handcraft mock responses, especially when you would like to test the behaviour of agent for corner cases. If you use a very weak model (e.g. 8B params), chance is most agents won't be able to finish the task.
```bash
# Remove logs iff you are okay to lose logs. This helps us locate the prompts and responses quickly, but is NOT a must.
rm -rf logs
# Clear the workspace, otherwise OpenDevin might not be able to reproduce your prompts in CI environment. Feel free to change the workspace name and path. Be sure to set `WORKSPACE_MOUNT_PATH` to the same absolute path.
rm -rf workspace
mkdir workspace
# Depending on the complexity of the task you want to test, you can change the number of iterations limit. Change agent accordingly. If you are adding a new test, try generating mock responses for every agent.
poetry run python ./opendevin/main.py -i 10 -t "Write a shell script 'hello.sh' that prints 'hello'." -c "MonologueAgent" -d "./workspace"
```
After running the above commands, you should be able to locate the real prompts
and responses logged. The log folder follows `logs/llm/%y-%m-%d_%H-%M.log` format.
Now, move all files under that folder to `tests/integration/mock/<AgentName>/<TestName>` folder. For example, moving all files from `logs/llm/24-04-23_21-55/` folder to
`tests/integration/mock/MonologueAgent/test_write_simple_script` folder.
That's it, you are good to go! When you launch an integration test, mock
responses are loaded and used to replace a real LLM, so that we get
deterministic and consistent behavior, and most importantly, without spending real
money.

View File

@ -0,0 +1,70 @@
import re
import os
from functools import partial
import pytest
from litellm import completion
script_dir = os.path.dirname(os.path.realpath(__file__))
def filter_out_symbols(input):
return ' '.join([char for char in input if char.isalpha()])
def get_log_id(prompt_log_name):
match = re.search(r'prompt_(\d+).log', prompt_log_name)
if match:
return match.group(1)
def get_mock_response(test_name, messages):
"""
Find mock response based on prompt. Prompts are stored under nested
folders under mock folder. If prompt_{id}.log matches,
then the mock response we're looking for is at response_{id}.log.
Note: we filter out all non alpha-numerical characters, otherwise we would
see surprising mismatches caused by linters and minor discrepancies between
different platforms.
We could have done a slightly more efficient string match with the same time
complexity (early-out upon first character mismatch), but it is unnecessary
for tests. Empirically, different prompts of the same task usually only
differ near the end of file, so the comparison would be more efficient if
we start from the end of the file, but again, that is unnecessary and only
makes test code harder to understand.
"""
mock_dir = os.path.join(script_dir, 'mock', os.environ.get('AGENT'), test_name)
prompt = filter_out_symbols(messages)
for root, _, files in os.walk(mock_dir):
for file in files:
if file.startswith('prompt_') and file.endswith('.log'):
file_path = os.path.join(root, file)
# Open the prompt file and compare its contents
with open(file_path, 'r') as f:
file_content = filter_out_symbols(f.read())
if file_content == prompt:
# If a match is found, construct the corresponding response file path
log_id = get_log_id(file_path)
resp_file_path = os.path.join(root, f'response_{log_id}.log')
# Read the response file and return its content
with open(resp_file_path, 'r') as resp_file:
return resp_file.read()
def mock_completion(*args, test_name, **kwargs):
messages = kwargs['messages']
message_str = ''
for message in messages:
message_str += message['content']
mock_response = get_mock_response(test_name, message_str)
assert mock_response is not None, 'Mock response for prompt is not found'
response = completion(**kwargs, mock_response=mock_response)
return response
@pytest.fixture(autouse=True)
def patch_completion(monkeypatch, request):
test_name = request.node.name
monkeypatch.setattr('opendevin.llm.llm.litellm_completion', partial(mock_completion, test_name=test_name))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,9 @@
```json
{
"action": "run",
"args": {
"command": "ls",
"background": false
}
}
```

View File

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

View File

@ -0,0 +1,8 @@
```json
{
"action": "think",
"args": {
"thought": "I have written the file 'hello.sh'. I should now make sure it is executable and test running it."
}
}
```

View File

@ -0,0 +1,7 @@
{
"action": "run",
"args": {
"command": "chmod +x hello.sh",
"background": false
}
}

View File

@ -0,0 +1,7 @@
{
"action": "run",
"args": {
"command": "./hello.sh",
"background": false
}
}

View File

@ -0,0 +1,6 @@
```json
{
"action": "finish",
"args": {}
}
```

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,7 @@
{
"action": "modify_task",
"args": {
"id": "0",
"state": "in_progress"
}
}

View File

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

View File

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

View File

@ -0,0 +1,7 @@
{
"action": "modify_task",
"args": {
"id": "0",
"state": "verified"
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,8 @@
Thoughts:
To begin solving the task, I need to create a new shell script file named 'hello.sh'. This file should contain a script that prints the message 'hello' when executed. I will start by writing the initial content of this script.
Action:
```
write hello.sh #!/bin/bash
echo 'hello'
```

View File

@ -0,0 +1,8 @@
Thoughts:
Since the file 'hello.sh' has been created, the next step is to write the shell script code that prints "hello". This involves adding a shebang line to specify the shell interpreter and a print command. I will add these lines to the 'hello.sh' file.
Action:
```
write hello.sh #!/bin/bash
echo "hello"
```

View File

@ -0,0 +1,8 @@
Thoughts:
I have created the file 'hello.sh' but have not yet written the script content that prints "hello". The next step is to write the shell script code into 'hello.sh'. This will include a shebang line to specify the shell interpreter (bash in this case) and an echo command to print "hello".
Action:
```
write hello.sh #!/bin/bash
echo "hello"
```

View File

@ -0,0 +1,7 @@
Thoughts:
I have created the file 'hello.sh' but have not yet confirmed the content of the script. The next step is to read the content of 'hello.sh' to ensure that it contains the correct shell script code that prints "hello". This will help verify that the previous write actions were successful and the file is ready for execution.
Action:
```
read hello.sh
```

View File

@ -0,0 +1,7 @@
Thoughts:
The shell script 'hello.sh' has been successfully created and contains the necessary code to print "hello". The next logical step is to test the script to ensure it functions as expected. This involves executing the script and observing the output. If the script runs correctly and prints "hello", then the task is completed successfully.
Action:
```
bash hello.sh
```

View File

@ -0,0 +1,7 @@
Thoughts:
The shell script 'hello.sh' has been successfully created and tested, and it correctly prints "hello" when executed. Since the task was to write a shell script that prints 'hello' and this has been achieved as evidenced by the output from the previous run command, there are no further modifications or actions needed on the script. Therefore, I should conclude this task.
Action:
```
exit
```

View File

@ -0,0 +1,23 @@
import os
import asyncio
import subprocess
import pytest
from opendevin.main import main
@pytest.mark.skipif(os.environ.get('AGENT') == 'CodeActAgent', reason='CodeActAgent requires task to be in a special format')
def test_write_simple_script():
task = "Write a shell script 'hello.sh' that prints 'hello'."
asyncio.run(main(task))
# Verify the script file exists
script_path = 'workspace/hello.sh'
assert os.path.exists(script_path), 'The file "hello.sh" does not exist'
# Run the script and capture the output
result = subprocess.run(['bash', script_path], capture_output=True, text=True)
# Verify the output from the script
assert result.stdout.strip() == 'hello', f'Expected output "hello", but got "{result.stdout.strip()}"'

7
tests/unit/README.md Normal file
View File

@ -0,0 +1,7 @@
## Introduction
This folder contains unit tests that could be run locally by
```bash
poetry run pytest ./tests/unit
```