GETTING STARTED

Your first task. From prompt to proof.

Open a small project in MonkeyCode, ask for one fix, and check the result. Follow the steps below in your browser or desktop app.

Start the guide

Choose your setup

Choose where you want to work. The example and the finish line are the same.

Work with a repository

You’ll need a MonkeyCode account, a GitHub repository you own, and model access with available usage.

Open MonkeyCode

These links open the English product interface. Choose the User tab on the sign-in page.

Find your way around the current interface

If a region prompt appears, choose “Stay on International”.

On the sign-in page, keep the regular-user tab selected and choose your preferred sign-in method. Review the service terms before continuing.

English MonkeyCode sign-in screen showing the regular-user tab and GitHub, Google and password buttons.
Actual public sign-in screen, captured .

Work with a local folder

You’ll need the MonkeyCode desktop app, an available account or configured model connection, and Python in the local task environment.

Get the desktop app

These links open the English product interface. Choose the User tab on the sign-in page.

Find your way around the current interface

If a region prompt appears, choose “Stay on International”.

The link opens the desktop download section. Choose Windows, macOS or Linux for your computer, then follow the installer.

Running your own server? Self-hosted setup guide →

Open the example

Download the starter and extract it into a new folder named monkeycode-first-task. Keep the original ZIP so you can start again.

Download starter ZIP

You should see intervals.py, retry.py, two test files, README.md and TASKS.md directly inside that folder.

Python 3.10+

The initial local check needs Python 3.10+ on your computer; the MonkeyCode task environment also needs Python to check the fix. It uses the standard library only. Running it locally by hand needs no account or API key. Get Python ↗

Before opening the project in MonkeyCode, open a terminal in the extracted folder containing intervals.py and run this command.

Check command
python3 -m unittest discover -v

On Windows, if python3 is unavailable but the Python launcher is installed, use py -3 in its place in every command and in the prompt.

Expected before the fix
Ran 8 tests
FAILED (failures=1)

8 tests run. Only test_touching_is_not_overlap fails. This failure is the starting point of the exercise.

Seeing “Ran 0 tests”? Check the working folder. Zero tests is not a passing result for this exercise.

Open these files in MonkeyCode

In your browser

  1. Put the extracted example files in a new GitHub repository you own.
  2. In MonkeyCode settings, connect your GitHub identity and grant access to that repository.
  3. Create a project, give it a name and select the connected identity and example repository.
Detailed setup help →

In the desktop app

  1. Download and install the desktop app from the official product website.
  2. Select the local agent and open the extracted folder containing intervals.py.
  3. Confirm that the task is using that folder and an available model.
Detailed setup help →

Ask for the fix

Start a task for the example project, check the selected repository and model, then paste the prompt below into the task input.

Start a local task in the example folder. Confirm the folder and model, then paste the prompt below into the task input.

Paste this into MonkeyCode
Fix the half-open interval bug in intervals.py: (1, 3) and (3, 5) must not overlap. Only change intervals.py; do not weaken tests. Run python3 -m unittest discover -v. Report the diff, exact command and outcome. Done: all 8 existing tests pass, including the touching, empty and reversed cases.

Let the task finish, then review the changed files and its check output. Keep the original tests.

Check the result

Run the same check command again and review the diff. Use these three checks to decide whether to accept the change.

Check command
python3 -m unittest discover -v

  • Only intervals.py was edited; generated cache files do not count as source changes.
  • The original tests are unchanged and all 8 pass, including touching, empty and reversed intervals.
  • The task reports the change, the exact command and its result.
Expected after the fix
Ran 8 tests
OK

Check the test count as well as “OK”. A different correct implementation is fine if it meets the task requirements.

All three checks passed? Your first task is complete.

You have opened a project, requested a focused change and checked the result yourself. Save the diff before starting another task.

Keep going, when you’re ready

TASKS.md includes two optional follow-ups. Treat each as a separate task and review its changes against the previous step.

  1. Add four retry-policy tests without changing retry.py. The total should reach 12 passing tests.
  2. Add a “How it works” section to README.md without changing code. All 12 tests should still pass.
Reference solution & check output

Compare after trying the task. These locally checked reference files show the expected behavior; they are not a recorded MonkeyCode run.

Download reference + evidence ↓
Before · one failing testreturn a[0] <= b[1] and b[0] <= a[1]

[1, 3) + [3, 5) → True

After · eight passing testsreturn a[0] < b[1] and b[0] < a[1]

[1, 3) + [3, 5) → False

The results below are a locally authored and tested Codex reference exercise, not a MonkeyCode product run or a customer benchmark. No timing, token-cost or agent-success rate is claimed.

1. Bug fix

Touching intervals do not overlap. Only intervals.py changes.

Open recorded output and diff
--- a/intervals.py
+++ b/intervals.py
@@ -2,4 +2,4 @@
 def overlaps(a, b):
     if a[0] >= a[1] or b[0] >= b[1]:
         return False
-    return a[0] <= b[1] and b[0] <= a[1]
+    return a[0] < b[1] and b[0] < a[1]
test_empty (test_intervals.IntervalTests.test_empty) ... ok
test_reversed (test_intervals.IntervalTests.test_reversed) ... ok
test_separated (test_intervals.IntervalTests.test_separated) ... ok
test_shared_interior (test_intervals.IntervalTests.test_shared_interior) ... ok
test_touching_is_not_overlap (test_intervals.IntervalTests.test_touching_is_not_overlap) ... ok
test_budget (test_retry.RetryTests.test_budget) ... ok
test_success (test_retry.RetryTests.test_success) ... ok
test_transient (test_retry.RetryTests.test_transient) ... ok

----------------------------------------------------------------------
Ran 8 tests in 0.000s

OK

2. Add tests

Four retry tests cover rate limits, permanent errors, budget boundaries and invalid arguments.

Open recorded output and diff
--- a/test_retry.py
+++ b/test_retry.py
@@ -9,5 +9,18 @@
     def test_budget(self):
         self.assertFalse(should_retry(503, 3))
 
+class AddedRetryTests(unittest.TestCase):
+    def test_rate_limit(self):
+        self.assertTrue(should_retry(429, 1))
+    def test_permanent_error(self):
+        self.assertFalse(should_retry(400, 1))
+    def test_before_budget(self):
+        self.assertTrue(should_retry(503, 2))
+    def test_invalid_attempts(self):
+        for attempt, maximum in [(0, 3), (-1, 3), (1, 0)]:
+            with self.subTest(attempt=attempt, maximum=maximum):
+                with self.assertRaises(ValueError):
+                    should_retry(503, attempt, maximum)
+
 if __name__ == "__main__":
     unittest.main()
test_empty (test_intervals.IntervalTests.test_empty) ... ok
test_reversed (test_intervals.IntervalTests.test_reversed) ... ok
test_separated (test_intervals.IntervalTests.test_separated) ... ok
test_shared_interior (test_intervals.IntervalTests.test_shared_interior) ... ok
test_touching_is_not_overlap (test_intervals.IntervalTests.test_touching_is_not_overlap) ... ok
test_before_budget (test_retry.AddedRetryTests.test_before_budget) ... ok
test_invalid_attempts (test_retry.AddedRetryTests.test_invalid_attempts) ... ok
test_permanent_error (test_retry.AddedRetryTests.test_permanent_error) ... ok
test_rate_limit (test_retry.AddedRetryTests.test_rate_limit) ... ok
test_budget (test_retry.RetryTests.test_budget) ... ok
test_success (test_retry.RetryTests.test_success) ... ok
test_transient (test_retry.RetryTests.test_transient) ... ok

----------------------------------------------------------------------
Ran 12 tests in 0.000s

OK

3. Explain the code

A README section explains the two modules and keeps the reproducible command.

Open recorded output and diff
--- a/README.md
+++ b/README.md
@@ -9,3 +9,11 @@
 ```
 
 The initial interval test intentionally fails. Work on a copy.
+
+## How it works
+
+- `intervals.py` checks half-open intervals: touching endpoints do not overlap.
+- Empty or reversed intervals never overlap.
+- `retry.py` retries 408, 429, 500, 502, 503 and 504 responses only.
+- A retry is allowed only while `attempt < max_attempts`; attempts start at 1.
+- Non-positive attempt values or budgets raise `ValueError`.
test_empty (test_intervals.IntervalTests.test_empty) ... ok
test_reversed (test_intervals.IntervalTests.test_reversed) ... ok
test_separated (test_intervals.IntervalTests.test_separated) ... ok
test_shared_interior (test_intervals.IntervalTests.test_shared_interior) ... ok
test_touching_is_not_overlap (test_intervals.IntervalTests.test_touching_is_not_overlap) ... ok
test_before_budget (test_retry.AddedRetryTests.test_before_budget) ... ok
test_invalid_attempts (test_retry.AddedRetryTests.test_invalid_attempts) ... ok
test_permanent_error (test_retry.AddedRetryTests.test_permanent_error) ... ok
test_rate_limit (test_retry.AddedRetryTests.test_rate_limit) ... ok
test_budget (test_retry.RetryTests.test_budget) ... ok
test_success (test_retry.RetryTests.test_success) ... ok
test_transient (test_retry.RetryTests.test_transient) ... ok

----------------------------------------------------------------------
Ran 12 tests in 0.000s

OK
Environment, hashes and all stage results →

Reproduce the reference

Unzip the reference archive, enter its top-level folder and run python3 verify.py. It uses temporary copies and checks the intentional failure, the fixes, the documentation and a mutation. The public answers make this unsuitable as a blind benchmark.

Check command
python3 verify.py

Need a hand?

Do I need an account or an API key?
The local Python exercise itself needs neither. To ask MonkeyCode to do the task, the hosted service needs an account and available model usage; the desktop app needs an available account or configured model connection.
What if Python is missing?
Install Python 3.10 or later in the environment where the tests run. Check python3 --version there. On Windows with the Python launcher, use py -3 --version and replace python3 with py -3 in the commands and prompt.
Why does the first check fail?
The starter deliberately contains a boundary bug. Expect 8 tests with exactly one failure, test_touching_is_not_overlap. If you see zero tests or a different failure, check the folder, Python installation and starter files first.
Why can’t I see my GitHub repository?
Check the connected GitHub account and the app’s repository access. Organization repositories may require owner approval. Refresh the repository selection after changing access.
What if the task does not fix the bug?
Keep the failure output and ask for a correction within the same file scope. If tests or unrelated source files were changed, start with a freshly extracted copy. Accept the result only after all 8 original tests pass.

Cookie settings

We use cookies only for analytics (GA4 + Matomo) to improve the docs. No ads, no tracking across sites.