Mini-SWE-Agent Integration

Mini-SWE-Agent is a lightweight software engineering agent. The ConTree integration enables it to execute code in isolated, reproducible containers. Every command in Mini-SWE-Agent is executed in a fresh shell session, which makes it perfectly suitable for ConTree.

Integration is available via ContreeEnvironment starting from mini-swe-agent v2.2.0.

Using ContreeEnvironment

 1from minisweagent.agents.default import DefaultAgent
 2from minisweagent.environments.extra.contree import ContreeEnvironment
 3from minisweagent.models import get_model
 4
 5from contree_sdk.config import ContreeConfig
 6
 7
 8def main():
 9    contree_env = ContreeEnvironment(
10        contree_config=ContreeConfig(
11            base_url="https://contree.dev/",
12        ),
13        image="python:3.13-slim",
14        cwd="/workspace",
15    )
16
17    agent = DefaultAgent(
18        get_model(input_model_name="gemini/gemini-flash-latest"), contree_env, system_template="", instance_template=""
19    )
20    agent.run("Develop small calculator script and check it")
21
22    result = contree_env.session.run(shell="ls /workspace -lah").wait()
23    print(result.stdout)
24
25
26if __name__ == "__main__":
27    main()

Running with SWE-bench

Setup

  1. Install the dependencies:

    pip install "mini-swe-agent[contree]"
    
  2. Set up ConTree token and base_url:

    export CONTREE_TOKEN="your-contree-token"
    export CONTREE_BASE_URL="your-given-base-url-for-contree"
    

Usage

Run mini-swe-agent like with any other environment:

mini-extra swebench \
    --subset verified \
    --split test \
    --workers 100
    --environment-class contree

It can be specified both through cli parameter or by setting environment_class to contree in your swebench.yaml config