# Kimi Agent

`KimiAgent` is a computer use agent powered by the Kimi models developed by Moonshot AI. It observes the desktop through screenshots and emits `pyautogui` code for the OSWorld GUI executor to run.

This page documents how we evaluate Kimi K2.5 and K2.6 on OSWorld.

---

## Files

- `kimi_agent.py` — our agent implementation for OSWorld.

The launcher scripts live under `scripts/python/`:

- `scripts/python/run_multienv_kimi_k25.py`

The K2.5 launcher is reused for K2.6.

---

## K2.5 vs. K2.6 — what we change

The only meaningful difference between the two evaluation runs is the size of
the visual history fed back to the model, plus the constraints imposed by the
serving platform.

### 1. `max_image_history_length`

- **Kimi K2.5**: `3`
- **Kimi K2.6**: `8`–`10`

K2.6 handles longer multi-image context more reliably, so we widen the visual
history window to give it more grounding from previous steps. K2.5 stays at the
default of `3`.

### 2. `temperature`

- **Moonshot AI hosted API for K2.6**: only `temperature=1` is accepted. If you
hit the official endpoint you cannot lower it.
- **Self-hosted**: we use `0` so reruns are comparable.

If you are reproducing on the Moonshot hosted endpoint, expect some run-to-run
variance because temperature is locked to `1`.

### 3. Thinking mode

We always run with `--thinking` enabled for both K2.5 and K2.6. The system
prompt and history templates are switched accordingly inside `KimiAgent`
(`SYSTEM_PROMPT_THINKING` and `THOUGHT_HISTORY_TEMPLATE_THINKING`).

### 4. Everything else

`max_tokens`, `top_p`, `coordinate_type`, `action_space`, `observation_type`,
screen size, etc. all stay at the agent defaults listed above.

---

## Reproducing our evaluation runs

The launcher reads the API key from the `KIMI_API_KEY` environment variable.
The endpoint is hard-coded inside `KimiAgent.call_llm`

### Kimi K2.6

```bash
export KIMI_API_KEY=your_kimi_api_key_here

PYTHONPATH=. python scripts/python/run_multienv_kimi_k25.py \
    --headless \
    --observation_type screenshot \
    --model kimi-k2.6 \
    --result_dir ./results \
    --test_all_meta_path evaluation_examples/test_nogdrive.json \
    --max_steps 100 \
    --num_envs 30 \
    --max_image_history_length 8 \
    --temperature 0 \
    --thinking
```

### Kimi K2.5

```bash
export KIMI_API_KEY=your_kimi_api_key_here

PYTHONPATH=. python scripts/python/run_multienv_kimi_k25.py \
    --headless \
    --observation_type screenshot \
    --model kimi-k2.5 \
    --result_dir ./results \
    --test_all_meta_path evaluation_examples/test_nogdrive.json \
    --max_steps 100 \
    --num_envs 32 \
    --max_image_history_length 3 \
    --temperature 0 \
    --thinking
```

`--max_image_history_length` can be raised to `10` for K2.6 if you want a longer visual history; `8` is the lower end of the range we tested.

---

## Released trajectories

All of our K2.5 and K2.6 evaluation runs have been submitted to the OSWorld verified trajectories dataset on Hugging Face:

<https://huggingface.co/datasets/xlangai/ubuntu_osworld_verified_trajs>