Skip to main content
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

from minisweagent.agents.default import DefaultAgent
from minisweagent.environments.extra.contree import ContreeEnvironment
from minisweagent.models import get_model

from contree_sdk.auth import IAMAuth
from contree_sdk.config import ContreeConfig


def main():
    contree_env = ContreeEnvironment(
        contree_config=ContreeConfig(
            auth=IAMAuth(base_url="https://contree.dev/"),
        ),
        image="python:3.13-slim",
        cwd="/workspace",
    )

    agent = DefaultAgent(
        get_model(input_model_name="gemini/gemini-flash-latest"), contree_env, system_template="", instance_template=""
    )
    agent.run("Develop small calculator script and check it")

    result = contree_env.session.run(shell="ls /workspace -lah").wait()
    print(result.stdout)


if __name__ == "__main__":
    main()

Running with SWE-bench

Setup

  1. Install the dependencies:
    pip install "mini-swe-agent[contree]"
    
  2. Set up Nebius IAM token and base URL:
    export NEBIUS_API_KEY="your-nebius-iam-token"
    export NEBIUS_PROJECT_ID="your-project-id"
    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