sisyphus-agent 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sisyphus_agent-0.1.0/LICENSE +21 -0
- sisyphus_agent-0.1.0/PKG-INFO +330 -0
- sisyphus_agent-0.1.0/README.md +307 -0
- sisyphus_agent-0.1.0/agent/__init__.py +0 -0
- sisyphus_agent-0.1.0/agent/analysis/__init__.py +0 -0
- sisyphus_agent-0.1.0/agent/analysis/context_builder.py +20 -0
- sisyphus_agent-0.1.0/agent/analysis/patch_validator.py +114 -0
- sisyphus_agent-0.1.0/agent/analysis/test_output_parser.py +118 -0
- sisyphus_agent-0.1.0/agent/config.py +104 -0
- sisyphus_agent-0.1.0/agent/core/__init__.py +0 -0
- sisyphus_agent-0.1.0/agent/core/agent_loop.py +68 -0
- sisyphus_agent-0.1.0/agent/core/state.py +97 -0
- sisyphus_agent-0.1.0/agent/core/stopping_criteria.py +24 -0
- sisyphus_agent-0.1.0/agent/core/strategy_manager.py +20 -0
- sisyphus_agent-0.1.0/agent/github/__init__.py +0 -0
- sisyphus_agent-0.1.0/agent/github/issue_fetcher.py +51 -0
- sisyphus_agent-0.1.0/agent/github/pr_creator.py +41 -0
- sisyphus_agent-0.1.0/agent/github/repo_cloner.py +35 -0
- sisyphus_agent-0.1.0/agent/llm/__init__.py +0 -0
- sisyphus_agent-0.1.0/agent/llm/gemini_client.py +156 -0
- sisyphus_agent-0.1.0/agent/llm/llm_client.py +31 -0
- sisyphus_agent-0.1.0/agent/llm/local_client.py +152 -0
- sisyphus_agent-0.1.0/agent/llm/prompts.py +48 -0
- sisyphus_agent-0.1.0/agent/main.py +211 -0
- sisyphus_agent-0.1.0/agent/sandbox/Dockerfile.base +14 -0
- sisyphus_agent-0.1.0/agent/sandbox/__init__.py +0 -0
- sisyphus_agent-0.1.0/agent/sandbox/docker_manager.py +135 -0
- sisyphus_agent-0.1.0/agent/sandbox/env_builder.py +73 -0
- sisyphus_agent-0.1.0/agent/sandbox/resource_limits.py +25 -0
- sisyphus_agent-0.1.0/agent/tools/__init__.py +0 -0
- sisyphus_agent-0.1.0/agent/tools/code_search.py +26 -0
- sisyphus_agent-0.1.0/agent/tools/file_editor.py +135 -0
- sisyphus_agent-0.1.0/agent/tools/file_viewer.py +50 -0
- sisyphus_agent-0.1.0/agent/tools/registry.py +116 -0
- sisyphus_agent-0.1.0/agent/tools/repo_map.py +66 -0
- sisyphus_agent-0.1.0/agent/tools/shell_tool.py +7 -0
- sisyphus_agent-0.1.0/agent/tools/symbol_search.py +20 -0
- sisyphus_agent-0.1.0/agent/tools/test_runner.py +34 -0
- sisyphus_agent-0.1.0/agent/ui/__init__.py +3 -0
- sisyphus_agent-0.1.0/agent/ui/live.py +260 -0
- sisyphus_agent-0.1.0/agent/ui/view.py +228 -0
- sisyphus_agent-0.1.0/agent/utils/__init__.py +0 -0
- sisyphus_agent-0.1.0/agent/utils/cost_tracker.py +42 -0
- sisyphus_agent-0.1.0/agent/utils/git.py +21 -0
- sisyphus_agent-0.1.0/agent/utils/trajectory_logger.py +38 -0
- sisyphus_agent-0.1.0/evaluation/__init__.py +0 -0
- sisyphus_agent-0.1.0/evaluation/benchmark_runner.py +73 -0
- sisyphus_agent-0.1.0/evaluation/metrics.py +41 -0
- sisyphus_agent-0.1.0/evaluation/swebench_adapter.py +39 -0
- sisyphus_agent-0.1.0/evaluation/trajectory_analyzer.py +48 -0
- sisyphus_agent-0.1.0/pyproject.toml +40 -0
- sisyphus_agent-0.1.0/setup.cfg +4 -0
- sisyphus_agent-0.1.0/sisyphus_agent.egg-info/PKG-INFO +330 -0
- sisyphus_agent-0.1.0/sisyphus_agent.egg-info/SOURCES.txt +65 -0
- sisyphus_agent-0.1.0/sisyphus_agent.egg-info/dependency_links.txt +1 -0
- sisyphus_agent-0.1.0/sisyphus_agent.egg-info/entry_points.txt +3 -0
- sisyphus_agent-0.1.0/sisyphus_agent.egg-info/requires.txt +14 -0
- sisyphus_agent-0.1.0/sisyphus_agent.egg-info/top_level.txt +2 -0
- sisyphus_agent-0.1.0/tests/test_agent_loop.py +92 -0
- sisyphus_agent-0.1.0/tests/test_file_editor.py +60 -0
- sisyphus_agent-0.1.0/tests/test_fixes.py +388 -0
- sisyphus_agent-0.1.0/tests/test_gemini_client.py +98 -0
- sisyphus_agent-0.1.0/tests/test_local_client.py +140 -0
- sisyphus_agent-0.1.0/tests/test_security.py +125 -0
- sisyphus_agent-0.1.0/tests/test_stopping_criteria.py +70 -0
- sisyphus_agent-0.1.0/tests/test_test_output_parser.py +36 -0
- sisyphus_agent-0.1.0/tests/test_ui.py +100 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Udvranto Studio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sisyphus-agent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Autonomous GitHub issue resolver: reproduces a bug, fixes it in a Docker sandbox, and verifies the fix with tests.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/udvranto-studio/sisyphus
|
|
7
|
+
Project-URL: Issues, https://github.com/udvranto-studio/sisyphus/issues
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: anthropic>=0.40.0
|
|
12
|
+
Requires-Dist: docker>=7.0.0
|
|
13
|
+
Requires-Dist: requests>=2.31.0
|
|
14
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
15
|
+
Requires-Dist: rich>=13.7.0
|
|
16
|
+
Provides-Extra: bench
|
|
17
|
+
Requires-Dist: datasets>=2.19.0; extra == "bench"
|
|
18
|
+
Provides-Extra: gemini
|
|
19
|
+
Requires-Dist: google-genai>=3.7.0; extra == "gemini"
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
<p align="center">
|
|
25
|
+
<img src="assets/banners/readme/sisyphus-1280x320.svg" alt="sisyphus: an autonomous GitHub issue resolver. Reproduce, fix, verify." width="100%">
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
# sisyphus
|
|
29
|
+
|
|
30
|
+
[](https://github.com/udvranto-studio/sisyphus/actions/workflows/ci.yml)
|
|
31
|
+
|
|
32
|
+
An autonomous agent that turns a GitHub issue into a verified pull request. It reproduces the bug with a failing test, fixes it in a Docker sandbox, and only calls an issue resolved when the tests pass with no new failures.
|
|
33
|
+
|
|
34
|
+
- **Reproduce first.** Before it touches source code, the agent writes a `repro_<name>.py` test that actually fails because of the bug. An import error or "file not found" does not count.
|
|
35
|
+
- **Verified, not claimed.** A run is `resolved` only if, after the last edit, every repro test passes and the full suite shows no failures beyond those that existed before the fix.
|
|
36
|
+
- **Sandboxed.** Code runs in a Docker container with no network, all capabilities dropped and nothing mounted from the host.
|
|
37
|
+
- **Can't game the tests.** Test files, pytest configuration and any repro test that has already failed are read-only, and the final patch is checked again after the run.
|
|
38
|
+
|
|
39
|
+
## How it works
|
|
40
|
+
|
|
41
|
+
<picture>
|
|
42
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/architecture/architecture-dark.svg">
|
|
43
|
+
<img src="docs/architecture/architecture-light.svg" alt="Run lifecycle: setup (fetch issue, clone, build image, start sandbox), agent loop (LLM picks a tool; host tools edit the repo, sandbox tools search and test; test output updates state, nudges and stop checks), output (patch validation, status, optional PR, trajectory log)." width="100%">
|
|
44
|
+
</picture>
|
|
45
|
+
|
|
46
|
+
1. **Setup.** `issue_fetcher` pulls the issue and its comments, `repo_cloner` clones the repo (optionally at a given commit), `env_builder` builds an image with a copy of the repo and its dependencies installed, and `docker_manager` starts the container. The full test suite then runs once on the unmodified code, so failures that existed before the fix are known as the baseline even if the model never runs the suite itself.
|
|
47
|
+
2. **Agent loop.** Each step, the model (Claude by default, Gemini, or a local model) sees the issue, a repo map, recent tool results and any nudges, then calls tools:
|
|
48
|
+
- Host tools (`view_file`, `repo_map`, `str_replace`, `create_file`, `revert_changes`) work on the host checkout, which is the source of truth.
|
|
49
|
+
- Sandbox tools (`search_code`, `find_symbol`, `run_tests`, `run_shell`) run in the container. Host edits are synced in before every command, and test runs first discard anything changed inside the container.
|
|
50
|
+
- Test output is parsed into failing test ids, `state` tracks edits, repro and baseline failures, `strategy_manager` injects nudges (stuck, no repro, low budget) and `stopping_criteria` decides whether to continue.
|
|
51
|
+
3. **Output.** `patch_validator` builds the final diff (repro files excluded) and rejects patches that touch tests, change pytest config, have syntax errors or exceed 400 changed lines. The run gets a status, a PR is opened only if it is `resolved`, and the full trajectory is saved as JSON.
|
|
52
|
+
|
|
53
|
+
The run stops when the fix is verified, the agent calls `finish`, the same failure repeats too often, or a budget runs out (steps, cost or time).
|
|
54
|
+
|
|
55
|
+
## Quick start
|
|
56
|
+
|
|
57
|
+
Requirements: Python 3.11+, Docker (the daemon running and usable by your user), and an API key for Anthropic or Google Gemini (see [Using Gemini](#using-gemini)), or a model running on your own machine (see [Using a local model](#using-a-local-model)).
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install sisyphus-agent
|
|
61
|
+
|
|
62
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
63
|
+
export GITHUB_TOKEN=ghp_... # optional: higher API rate limits, private repos, --open-pr
|
|
64
|
+
|
|
65
|
+
sisyphus
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
To keep the keys instead of exporting them in every shell, put them in `~/.sisyphus/.env`, one `NAME=value` per line. Runs are saved under `~/.sisyphus/` too. `pipx install sisyphus-agent` installs the command in its own environment.
|
|
69
|
+
|
|
70
|
+
To work on the code, install from a checkout instead. Settings then go in `.env` at the project root and runs under `data/`:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone https://github.com/udvranto-studio/sisyphus.git
|
|
74
|
+
cd sisyphus
|
|
75
|
+
pip install -e ".[dev]"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Run `sisyphus` (or `./run.sh` in a checkout) with no link to start an interactive session: it shows the agent's name with the provider and model in use, then asks for the issue link:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
╭──────────────────────────────────╮
|
|
82
|
+
│ ✻ Sisyphus │
|
|
83
|
+
│ autonomous GitHub issue solver │
|
|
84
|
+
│ │
|
|
85
|
+
│ provider anthropic │
|
|
86
|
+
│ model claude-... │
|
|
87
|
+
╰──────────────────────────────────╯
|
|
88
|
+
GitHub issue link › https://github.com/owner/repo/issues/123
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The session stays open: after each run it asks for the next link. Ctrl+C cancels a running issue and returns to the prompt; Ctrl+C at the prompt exits. With a link on the command line (`sisyphus solve <url>`) it solves that one issue and exits with the run's exit code, for scripts and CI. Options work the same way without `solve` (`sisyphus --provider local --max-steps 20`). The older command name `agent` still works. A run ends with one line saying how it went, followed by the details:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
✓ PASSED: issue resolved, fix verified by tests
|
|
95
|
+
! NOT VERIFIED: a patch was made but no test proves it
|
|
96
|
+
✗ FAILED: max_steps; empty patch
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Setup errors, such as a link that is not an issue, an issue that does not exist, the GitHub rate limit or a failed clone, end with `✗ FAILED` and the reason instead of a traceback.
|
|
100
|
+
|
|
101
|
+
In a terminal, the run shows a live panel: step, cost and time budgets, whether the bug is reproduced and the fix verified, recent tool calls with their results, and what the agent is doing right now. To see it without Docker or an API key, run `python scripts/demo_ui.py` (a scripted model fixing a bug in a throwaway repo). In a checkout, `./run.sh` does the same without installing the package (activate the virtualenv first so it finds the dependencies). The base sandbox image (`agent/sandbox/Dockerfile.base`, shipped with the package) is built automatically on first use.
|
|
102
|
+
|
|
103
|
+
### Options
|
|
104
|
+
|
|
105
|
+
| Flag | Default | Meaning |
|
|
106
|
+
|------|---------|---------|
|
|
107
|
+
| `--commit SHA` | default branch HEAD | Check out this commit before solving |
|
|
108
|
+
| `--max-steps N` | `40` | Maximum agent steps |
|
|
109
|
+
| `--max-cost USD` | `2.0` | Stop once the estimated API cost reaches this |
|
|
110
|
+
| `--timeout SEC` | `1800` | Wall-clock limit for the run |
|
|
111
|
+
| `--open-pr` | off | Push a branch and open a PR if the run is `resolved` (needs `GITHUB_TOKEN` with push access) |
|
|
112
|
+
| `--no-reproduce` | off | Skip the reproduce-first requirement |
|
|
113
|
+
| `--provider NAME` | `anthropic` | `anthropic`, `gemini` or `local` (or set `LLM_PROVIDER`) |
|
|
114
|
+
| `--model ID` | provider default | Model to use (or set `LLM_MODEL`) |
|
|
115
|
+
| `--plain` | off | One line per step instead of the live view (used automatically when output is not a terminal) |
|
|
116
|
+
|
|
117
|
+
### Results
|
|
118
|
+
|
|
119
|
+
| Status | Meaning | Exit code |
|
|
120
|
+
|--------|---------|-----------|
|
|
121
|
+
| `resolved` | Patch is valid and verified by repro and full-suite test runs after the last edit | `0` |
|
|
122
|
+
| `unverified` | Patch is valid and the agent says it is done, but test evidence is missing. Usually correct, but review the patch | `2` |
|
|
123
|
+
| `unresolved` | No valid patch, the agent gave up, or a budget ran out | `2` |
|
|
124
|
+
|
|
125
|
+
Everything a run produces goes under `~/.sisyphus/` (`data/` in a checkout):
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
data/
|
|
129
|
+
├── repos/ # cloned repositories
|
|
130
|
+
├── patches/ # <run-id>.diff, the final patch
|
|
131
|
+
├── trajectories/ # <run-id>.json, every step, tool call, test run and cost (<run-id>.events.jsonl while running)
|
|
132
|
+
└── benchmark_results/ # SWE-bench runs
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Using Gemini
|
|
136
|
+
|
|
137
|
+
Gemini works as a drop-in alternative to Claude, including on Google's free tier:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pip install "sisyphus-agent[gemini]" # in a checkout: pip install -e ".[gemini]"
|
|
141
|
+
export GEMINI_API_KEY=... # from Google AI Studio
|
|
142
|
+
sisyphus solve https://github.com/owner/repo/issues/123 --provider gemini
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The default model is `gemini-3.8-flash`. Two things to know about the free tier: Google may use what you send (here, the repository's code) to improve its products, so use it for public code; and its per-minute limits are low, so the client waits and retries when it hits them. Cost is shown as $0 because free-tier prices are used; set the `price_*` fields if you are on the paid tier. The prompts were written for Claude, so results with Gemini can differ.
|
|
146
|
+
|
|
147
|
+
### Using a local model
|
|
148
|
+
|
|
149
|
+
The `local` provider runs the agent on a model served from your own machine, with no API key, no per-token cost, and no code leaving the machine. It works with any server that offers an OpenAI-compatible API: Ollama, LM Studio, the llama.cpp server or vLLM. Docker is still needed, as with every provider, because the repository's code runs in the sandbox.
|
|
150
|
+
|
|
151
|
+
#### Which hardware you need
|
|
152
|
+
|
|
153
|
+
The agent takes many tool-calling steps per issue, so the model has to be fairly capable:
|
|
154
|
+
|
|
155
|
+
| Model size | Example | Memory needed | What to expect |
|
|
156
|
+
|------------|---------|---------------|----------------|
|
|
157
|
+
| ~3B | `qwen2.5-coder:3b` | ~4 GB RAM | Checks that the setup works; rarely solves real issues |
|
|
158
|
+
| 7–14B | `qwen2.5-coder:14b` | 8–16 GB RAM or GPU memory | Sometimes works on simple issues; often loses track |
|
|
159
|
+
| ~30B+ | `qwen2.5-coder:32b` | 24 GB+ GPU memory | Recommended for real use |
|
|
160
|
+
|
|
161
|
+
Models run without a GPU too, but much more slowly. If your machine is too small for a 30B model, run the model on another machine (see below) or use Gemini's free tier instead.
|
|
162
|
+
|
|
163
|
+
#### Setup with Ollama
|
|
164
|
+
|
|
165
|
+
1. Install [Docker](https://docs.docker.com/engine/install/) and [Ollama](https://ollama.com/download).
|
|
166
|
+
2. Download a model:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
ollama pull qwen2.5-coder:32b
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
3. Start Ollama with a larger context window and leave it running. Ollama's default window is too small for the agent's history:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
OLLAMA_CONTEXT_LENGTH=32768 ollama serve
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
If Ollama already runs as a system service, stop it first (`sudo systemctl stop ollama`), or set the variable in the service (`sudo systemctl edit ollama`, then add `Environment="OLLAMA_CONTEXT_LENGTH=32768"`).
|
|
179
|
+
|
|
180
|
+
4. In another terminal, install the project and run it:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
python -m venv .venv && source .venv/bin/activate
|
|
184
|
+
pip install sisyphus-agent
|
|
185
|
+
sisyphus solve https://github.com/owner/repo/issues/123 --provider local --model qwen2.5-coder:32b
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
To skip the flags every time, put `LLM_PROVIDER=local` and `LLM_MODEL=qwen2.5-coder:32b` in `.env` (`~/.sisyphus/.env` for a pip install).
|
|
189
|
+
|
|
190
|
+
#### Tuning a model for the agent
|
|
191
|
+
|
|
192
|
+
Most failures with local models come from the model's settings, not its size. Bake these into a model of your own with an Ollama Modelfile:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
cat > Modelfile <<'MF'
|
|
196
|
+
FROM qwen2.5-coder:14b
|
|
197
|
+
PARAMETER num_ctx 32768
|
|
198
|
+
PARAMETER temperature 0.6
|
|
199
|
+
PARAMETER presence_penalty 0
|
|
200
|
+
MF
|
|
201
|
+
ollama create coder-agent -f Modelfile
|
|
202
|
+
sisyphus --provider local --model coder-agent --max-steps 20
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
- **`presence_penalty 0`.** Some models ship with a presence penalty (Qwen 3.5 uses 1.5) that discourages repeating words. Code must repeat names and copy lines exactly, so with it the edits come out garbled and `str_replace` keeps reporting `old_str not found`.
|
|
206
|
+
- **Context.** The history is never trimmed, and a run needs about 7k tokens plus 1k per step. With 32k, keep `--max-steps` near 20; past that Ollama silently drops the start of the conversation, including the issue.
|
|
207
|
+
- **Keep it on the GPU.** `ollama ps` shows the CPU/GPU split; any CPU share makes replies several times slower. Start the server with `OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0` to halve the context's memory. If Ollama still leaves layers on the CPU while GPU memory is free, add `PARAMETER num_gpu 99` to load them all (on an 8 GB card this took a 9.7B model from 24 to 69 tokens/s).
|
|
208
|
+
|
|
209
|
+
#### Running the model on another machine
|
|
210
|
+
|
|
211
|
+
If a stronger machine (a desktop with a GPU, or a cloud server) is available, run the model there and the agent on your own computer:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# on the GPU machine
|
|
215
|
+
ollama pull qwen2.5-coder:32b
|
|
216
|
+
OLLAMA_HOST=0.0.0.0 OLLAMA_CONTEXT_LENGTH=32768 ollama serve
|
|
217
|
+
|
|
218
|
+
# on your computer
|
|
219
|
+
export LOCAL_BASE_URL=http://<gpu-machine-ip>:11434/v1
|
|
220
|
+
sisyphus solve https://github.com/owner/repo/issues/123 --provider local --model qwen2.5-coder:32b
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Ollama has no authentication, so keep it reachable only from your own network or over a VPN, never from the open internet.
|
|
224
|
+
|
|
225
|
+
#### Other servers
|
|
226
|
+
|
|
227
|
+
Point `LOCAL_BASE_URL` at the server: LM Studio `http://localhost:1234/v1`, llama.cpp `http://localhost:8080/v1`, vLLM `http://localhost:8000/v1` (default: Ollama's `http://localhost:11434/v1`). Set `LOCAL_API_KEY` if the server was started with a key, and give the model a context window of 32k tokens or more.
|
|
228
|
+
|
|
229
|
+
#### What to expect
|
|
230
|
+
|
|
231
|
+
- **Tool calling is required.** If the model does not support it, the server says so and the run stops with that error.
|
|
232
|
+
- **Speed.** Replies can be slow; one reply may take up to `local_timeout` (600 s) before the run stops.
|
|
233
|
+
- **Cost.** Shown as $0, so `--max-cost` has no effect; `--max-steps` and `--timeout` still apply.
|
|
234
|
+
- **Results.** The prompts were written for Claude, so local models solve fewer issues.
|
|
235
|
+
|
|
236
|
+
## Configuration
|
|
237
|
+
|
|
238
|
+
Defaults live in [`agent/config.py`](agent/config.py). The main settings:
|
|
239
|
+
|
|
240
|
+
| Setting | Default | Notes |
|
|
241
|
+
|---------|---------|-------|
|
|
242
|
+
| `provider` | `anthropic` | `anthropic`, `gemini` or `local`; also `--provider` or `LLM_PROVIDER` |
|
|
243
|
+
| `model` | provider default | `claude-sonnet-5-5` or `gemini-3.8-flash`; required for `local`. Also `--model` or `LLM_MODEL`. Set the four `price_*` fields if you change it |
|
|
244
|
+
| `local_base_url` | `http://localhost:11434/v1` | OpenAI-compatible server for `local`; also `LOCAL_BASE_URL` |
|
|
245
|
+
| `max_output_tokens` | `16000` | Per LLM call |
|
|
246
|
+
| `stuck_threshold` | `3` | Nudge after N identical failures, stop after 2N |
|
|
247
|
+
| `tool_output_limit` | `8000` | Characters returned from any tool call |
|
|
248
|
+
| `sandbox_cpus` / `sandbox_memory` / `sandbox_pids` | `2.0` / `4g` / `512` | Container limits |
|
|
249
|
+
| `sandbox_network` | `none` | No network inside the sandbox (dependencies install at image build time) |
|
|
250
|
+
| `command_timeout` | `300` | Seconds per command; full test runs get 3× |
|
|
251
|
+
|
|
252
|
+
## Safety model
|
|
253
|
+
|
|
254
|
+
- **Secrets stay on the host.** API keys are never passed into the container, and the GitHub token is removed from the clone's `.git/config` and redacted from error messages.
|
|
255
|
+
- **`.git` is off limits.** File tools reject any path that resolves into `.git` or outside the repo, including through symlinks. Host git calls run with hooks and fsmonitor disabled.
|
|
256
|
+
- **Disposable shell.** `run_shell` runs bash inside the container, which is the security boundary: no network, no capabilities, its own copy of the repo. Its changes are discarded before each test run and never reach the patch.
|
|
257
|
+
- **Edits are checked.** `str_replace` must match exactly one place, Python edits that would not compile are rejected, and CRLF line endings are kept.
|
|
258
|
+
- **Patch validation at the end.** The patch is checked again whatever the tools allowed, so a bad patch is caught even if a guard was bypassed.
|
|
259
|
+
|
|
260
|
+
## Evaluation (SWE-bench)
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
pip install -e ".[bench]"
|
|
264
|
+
|
|
265
|
+
# run the agent on 25 SWE-bench Lite instances (resumable)
|
|
266
|
+
python -m evaluation.benchmark_runner --dataset swebench-lite --limit 25 --run-name my-run
|
|
267
|
+
|
|
268
|
+
# score predictions with the official harness (printed by the runner), then summarize
|
|
269
|
+
python -m evaluation.metrics data/benchmark_results/my-run --report <harness-report.json>
|
|
270
|
+
|
|
271
|
+
# group failed runs by cause: stuck_loop, out_of_budget, never_reproduced, regression, ...
|
|
272
|
+
python -m evaluation.trajectory_analyzer data/trajectories --prefix my-run
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
The agent sees only the problem statement, never the hidden tests. `--dataset swebench-verified` is also supported. Older SWE-bench repos often need specific Python versions that the generic image builder may not handle; for serious runs use SWE-bench's prebuilt per-instance images.
|
|
276
|
+
|
|
277
|
+
## Development
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
pip install -e ".[dev]"
|
|
281
|
+
pytest
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
The tests cover the agent loop, stopping rules, the pytest output parser, the file editor, sandbox sync and the security guards, and run without Docker or an API key.
|
|
285
|
+
|
|
286
|
+
### CI and releases
|
|
287
|
+
|
|
288
|
+
- **CI** ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)) runs the tests on Python 3.11 to 3.14 for every pull request and every push to `main`.
|
|
289
|
+
- **Releases** ([`.github/workflows/release.yml`](.github/workflows/release.yml)): to publish a version, set `version` in `pyproject.toml`, commit it, then push a matching tag. The workflow runs the tests, builds the package, publishes it to [PyPI](https://pypi.org/project/sisyphus-agent/) and creates a GitHub Release with the wheel and source archive attached:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
git tag v0.2.0
|
|
293
|
+
git push origin v0.2.0
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
PyPI accepts the upload through [trusted publishing](https://docs.pypi.org/trusted-publishers/), so no token is stored in the repository. Set it up once before the first release: on PyPI, under *Your projects → Publishing → Add a new pending publisher*, enter project `sisyphus-agent`, owner `udvranto-studio`, repository `sisyphus` and workflow `release.yml`. A version can be uploaded to PyPI only once, so bump `version` for every release.
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
agent/
|
|
300
|
+
├── main.py # CLI and run_task()
|
|
301
|
+
├── config.py # settings, budgets, pricing
|
|
302
|
+
├── core/ # agent loop, state, stopping criteria, nudges
|
|
303
|
+
├── llm/ # Anthropic, Gemini and local-model clients, prompts
|
|
304
|
+
├── tools/ # tool schemas and handlers
|
|
305
|
+
├── analysis/ # context building, test output parsing, patch validation
|
|
306
|
+
├── sandbox/ # base image Dockerfile, image builder, container manager, resource limits
|
|
307
|
+
├── github/ # issue fetcher, repo cloner, PR creator
|
|
308
|
+
└── utils/ # cost tracker, trajectory logger, hardened git
|
|
309
|
+
evaluation/ # SWE-bench runner, metrics, trajectory analysis
|
|
310
|
+
docs/architecture/ # design tokens and the diagram builder
|
|
311
|
+
assets/banners/readme/ # README banner builder
|
|
312
|
+
tests/
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
The diagram and the banner are generated from one set of design tokens, [`docs/architecture/tokens.json`](docs/architecture/tokens.json), in three layers: primitive → semantic (light/dark) → component. After editing the tokens, rebuild both:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
python docs/architecture/build_diagram.py
|
|
319
|
+
python assets/banners/readme/build_banner.py
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## Limitations
|
|
323
|
+
|
|
324
|
+
- Only Python repositories with pytest are supported.
|
|
325
|
+
- `--open-pr` pushes to the issue's repository, so it needs push access there (no fork workflow yet).
|
|
326
|
+
- Repos whose dependencies fail to install in the generic image may not run correctly.
|
|
327
|
+
|
|
328
|
+
## License
|
|
329
|
+
|
|
330
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/banners/readme/sisyphus-1280x320.svg" alt="sisyphus: an autonomous GitHub issue resolver. Reproduce, fix, verify." width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# sisyphus
|
|
6
|
+
|
|
7
|
+
[](https://github.com/udvranto-studio/sisyphus/actions/workflows/ci.yml)
|
|
8
|
+
|
|
9
|
+
An autonomous agent that turns a GitHub issue into a verified pull request. It reproduces the bug with a failing test, fixes it in a Docker sandbox, and only calls an issue resolved when the tests pass with no new failures.
|
|
10
|
+
|
|
11
|
+
- **Reproduce first.** Before it touches source code, the agent writes a `repro_<name>.py` test that actually fails because of the bug. An import error or "file not found" does not count.
|
|
12
|
+
- **Verified, not claimed.** A run is `resolved` only if, after the last edit, every repro test passes and the full suite shows no failures beyond those that existed before the fix.
|
|
13
|
+
- **Sandboxed.** Code runs in a Docker container with no network, all capabilities dropped and nothing mounted from the host.
|
|
14
|
+
- **Can't game the tests.** Test files, pytest configuration and any repro test that has already failed are read-only, and the final patch is checked again after the run.
|
|
15
|
+
|
|
16
|
+
## How it works
|
|
17
|
+
|
|
18
|
+
<picture>
|
|
19
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/architecture/architecture-dark.svg">
|
|
20
|
+
<img src="docs/architecture/architecture-light.svg" alt="Run lifecycle: setup (fetch issue, clone, build image, start sandbox), agent loop (LLM picks a tool; host tools edit the repo, sandbox tools search and test; test output updates state, nudges and stop checks), output (patch validation, status, optional PR, trajectory log)." width="100%">
|
|
21
|
+
</picture>
|
|
22
|
+
|
|
23
|
+
1. **Setup.** `issue_fetcher` pulls the issue and its comments, `repo_cloner` clones the repo (optionally at a given commit), `env_builder` builds an image with a copy of the repo and its dependencies installed, and `docker_manager` starts the container. The full test suite then runs once on the unmodified code, so failures that existed before the fix are known as the baseline even if the model never runs the suite itself.
|
|
24
|
+
2. **Agent loop.** Each step, the model (Claude by default, Gemini, or a local model) sees the issue, a repo map, recent tool results and any nudges, then calls tools:
|
|
25
|
+
- Host tools (`view_file`, `repo_map`, `str_replace`, `create_file`, `revert_changes`) work on the host checkout, which is the source of truth.
|
|
26
|
+
- Sandbox tools (`search_code`, `find_symbol`, `run_tests`, `run_shell`) run in the container. Host edits are synced in before every command, and test runs first discard anything changed inside the container.
|
|
27
|
+
- Test output is parsed into failing test ids, `state` tracks edits, repro and baseline failures, `strategy_manager` injects nudges (stuck, no repro, low budget) and `stopping_criteria` decides whether to continue.
|
|
28
|
+
3. **Output.** `patch_validator` builds the final diff (repro files excluded) and rejects patches that touch tests, change pytest config, have syntax errors or exceed 400 changed lines. The run gets a status, a PR is opened only if it is `resolved`, and the full trajectory is saved as JSON.
|
|
29
|
+
|
|
30
|
+
The run stops when the fix is verified, the agent calls `finish`, the same failure repeats too often, or a budget runs out (steps, cost or time).
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
Requirements: Python 3.11+, Docker (the daemon running and usable by your user), and an API key for Anthropic or Google Gemini (see [Using Gemini](#using-gemini)), or a model running on your own machine (see [Using a local model](#using-a-local-model)).
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install sisyphus-agent
|
|
38
|
+
|
|
39
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
40
|
+
export GITHUB_TOKEN=ghp_... # optional: higher API rate limits, private repos, --open-pr
|
|
41
|
+
|
|
42
|
+
sisyphus
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
To keep the keys instead of exporting them in every shell, put them in `~/.sisyphus/.env`, one `NAME=value` per line. Runs are saved under `~/.sisyphus/` too. `pipx install sisyphus-agent` installs the command in its own environment.
|
|
46
|
+
|
|
47
|
+
To work on the code, install from a checkout instead. Settings then go in `.env` at the project root and runs under `data/`:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/udvranto-studio/sisyphus.git
|
|
51
|
+
cd sisyphus
|
|
52
|
+
pip install -e ".[dev]"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Run `sisyphus` (or `./run.sh` in a checkout) with no link to start an interactive session: it shows the agent's name with the provider and model in use, then asks for the issue link:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
╭──────────────────────────────────╮
|
|
59
|
+
│ ✻ Sisyphus │
|
|
60
|
+
│ autonomous GitHub issue solver │
|
|
61
|
+
│ │
|
|
62
|
+
│ provider anthropic │
|
|
63
|
+
│ model claude-... │
|
|
64
|
+
╰──────────────────────────────────╯
|
|
65
|
+
GitHub issue link › https://github.com/owner/repo/issues/123
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The session stays open: after each run it asks for the next link. Ctrl+C cancels a running issue and returns to the prompt; Ctrl+C at the prompt exits. With a link on the command line (`sisyphus solve <url>`) it solves that one issue and exits with the run's exit code, for scripts and CI. Options work the same way without `solve` (`sisyphus --provider local --max-steps 20`). The older command name `agent` still works. A run ends with one line saying how it went, followed by the details:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
✓ PASSED: issue resolved, fix verified by tests
|
|
72
|
+
! NOT VERIFIED: a patch was made but no test proves it
|
|
73
|
+
✗ FAILED: max_steps; empty patch
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Setup errors, such as a link that is not an issue, an issue that does not exist, the GitHub rate limit or a failed clone, end with `✗ FAILED` and the reason instead of a traceback.
|
|
77
|
+
|
|
78
|
+
In a terminal, the run shows a live panel: step, cost and time budgets, whether the bug is reproduced and the fix verified, recent tool calls with their results, and what the agent is doing right now. To see it without Docker or an API key, run `python scripts/demo_ui.py` (a scripted model fixing a bug in a throwaway repo). In a checkout, `./run.sh` does the same without installing the package (activate the virtualenv first so it finds the dependencies). The base sandbox image (`agent/sandbox/Dockerfile.base`, shipped with the package) is built automatically on first use.
|
|
79
|
+
|
|
80
|
+
### Options
|
|
81
|
+
|
|
82
|
+
| Flag | Default | Meaning |
|
|
83
|
+
|------|---------|---------|
|
|
84
|
+
| `--commit SHA` | default branch HEAD | Check out this commit before solving |
|
|
85
|
+
| `--max-steps N` | `40` | Maximum agent steps |
|
|
86
|
+
| `--max-cost USD` | `2.0` | Stop once the estimated API cost reaches this |
|
|
87
|
+
| `--timeout SEC` | `1800` | Wall-clock limit for the run |
|
|
88
|
+
| `--open-pr` | off | Push a branch and open a PR if the run is `resolved` (needs `GITHUB_TOKEN` with push access) |
|
|
89
|
+
| `--no-reproduce` | off | Skip the reproduce-first requirement |
|
|
90
|
+
| `--provider NAME` | `anthropic` | `anthropic`, `gemini` or `local` (or set `LLM_PROVIDER`) |
|
|
91
|
+
| `--model ID` | provider default | Model to use (or set `LLM_MODEL`) |
|
|
92
|
+
| `--plain` | off | One line per step instead of the live view (used automatically when output is not a terminal) |
|
|
93
|
+
|
|
94
|
+
### Results
|
|
95
|
+
|
|
96
|
+
| Status | Meaning | Exit code |
|
|
97
|
+
|--------|---------|-----------|
|
|
98
|
+
| `resolved` | Patch is valid and verified by repro and full-suite test runs after the last edit | `0` |
|
|
99
|
+
| `unverified` | Patch is valid and the agent says it is done, but test evidence is missing. Usually correct, but review the patch | `2` |
|
|
100
|
+
| `unresolved` | No valid patch, the agent gave up, or a budget ran out | `2` |
|
|
101
|
+
|
|
102
|
+
Everything a run produces goes under `~/.sisyphus/` (`data/` in a checkout):
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
data/
|
|
106
|
+
├── repos/ # cloned repositories
|
|
107
|
+
├── patches/ # <run-id>.diff, the final patch
|
|
108
|
+
├── trajectories/ # <run-id>.json, every step, tool call, test run and cost (<run-id>.events.jsonl while running)
|
|
109
|
+
└── benchmark_results/ # SWE-bench runs
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Using Gemini
|
|
113
|
+
|
|
114
|
+
Gemini works as a drop-in alternative to Claude, including on Google's free tier:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pip install "sisyphus-agent[gemini]" # in a checkout: pip install -e ".[gemini]"
|
|
118
|
+
export GEMINI_API_KEY=... # from Google AI Studio
|
|
119
|
+
sisyphus solve https://github.com/owner/repo/issues/123 --provider gemini
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The default model is `gemini-3.8-flash`. Two things to know about the free tier: Google may use what you send (here, the repository's code) to improve its products, so use it for public code; and its per-minute limits are low, so the client waits and retries when it hits them. Cost is shown as $0 because free-tier prices are used; set the `price_*` fields if you are on the paid tier. The prompts were written for Claude, so results with Gemini can differ.
|
|
123
|
+
|
|
124
|
+
### Using a local model
|
|
125
|
+
|
|
126
|
+
The `local` provider runs the agent on a model served from your own machine, with no API key, no per-token cost, and no code leaving the machine. It works with any server that offers an OpenAI-compatible API: Ollama, LM Studio, the llama.cpp server or vLLM. Docker is still needed, as with every provider, because the repository's code runs in the sandbox.
|
|
127
|
+
|
|
128
|
+
#### Which hardware you need
|
|
129
|
+
|
|
130
|
+
The agent takes many tool-calling steps per issue, so the model has to be fairly capable:
|
|
131
|
+
|
|
132
|
+
| Model size | Example | Memory needed | What to expect |
|
|
133
|
+
|------------|---------|---------------|----------------|
|
|
134
|
+
| ~3B | `qwen2.5-coder:3b` | ~4 GB RAM | Checks that the setup works; rarely solves real issues |
|
|
135
|
+
| 7–14B | `qwen2.5-coder:14b` | 8–16 GB RAM or GPU memory | Sometimes works on simple issues; often loses track |
|
|
136
|
+
| ~30B+ | `qwen2.5-coder:32b` | 24 GB+ GPU memory | Recommended for real use |
|
|
137
|
+
|
|
138
|
+
Models run without a GPU too, but much more slowly. If your machine is too small for a 30B model, run the model on another machine (see below) or use Gemini's free tier instead.
|
|
139
|
+
|
|
140
|
+
#### Setup with Ollama
|
|
141
|
+
|
|
142
|
+
1. Install [Docker](https://docs.docker.com/engine/install/) and [Ollama](https://ollama.com/download).
|
|
143
|
+
2. Download a model:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
ollama pull qwen2.5-coder:32b
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
3. Start Ollama with a larger context window and leave it running. Ollama's default window is too small for the agent's history:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
OLLAMA_CONTEXT_LENGTH=32768 ollama serve
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
If Ollama already runs as a system service, stop it first (`sudo systemctl stop ollama`), or set the variable in the service (`sudo systemctl edit ollama`, then add `Environment="OLLAMA_CONTEXT_LENGTH=32768"`).
|
|
156
|
+
|
|
157
|
+
4. In another terminal, install the project and run it:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
python -m venv .venv && source .venv/bin/activate
|
|
161
|
+
pip install sisyphus-agent
|
|
162
|
+
sisyphus solve https://github.com/owner/repo/issues/123 --provider local --model qwen2.5-coder:32b
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
To skip the flags every time, put `LLM_PROVIDER=local` and `LLM_MODEL=qwen2.5-coder:32b` in `.env` (`~/.sisyphus/.env` for a pip install).
|
|
166
|
+
|
|
167
|
+
#### Tuning a model for the agent
|
|
168
|
+
|
|
169
|
+
Most failures with local models come from the model's settings, not its size. Bake these into a model of your own with an Ollama Modelfile:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
cat > Modelfile <<'MF'
|
|
173
|
+
FROM qwen2.5-coder:14b
|
|
174
|
+
PARAMETER num_ctx 32768
|
|
175
|
+
PARAMETER temperature 0.6
|
|
176
|
+
PARAMETER presence_penalty 0
|
|
177
|
+
MF
|
|
178
|
+
ollama create coder-agent -f Modelfile
|
|
179
|
+
sisyphus --provider local --model coder-agent --max-steps 20
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- **`presence_penalty 0`.** Some models ship with a presence penalty (Qwen 3.5 uses 1.5) that discourages repeating words. Code must repeat names and copy lines exactly, so with it the edits come out garbled and `str_replace` keeps reporting `old_str not found`.
|
|
183
|
+
- **Context.** The history is never trimmed, and a run needs about 7k tokens plus 1k per step. With 32k, keep `--max-steps` near 20; past that Ollama silently drops the start of the conversation, including the issue.
|
|
184
|
+
- **Keep it on the GPU.** `ollama ps` shows the CPU/GPU split; any CPU share makes replies several times slower. Start the server with `OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0` to halve the context's memory. If Ollama still leaves layers on the CPU while GPU memory is free, add `PARAMETER num_gpu 99` to load them all (on an 8 GB card this took a 9.7B model from 24 to 69 tokens/s).
|
|
185
|
+
|
|
186
|
+
#### Running the model on another machine
|
|
187
|
+
|
|
188
|
+
If a stronger machine (a desktop with a GPU, or a cloud server) is available, run the model there and the agent on your own computer:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# on the GPU machine
|
|
192
|
+
ollama pull qwen2.5-coder:32b
|
|
193
|
+
OLLAMA_HOST=0.0.0.0 OLLAMA_CONTEXT_LENGTH=32768 ollama serve
|
|
194
|
+
|
|
195
|
+
# on your computer
|
|
196
|
+
export LOCAL_BASE_URL=http://<gpu-machine-ip>:11434/v1
|
|
197
|
+
sisyphus solve https://github.com/owner/repo/issues/123 --provider local --model qwen2.5-coder:32b
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Ollama has no authentication, so keep it reachable only from your own network or over a VPN, never from the open internet.
|
|
201
|
+
|
|
202
|
+
#### Other servers
|
|
203
|
+
|
|
204
|
+
Point `LOCAL_BASE_URL` at the server: LM Studio `http://localhost:1234/v1`, llama.cpp `http://localhost:8080/v1`, vLLM `http://localhost:8000/v1` (default: Ollama's `http://localhost:11434/v1`). Set `LOCAL_API_KEY` if the server was started with a key, and give the model a context window of 32k tokens or more.
|
|
205
|
+
|
|
206
|
+
#### What to expect
|
|
207
|
+
|
|
208
|
+
- **Tool calling is required.** If the model does not support it, the server says so and the run stops with that error.
|
|
209
|
+
- **Speed.** Replies can be slow; one reply may take up to `local_timeout` (600 s) before the run stops.
|
|
210
|
+
- **Cost.** Shown as $0, so `--max-cost` has no effect; `--max-steps` and `--timeout` still apply.
|
|
211
|
+
- **Results.** The prompts were written for Claude, so local models solve fewer issues.
|
|
212
|
+
|
|
213
|
+
## Configuration
|
|
214
|
+
|
|
215
|
+
Defaults live in [`agent/config.py`](agent/config.py). The main settings:
|
|
216
|
+
|
|
217
|
+
| Setting | Default | Notes |
|
|
218
|
+
|---------|---------|-------|
|
|
219
|
+
| `provider` | `anthropic` | `anthropic`, `gemini` or `local`; also `--provider` or `LLM_PROVIDER` |
|
|
220
|
+
| `model` | provider default | `claude-sonnet-5-5` or `gemini-3.8-flash`; required for `local`. Also `--model` or `LLM_MODEL`. Set the four `price_*` fields if you change it |
|
|
221
|
+
| `local_base_url` | `http://localhost:11434/v1` | OpenAI-compatible server for `local`; also `LOCAL_BASE_URL` |
|
|
222
|
+
| `max_output_tokens` | `16000` | Per LLM call |
|
|
223
|
+
| `stuck_threshold` | `3` | Nudge after N identical failures, stop after 2N |
|
|
224
|
+
| `tool_output_limit` | `8000` | Characters returned from any tool call |
|
|
225
|
+
| `sandbox_cpus` / `sandbox_memory` / `sandbox_pids` | `2.0` / `4g` / `512` | Container limits |
|
|
226
|
+
| `sandbox_network` | `none` | No network inside the sandbox (dependencies install at image build time) |
|
|
227
|
+
| `command_timeout` | `300` | Seconds per command; full test runs get 3× |
|
|
228
|
+
|
|
229
|
+
## Safety model
|
|
230
|
+
|
|
231
|
+
- **Secrets stay on the host.** API keys are never passed into the container, and the GitHub token is removed from the clone's `.git/config` and redacted from error messages.
|
|
232
|
+
- **`.git` is off limits.** File tools reject any path that resolves into `.git` or outside the repo, including through symlinks. Host git calls run with hooks and fsmonitor disabled.
|
|
233
|
+
- **Disposable shell.** `run_shell` runs bash inside the container, which is the security boundary: no network, no capabilities, its own copy of the repo. Its changes are discarded before each test run and never reach the patch.
|
|
234
|
+
- **Edits are checked.** `str_replace` must match exactly one place, Python edits that would not compile are rejected, and CRLF line endings are kept.
|
|
235
|
+
- **Patch validation at the end.** The patch is checked again whatever the tools allowed, so a bad patch is caught even if a guard was bypassed.
|
|
236
|
+
|
|
237
|
+
## Evaluation (SWE-bench)
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
pip install -e ".[bench]"
|
|
241
|
+
|
|
242
|
+
# run the agent on 25 SWE-bench Lite instances (resumable)
|
|
243
|
+
python -m evaluation.benchmark_runner --dataset swebench-lite --limit 25 --run-name my-run
|
|
244
|
+
|
|
245
|
+
# score predictions with the official harness (printed by the runner), then summarize
|
|
246
|
+
python -m evaluation.metrics data/benchmark_results/my-run --report <harness-report.json>
|
|
247
|
+
|
|
248
|
+
# group failed runs by cause: stuck_loop, out_of_budget, never_reproduced, regression, ...
|
|
249
|
+
python -m evaluation.trajectory_analyzer data/trajectories --prefix my-run
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
The agent sees only the problem statement, never the hidden tests. `--dataset swebench-verified` is also supported. Older SWE-bench repos often need specific Python versions that the generic image builder may not handle; for serious runs use SWE-bench's prebuilt per-instance images.
|
|
253
|
+
|
|
254
|
+
## Development
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
pip install -e ".[dev]"
|
|
258
|
+
pytest
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The tests cover the agent loop, stopping rules, the pytest output parser, the file editor, sandbox sync and the security guards, and run without Docker or an API key.
|
|
262
|
+
|
|
263
|
+
### CI and releases
|
|
264
|
+
|
|
265
|
+
- **CI** ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)) runs the tests on Python 3.11 to 3.14 for every pull request and every push to `main`.
|
|
266
|
+
- **Releases** ([`.github/workflows/release.yml`](.github/workflows/release.yml)): to publish a version, set `version` in `pyproject.toml`, commit it, then push a matching tag. The workflow runs the tests, builds the package, publishes it to [PyPI](https://pypi.org/project/sisyphus-agent/) and creates a GitHub Release with the wheel and source archive attached:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
git tag v0.2.0
|
|
270
|
+
git push origin v0.2.0
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
PyPI accepts the upload through [trusted publishing](https://docs.pypi.org/trusted-publishers/), so no token is stored in the repository. Set it up once before the first release: on PyPI, under *Your projects → Publishing → Add a new pending publisher*, enter project `sisyphus-agent`, owner `udvranto-studio`, repository `sisyphus` and workflow `release.yml`. A version can be uploaded to PyPI only once, so bump `version` for every release.
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
agent/
|
|
277
|
+
├── main.py # CLI and run_task()
|
|
278
|
+
├── config.py # settings, budgets, pricing
|
|
279
|
+
├── core/ # agent loop, state, stopping criteria, nudges
|
|
280
|
+
├── llm/ # Anthropic, Gemini and local-model clients, prompts
|
|
281
|
+
├── tools/ # tool schemas and handlers
|
|
282
|
+
├── analysis/ # context building, test output parsing, patch validation
|
|
283
|
+
├── sandbox/ # base image Dockerfile, image builder, container manager, resource limits
|
|
284
|
+
├── github/ # issue fetcher, repo cloner, PR creator
|
|
285
|
+
└── utils/ # cost tracker, trajectory logger, hardened git
|
|
286
|
+
evaluation/ # SWE-bench runner, metrics, trajectory analysis
|
|
287
|
+
docs/architecture/ # design tokens and the diagram builder
|
|
288
|
+
assets/banners/readme/ # README banner builder
|
|
289
|
+
tests/
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
The diagram and the banner are generated from one set of design tokens, [`docs/architecture/tokens.json`](docs/architecture/tokens.json), in three layers: primitive → semantic (light/dark) → component. After editing the tokens, rebuild both:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
python docs/architecture/build_diagram.py
|
|
296
|
+
python assets/banners/readme/build_banner.py
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Limitations
|
|
300
|
+
|
|
301
|
+
- Only Python repositories with pytest are supported.
|
|
302
|
+
- `--open-pr` pushes to the issue's repository, so it needs push access there (no fork workflow yet).
|
|
303
|
+
- Repos whose dependencies fail to install in the generic image may not run correctly.
|
|
304
|
+
|
|
305
|
+
## License
|
|
306
|
+
|
|
307
|
+
[MIT](LICENSE)
|