> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Agents quickstart

> From production conversation logs to a retrained, evaluated model — without owning a GPU.

By the end of this page you will have graded your agent's real conversations,
curated the ones worth learning from, trained on them, and compared the result
against the base model on prompts it never saw.

## Install

```bash theme={null}
pip install stateset-agents
```

That covers ingest, grading, curation, the stub backend and the CLI. Real
training and the MCP server are extras:

```bash theme={null}
pip install "stateset-agents[training]"
pip install "stateset-agents[mcp]"
```

## 1. Bring your own logs

Ingest reads OpenAI chat-completions JSONL or a LangChain/LangGraph message
dump and writes one transcript file per conversation.

```bash theme={null}
stateset-agents ingest \
  --format openai \
  --input my_agent_logs.jsonl \
  --output transcripts/
```

## 2. Grade and curate

Every assistant turn is scored against the reward; turns at or above the
threshold are curated into a training set.

```bash theme={null}
stateset-agents improve run \
  --transcripts transcripts/ \
  --reward customer_support \
  --output improved/
```

Three files come out of `improved/`:

| File                   | What it is                                                          |
| ---------------------- | ------------------------------------------------------------------- |
| `curated.jsonl`        | The turns that scored at or above the threshold — your training set |
| `improve_summary.json` | Mean score, per-component breakdown, how many turns survived        |
| `next_steps.md`        | The exact training command for what was just curated                |

<Warning>
  Read `improve_summary.json` before training on the output. A curated set that
  kept 90% of turns usually means the threshold is too low to be selecting for
  anything, and a set that kept 3% will not train. The default threshold is
  `0.7`; move it and re-run rather than training on a set you have not looked
  at.
</Warning>

## 3. Train

If you have a GPU, `next_steps.md` prints the command. If you do not,
`train-remote` rents one, trains, evaluates, and gives it back.

```bash theme={null}
stateset-agents train-remote \
  --provider runpod \
  --gpu "NVIDIA H100 80GB HBM3" \
  --dataset improved/curated.jsonl \
  --base-model meta-models/Muse-Glimmer-30B \
  --container-disk-gb 160 \
  --eval-prompts held_out.txt \
  --max-cost 5
```

<Warning>
  `--max-cost` is a ceiling, and a run that could exceed it refuses to start
  rather than stopping partway. Set it. The pod is terminated on every exit
  path — success, failure, timeout, or your laptop dying mid-run — but a
  ceiling is what stops a misconfigured run from being expensive before any of
  those paths are reached.
</Warning>

## 4. Check it actually learned

Training returns `eval_results.json`: the base model's answers beside the
fine-tuned model's, on the held-out prompts, with pass/fail assertions if you
wrote them.

```bash theme={null}
stateset-agents chat-remote \
  --base-model meta-models/Muse-Glimmer-30B \
  --adapter outputs/sft_v1
```

<Note>
  A lower loss is not evidence the agent improved at the job. The held-out
  comparison is — it is the only step here that can tell you the model got
  better at the thing you graded rather than better at reproducing the turns you
  curated.
</Note>

## Next steps

<CardGroup cols={2}>
  <Card title="Overview" icon="diagram-project" href="/stateset-agents/overview">
    The loop, the rewards, and the fail-closed backend adapters.
  </Card>

  <Card title="CLI reference" icon="terminal" href="/stateset-agents/cli">
    Every command, and which ones spend money.
  </Card>

  <Card title="MCP server" icon="plug" href="/stateset-agents/mcp-server">
    The same loop, driven by an agent instead of a shell.
  </Card>

  <Card title="Evaluations" icon="clipboard-check" href="/guides/evaluations-guide">
    Building the held-out set you evaluate against.
  </Card>
</CardGroup>
