# SIA (Self-Improving AI)

> A self-improvement loop where LLM agents rewrite a task agent, generation after generation, against your evaluator

- Category: AI Coding / Autonomous Coding Agents
- Language: Python
- Licence: MIT
- Repository: https://github.com/hexo-ai/sia
- Website: https://hexolabs.com/
- Canonical page: https://ai-tldr.dev/tools/sia/

## In short

SIA (Self-Improving AI) is an open-source Python framework from Hexo Labs that tries to make any AI system — a model or an agent — better at one benchmark task without a human in the loop. It sits in the Autonomous Coding Agents category of the AI Coding tools and is open-source, written in Python and licensed MIT.

## Overview

SIA (Self-Improving AI) is an open-source Python framework from Hexo Labs that tries to make any AI system — a model or an agent — better at one benchmark task without a human in the loop. It is the official implementation of the paper "SIA: Self Improving AI with Harness & Weight Updates" (Hebbar et al., 2026), and it ships as the `sia-agent` package with a `sia` command-line tool.

A run coordinates three agents. A Meta-Agent reads the task description and writes an initial Target Agent (`target_agent.py`) tailored to the task. The Target Agent attempts the task and logs what it did. A Feedback / Improvement Agent then reads those execution logs and the evaluation score, writes an `improvement.md` explaining what to change, and rewrites the Target Agent for the next generation. The loop repeats for as many generations as you ask for, and every generation's code, logs and rationale are kept on disk under `runs/`.

The signal the loop optimises is a task evaluator: after each generation SIA runs the task's `evaluate.py`, which scores the output against held-out data the agents never see, and feeds the metrics into the next feedback prompt. SIA bundles four tasks (`gpqa`, `lawbench`, `longcot-chess`, `spaceship-titanic`), can bootstrap a task directly from any MLE-Bench competition, and accepts your own task directory. The agents can run on the Claude Agent SDK, on OpenHands (Anthropic, OpenAI, Gemini, OpenRouter and other providers) or on pydantic-ai, chosen through JSON profiles rather than code changes.

## What it does

- Three-agent loop: a Meta-Agent writes the task agent, a Feedback Agent reviews its logs and score and rewrites it each generation
- Automatic scoring after every generation via the task's `evaluate.py`, against private held-out data the agents cannot see
- Four bundled tasks, a `--task_dir` option for your own tasks, and a helper that builds a task from any MLE-Bench competition
- Swappable agent backends — Claude Agent SDK, OpenHands or pydantic-ai — configured through provider and profile JSON files, including OpenAI-compatible endpoints
- `sia web` dashboard showing each generation's agent code, prompts, improvement plans, scores and trajectories, live while a run is in progress
- Optional `--sandbox docker` mode that runs agent-generated code in a container with no network access

## Getting started

SIA is on PyPI as `sia-agent` and needs Python 3.11 or newer. Pick the extra that matches the LLMs you want to use, then run one of the bundled tasks to watch the loop before writing your own evaluator.

1. Install with the Claude agent backend

   The `claude` extra uses the Claude Agent SDK and runs Claude models only.

```bash
python3 -m venv .venv && source .venv/bin/activate
pip install 'sia-agent[claude]'
export ANTHROPIC_API_KEY="..."
```

2. Or install the multi-provider backend

   The `openhands` extra works with Anthropic, OpenAI, Gemini and other providers. With a single OpenRouter key, the bundled OpenRouter profiles route both agents through OpenRouter.

```bash
pip install 'sia-agent[openhands]'
export OPENROUTER_API_KEY="..."
sia run --task gpqa --meta-agent-profile openrouter-meta --target-agent-profile openrouter-target
```

3. Run the self-improvement loop on a bundled task

   Each generation lands in `runs/run_{run_id}/gen_{n}/` with `target_agent.py`, `agent_execution.json` and, from generation 2, `improvement.md`. A live dashboard starts at http://127.0.0.1:8000 unless you pass `--no-web`. The default `--sandbox none` gives agent-generated code host access, so use `--sandbox docker` for untrusted tasks or models.

```bash
sia run --task gpqa --max_gen 5 --run_id 1
```

4. Browse past runs

   The visualizer renders everything under `runs/`: per-generation code, meta and feedback prompts, improvement plans, an accuracy-across-generations chart and execution trajectories.

```bash
sia web --runs-dir ./runs --port 8080
```

5. Bring your own task

   A task directory holds `data/public/task.md` (the description SIA reads), the inputs the agent may see, an `evaluate.py` exposing `evaluate()`, and held-out data in `data/private/`. Alternatively, build one from an MLE-Bench competition via the Kaggle API.

```bash
sia run --task_dir ./my-task --max_gen 5 --run_id 1

# or bootstrap from MLE-Bench
python -m sia.prepare_mlebench_dataset -c "spaceship-titanic"
sia run --task_dir ./tasks/spaceship-titanic --max_gen 5 --run_id 1
```

## When to use it

- Push an agent's score on a benchmark you can grade automatically, without hand-iterating on its prompts and code
- Run an automated ML-engineering loop on a Kaggle-style problem bootstrapped from MLE-Bench
- Compare how different models perform as the target or meta agent by swapping JSON profiles on the same task
- Study self-improving agents with a full record of every generation's code, rationale and score
