---
sidebar_label: "Task format"
title: "Task format reference"
description: "Two-file Runner format, execution commands, Profile input, and returned artifacts."
last_update:
  date: 2026-11-19
---

<span id="task-format-reference" className="legacy-anchor" />

The current user-side Task directory must contain exactly **UTF-8 `runner.toml` and its declared `main.py` or `main.sh`**. Entrypoints cannot be symlinks; extra input files and paths outside the directory are rejected. Artifact declarations do not upload input files.

A Runner is an execution package; a Task in a Dataset is an evaluation problem. Directories read `runner.toml` by default; legacy `task.toml` / `envhub.task/v1` two-file execution packages remain supported, but including both configurations is rejected. Native Harbor `task.toml` in Datasets keeps its original format.

## Minimal Python task

`runner.toml`：

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

[runner]
name = "examples/hello"

[execution]
entrypoint = "main.py"
timeout_sec = 10
outputs = ["result.txt"]
```

`main.py`：

```python
from pathlib import Path

Path("result.txt").write_text("hello\n", encoding="utf-8")
print("hello")
```

| Field | Example | Meaning |
|---|---|---|
| `schema_version` | `envhub.runner/v1` | Runner schema |
| `runner.name` | `examples/hello` | Logical Runner name; Git revision is frozen by the platform, never declared in this file |
| `execution.entrypoint` | `main.py` / `main.sh` | Matching entrypoint in the directory |
| `execution.command` | `bash main.sh` | Optional shell script; defaults to `bash main.sh` or `python main.py` according to the entrypoint |
| `execution.timeout_sec` | `10` | Execution deadline in seconds; differs from SDK wait timeout |
| `execution.outputs` | `["result.txt"]` | Relative artifact paths collected after execution |

This page shows the current minimal runnable format; the platform validates specific fields. CLI `--timeout-seconds` / SDK `execution={"timeout_seconds": ...}` can be passed as execution overrides.

## Shell task

Change entrypoint to `main.sh` and remove main.py from the directory:

```bash
#!/usr/bin/env bash
set -eu
printf 'hello\n' > result.txt
printf 'hello\n'
```

Choose a Runner execution environment with Python or Bash available; the platform starts it when the Job runs.

## Command override

For normal submissions, omit `command` / `--command`. The platform derives the command from `runner.toml`: `main.sh` runs as `bash main.sh`, and `main.py` as `python main.py`. A declared `execution.command` takes precedence over this inference; an explicit submission command overrides it. The client does not insert a default string, so each Runner can use its own entrypoint.

```bash
el job submit --source ./my-task --wait
```

For a Dataset Task without a compose Runner, the Runner command also receives the environment variables of the Task image (its Dockerfile `ENV`, for example `DISPLAY`, `LANG`, `PATH` or `CU_AUTOLAUNCH`), read from the image configuration pinned by digest. Variables set by the Runner, Profile or Job and the platform's `ENVLOOP_*` variables take precedence. Each entry is split at its first `=`, so values may contain `=`; as in Docker, a name is any nonempty text without `=`. An image whose environment is not a list of such `NAME=VALUE` entries, contains NUL, or exceeds 256 entries or 32 KiB fails preparation with `IMAGE_METADATA_UNAVAILABLE`; values are never shown. These image values are stored with the prepared sandbox template, as they are in the image itself, so do not put secrets in Dockerfile `ENV`. The sandbox starts commands in a login shell; the platform reapplies these variables after the login profile, so a `PATH` or other value reset by `/etc/profile` does not replace them. The command runs as `root` in `/work/runner` with the image working directory in `ENVLOOP_IMAGE_WORKDIR`; the image `ENTRYPOINT` and `CMD` are not run. Sandbox templates prepared before this behavior keep their earlier environment for Jobs already pinned to them; new Jobs prepare a new template once per image.

Task / Job submission `command` (CLI `--command`) overrides the Runner's default script and runs via `bash -c` in the Runner working directory. Text preserves multiple lines, quotes, and shell variables; it must be a nonempty UTF-8 string without NUL and at most 65536 bytes. Whitespace-only scripts are also rejected.

```bash
el job submit --source ./my-task --command 'printf "custom startup\n"; python main.py' --wait
```

In Python, use `client.jobs.submit(source=files, command="printf custom; python main.py")` or `client.jobs.submit(dataset, command="printf custom; bash main.sh")`. Job overrides apply to all members. The API supports the compatibility spelling `Command`; including both spellings in one request is rejected. Freezing and idempotency use normalized `command`; changing the script on retry returns a conflict.

## Image defaults

When the execution environment supports image defaults, a single-image Runner inherits
its Dockerfile `ENV` values, including display, locale and timezone settings. Resolved
Runner, Profile and Job variables override image defaults. The platform excludes reserved
variables from import and keeps host environment variables and platform credentials outside the Runner.

ENV entries split at the first `=`; empty values, additional `=` characters and valid Unicode
values are preserved. The last entry wins for duplicate names. Missing or null `Env` means
no defaults. Names follow Docker rules: they must be nonempty and contain neither `=` nor NUL.
Invalid types, NUL, invalid UTF-8, more than 256 entries or more than 32 KiB
of UTF-8 entries (including one terminator byte each) are rejected.

The Runner command starts in `/work/runner`; `ENVLOOP_IMAGE_WORKDIR` identifies the original
image `WORKDIR`. The managed process runs as root regardless of Dockerfile `USER`.
The platform starts the frozen Runner command; Dockerfile `ENTRYPOINT` and `CMD` are not
startup commands for this process. Images that need a desktop or another service must start
it from the Runner command or its script. Existing Jobs keep their frozen environment.

## Profile input

Legacy tasks read frozen Profile JSON from `ENVLOOP_TASK_PROFILE`, default `{}`. A schema-enabled Runner receives its declared parameters as uppercase environment names; for example, `seed` becomes `SEED`. Keep parameter names and types consistent with the Runner. For model credentials, use the [Profile Secret setting](../guides/profiles.md); it masks display, while authorized reads/exports and execution retain the original value.

## Returned result

`client.trials.result(trial_id)` reads the public Trial result: `trial_id`, `task_id`, execution `status`, `reward`, structured result or its parse error, cleanup information, output metadata and collection/pagination information. The public result route does not include `stdout` or `stderr`. Read the Trial detail's **Logs** tab for execution logs; do not rely on an internal or legacy result shape.

Retrieve original artifact bytes through the artifact API or verified download command:

```bash
el trial result TRIAL_ID
el trial artifact list --trial-id TRIAL_ID --limit 25 --json
el trial artifact download --ref ASSET_ID --output ./artifacts
```

Use the actual Trial ID from the Job’s members and the `asset_id` from the artifact list. Follow its cursor for more results. The download verifies byte size and SHA-256. Use the download command for binary files; text previews are for reading. An output declaration says what should be collected; the final collection status and artifact list show what was uploaded.

For this example, look for `hello` in stdout and download `result.txt`. Add a verifier when you need an evaluation reward; see [Evaluation](../guides/evaluation.md).

## Runner parameters and execution limits

Declare `[params]` in `runner.toml` to accept runtime parameters. Declarations define required/default/description; Profiles and `--params` supply values. Publish a new immutable Revision after changing declarations. See [runtime parameters](../guides/runtime-params.md) for field paths and recovery steps.

A Runner default timeout does not guarantee support in every execution environment. See [Job diagnostics](../guides/jobs.md#diagnose-submission-refusals) for timeout, deletion delay and output diagnostics; Compose and trusted Agents have separate policies. Task / Runner images trust Docker Hub and `ghcr.io/envloop/*` by default. Ask the platform administrator to approve other sources first; credentials do not expand trust. See [Settings](../manage/settings.md).
