# kosa8 job submit

Submit a job: run every task's solver and grade it sealed, server-side

## Usage

```
kosa8 job submit {TASKS.jsonl --solver CMD --grader CMD | --benchmark NAME --instances IDS|all|N (--solver CMD | --patches FILE | --oracle)} [flags]
```

TASKS.jsonl has one task a line: {"id": "t1", "input": {…}, "files": {"/path": "<base64>"}}
(- reads stdin). Each task runs in a sandbox of its own: its files are written
there, its input is in $KOSA8_TASK_INPUT and in the file $KOSA8_TASK_INPUT_FILE, and
the --solver command runs (in sh -c, up to --solver-timeout). Then the --grader command
runs in a sealed copy with the --grader-file files, which the solver never sees; its
last stdout line {"reward": 0.75} is the reward (else exit 0 is 1.0, other 0.0).

--benchmark runs a ready-made benchmark instead (kosa8 bench ls): no TASKS file, no
--grader. Each instance runs in its official environment, built by kosa8 on first
use, and is graded by the benchmark's own grader in a sealed copy. The solver is
your --solver command (its input in $KOSA8_TASK_INPUT_FILE, the problem in
/workspace/.kosa8-task/problem.md or instruction.md, the code in $KOSA8_TASK_WORKDIR),
--patches FILE (SWE-bench predictions: JSONL or JSON of {instance_id, model_patch}),
or --oracle (the reference solutions: a check of the environments).

--estimate prints the sandbox-hours and list cost instead of submitting.
Prints the job's ID; --watch follows it until it ends.

## Flags

| Flag | Type | What it does | Default |
|---|---|---|---|
| `--benchmark` | string | run a ready-made benchmark (kosa8 bench ls), e.g. swe-bench-verified or terminal-bench-2.1 |  |
| `--budget` | float64 | stop starting tasks once the job has cost this many US dollars (list rates) | `0` |
| `--concurrency` | int | tasks running at once (default: the API's; at most the plan's running limit) | `0` |
| `--estimate` | bool | print the sandbox-hours and list cost; submit nothing |  |
| `--grader` | string | the command that scores a solved sandbox, run sealed (no network) with sh -c |  |
| `--grader-file` | stringArray | a hidden file for the grader, LOCAL:/PATH (repeatable, 1 MiB in all) | `[]` |
| `--grader-timeout` | duration | stop the grader after this long (1s to 90s) | `1m0s` |
| `--image` | string | make each task's sandbox from this image |  |
| `--instances` | string | with --benchmark: instance ids (comma-separated), all, or N for a seeded sample of N |  |
| `--lease` | duration | each sandbox's lease, which the job renews while it runs (2m to 24h; default: the API's) | `0s` |
| `--name` | string | the job's name (default: the tasks file's name) |  |
| `--oracle` | bool | with --benchmark: run the reference solutions (a check of the environments) |  |
| `--patches` | string | with --benchmark (SWE-bench): grade these predictions, JSONL or JSON of {instance_id, model_patch} |  |
| `--project` | string | group the job and its RL run under this project |  |
| `--retries` | int | retry a task this many times after an infra failure, then mask it (0 to 5) | `2` |
| `--seed` | int | with --benchmark --instances N: the sample's seed | `0` |
| `--size` | string | each sandbox's size, vCPU x GiB (e.g. 0.5x1, 2x4) |  |
| `--snapshot` | string | make each task's sandbox from this snapshot (snap_…) |  |
| `--solver` | string | the command that solves a task, run with sh -c in its sandbox |  |
| `--solver-env` | stringArray | set a variable for the solver, NAME=value or NAME for this shell's value (repeatable) | `[]` |
| `--solver-file` | stringArray | with --benchmark: a file for every task's sandbox, LOCAL:/PATH (repeatable, 256 KiB in all) | `[]` |
| `--solver-timeout` | duration | stop a task's solver after this long (1s to 24h) | `10m0s` |
| `--template` | string | make each task's sandbox from this template (e.g. python) |  |
| `--watch` | bool | follow the job until it ends, as kosa8 job watch does |  |

## Example

```
  kosa8 job submit tasks.jsonl --template python --solver "python /work/solve.py" \
      --grader "pytest -q /hidden/test.py" --grader-file tests/test.py:/hidden/test.py --concurrency 64 --budget 20
  kosa8 job submit tasks.jsonl --template python --solver ./solve.sh --grader ./grade.sh --estimate
  kosa8 job submit --benchmark swe-bench-verified --instances 50 --solver "python /workspace/agent.py" --solver-file agent.py:/workspace/agent.py
  kosa8 job submit --benchmark swe-bench-verified --patches preds.jsonl --watch
  kosa8 job submit --benchmark terminal-bench-2.1 --instances all --oracle --estimate
```

---
Source: https://docs.kosa8.com/reference/job-submit/
