Skip to content
TeichAI

Open-source toolkit

teich: agent data infrastructure for people who train models.

Turn coding agent traces into auditable supervised fine-tuning data

GitHub PyPI
v0.3.6latest
140stars
99PyPI releases
install & generate
$ pip install teich        # or: uvx teich --help$ teich init my-project && cd my-project# add prompts to prompts.jsonl, set OPENAI_API_KEY$ teich generate -c config.yaml --resume✓ raw traces · training rows · tools.json · dataset card → output/$ teich studio             # configure runs in the browser$ 
extract & convert
$ teich extract claude --model fable-5 --out data✓ anonymized sessions staged · README.md written  upload to Hugging Face? (y/N)$ teich extract cursor --sessions-dir ~/Cursor/User/workspaceStorage$ teich convert data --out teich-training.jsonl✓ standalone OpenAI-style rows: prompt · messages · tools · metadata$ 

Why it exists

Most SFT pipelines flatten agent data too early.

That loses tool schemas, tool results, reasoning boundaries and the exact assistant spans you meant to train on. teich keeps the data structured until the last practical moment.

Generate traces

Run Codex, Pi, Claude Code, Hermes or plain chat agents against your prompts and real GitHub repos. Resume interrupted batches.

Extract local sessions

Turn the Claude Code, Codex, Cursor, Pi and Hermes sessions already on your machine into an anonymized dataset with one command.

Normalize everything

Raw traces, JSONL, Hugging Face datasets and in-memory Dataset objects become OpenAI-style messages plus tools, with provenance intact.

Render with your template

Rows are rendered through the target tokenizer's chat template, including live Gemma 4, Qwen 3.6 / 3.8 and Granite 4.2 thinking modes.

Mask the loss correctly

Typed supervision spans are recorded before tokenization and applied after TRL or Unsloth tokenizes, so labels land exactly on assistant turns.

Audit the run

Dropped, oversized, trimmed, malformed and fully-masked rows are reported instead of silently vanishing into your training set.

Train on our data in two calls

prepare_data() then mask_data().

Point it at any dataset on this site. It renders through your tokenizer's chat template, records supervision spans, and applies response-only labels after the trainer tokenizes.

1 · load and render
python
from teich import prepare_data

train_dataset = prepare_data(
    "TeichAI/Claude-Opus-4.6-Reasoning-887x",
    tokenizer,
    max_length=32768,
    oversized_policy="trim_followups",
    tokenize=True,
    chat_template_kwargs={
        "enable_thinking": True,
        "preserve_thinking": True,
    },
)
2 · mask after tokenization
python
from teich import mask_data

trainer = mask_data(
    trainer,                    # your TRL / Unsloth SFTTrainer
    tokenizer=tokenizer,
    train_on_reasoning=True,
    train_on_final_answers=True,
    train_on_tools=True,
)

trainer.train()

Pipeline

  1. prompts / traces / JSONL / HF datasets
  2. load_traces() · prepare_data()
  3. normalized messages + tools
  4. chat template rendering
  5. supervision spans
  6. SFTTrainer tokenization
  7. mask_data()
  8. audited input_ids + labels

Made with teich

Datasets we generated with it

Agent traces from DeepSeek, Ox Alpha, Claude Fable 5 and more, straight out of the same pipeline.