> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenfactory.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mini-SWE-Agent Integration

[Mini-SWE-Agent](https://mini-swe-agent.com/latest/) 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](https://mini-swe-agent.com/latest/reference/environments/contree/) starting from [mini-swe-agent v2.2.0](https://github.com/SWE-agent/mini-swe-agent/releases/tag/v2.2.0).

## Using ContreeEnvironment

```python theme={null}
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:

   ```bash theme={null}
   pip install "mini-swe-agent[contree]"
   ```
2. Set up Nebius IAM token and base URL:

   ```bash theme={null}
   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:

```bash theme={null}
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
