---
title: "Run tasks"
description: "Submit two-file tasks, inspect artifacts, and handle execution timeouts and cancellation."
last_update:
  date: 2026-11-20
---

<span id="run-tasks" className="legacy-anchor" />

Submit Task definitions as Jobs using local two-file directories or SDK file-content mappings. The SDK reads files and sends their contents; the remote machine does not need access to the client directory. Named Runner / Dataset submissions use the APIServer catalog; the platform downloads the problem when executing it.

## Choose the simplest input

Use a [Dataset task](datasets.md) when the problem is already in the platform catalog. For your own small executable, prepare a directory containing exactly `runner.toml` and its declared `main.py` or `main.sh` entrypoint. Both files must be regular UTF-8 files; the current two-file client does not upload an arbitrary project tree. Legacy `task.toml` is supported, but cannot coexist with `runner.toml` in the same submission.

Before running, authenticate against the intended project and confirm you have Job submission permission. The platform manages execution and resource placement. Put reusable non-secret settings in a [Profile](profiles.md), and declare any outputs you want to collect in the [Task format](../reference/task-format.md).

A minimal `runner.toml` is:

```toml
schema_version = "envloop.runner/v1"

[runner]
name = "examples/hello"

[execution]
entrypoint = "main.py"
timeout_sec = 30
```

Save the following as `main.py` in the same directory:

```python
print("Hello from my task")
```

Submit the files, then open the Trial’s stdout log to read `Hello from my task`. For a scored evaluation, choose a Dataset/Runner with a verifier; see [Evaluation](evaluation.md).

## Submit and inspect

First prepare `./my-task` and the connection configuration from [Quickstart](quickstart.md):

```bash
el job submit --source ./my-task --wait
el trial get TRIAL_ID
el trial snapshot TRIAL_ID
el trial result TRIAL_ID
el trial stop TRIAL_ID
```

The response is a Job receipt containing `job_id` and members. Replace `TRIAL_ID` with `members[0].attempts[0].trial_id`. All new Trials belong to this Job; `el trial list` also lists Trials independently. HTTP submission returns immediately by default; `--wait` explicitly waits. `result` itself does not wait. Use `el job log JOB_ID` to read captured output and `el trial stop TRIAL_ID` to stop a Trial.

## Harbor Runner

After registering the Runner and Dataset in your APIServer catalog and configuring the connection, run the fix-git task:

```bash
el job submit \
  --dataset envloop/terminal-bench-2-1-lite@1.0.1 \
  --task-id terminal-bench/fix-git \
  --priority 10 \
  --wait
```

The example pins Dataset version `1.0.1`, which pins its Runner Revision; ordinary submission needs no `--runner`. Check `el dataset list --name envloop/terminal-bench-2-1-lite` for an available version, and replace the selector if your project uses another Dataset.

No `--command` is needed: `runner.toml` declares `main.sh`, so the platform runs `bash main.sh`. A Python Runner declaring `main.py` similarly uses `python main.py`. Use `--command` only to customize startup. The platform selects the execution backend; the client submits no executor or provider choice. See [Jobs](jobs.md) for Runner discovery and explicit Revision overrides.

## Inline files with Python

```python
from envloop import Client

files = {
    "runner.toml": '''schema_version = "envloop.runner/v1"
[runner]
name = "examples/inline"
[execution]
entrypoint = "main.py"
timeout_sec = 10
''',
    "main.py": 'print("inline hello")\n',
}
with Client.remote() as client:
    job = client.jobs.submit(source=files, request_id="inline-hello-001")
    final_job = client.jobs.wait(job["job_id"], timeout=60)
    trials = client.trials.list(job_id=job["job_id"])["items"]
    if not trials:
        raise RuntimeError("No Trial was dispatched; inspect the Job")
    trial = trials[0]
    final = client.trials.wait(trial["trial_id"], timeout=60)
    print(final["status"])
    result = client.trials.result(trial["trial_id"])
    print({"status": result["status"], "reward": result.get("reward"),
           "outputs": result["outputs"]})
```

The first run should return `succeeded`. Open the Trial's **Logs → stdout** in the Console to read `inline hello` and a newline. The public result response does not embed stdout/stderr; logs use the Trial logs endpoint. Reusing the same request_id reuses the original Job and its Trials; use a new value to rerun intentionally.

## Results and artifacts

The public result dictionary includes execution `status`, `reward`, `outputs` and available collection/cleanup details. stdout/stderr are read through the Trial logs interface, separately from this result. Each output has its `name`, available preview `content`, byte `size` and `sha256`. Only artifacts declared by the task are returned as outputs; see [Task format](../reference/task-format.md). SHA-256 covers raw bytes; `content` is decoded text and should not be re-encoded to verify arbitrary binary files.

The platform manages execution logs and artifacts; the API client needs no execution directory setting. Task paths only supply submission files; explicit exports or downloads may choose a local destination.

## Timeout and cancellation

`trials.wait(timeout=...)` limits how long the client waits; a `TimeoutError` leaves the task running. Set `timeout_sec` under `[execution]` in `runner.toml`, or `execution.timeout_seconds` at submission, to bound execution itself. To stop work, call `trials.stop(TRIAL_ID)` or `el job stop JOB_ID`, then inspect the returned state and cleanup status. If the platform returns `CANCELLATION_UNSUPPORTED`, contact support for that execution type.

See [Troubleshooting](troubleshooting.md) for error handling.
