Skip to main content

tinker-agent

An intelligent agent for Anthropic's Tinker fine-tuning platform. Automates the creation of fine-tuning datasets and configuration with interactive and programmatic interfaces.

Installation

pip install tinker-agent

Or with uv:

uv pip install tinker-agent

Quick Start

Interactive Mode

Simply run the command without arguments for an interactive setup:

tinker-agent

This will guide you through:

  1. Environment setup - Configure API keys on first run
  2. Task selection - Choose between SFT, RL, or CPT
  3. Model selection - Pick from available models
  4. Dataset configuration - Specify your training data (see below)

Non-Interactive Mode

Pass configuration directly via command-line arguments:

tinker-agent \
  config.dataset=HuggingFaceFW/fineweb \
  config.task_type=sft \
  config.model=Qwen/Qwen3-8B

Dataset Options

You can train on either a HuggingFace dataset or a local directory:

# HuggingFace dataset (org/dataset-name format)
tinker-agent config.dataset=ServiceNow-AI/R1-Distill-SFT config.task_type=sft

# Local directory (e.g., your Obsidian vault, markdown notes, or custom data)
tinker-agent config.dataset=~/Documents/my-obsidian-vault config.task_type=sft
tinker-agent config.dataset=/path/to/training-data config.task_type=sft

Local directories are mounted as read-only - the agent can read your data but won't modify it. Supported file formats include .json, .jsonl, .parquet, .csv, .txt, and .md.

Configuration

Environment Setup

Run the setup command to configure your environment:

tinker-agent setup

This creates a .env file with:

  • TINKER_API_KEY - Your Tinker API key (Get it here)
  • WANDB_API_KEY - Weights & Biases API key for tracking (Get it here)
  • WANDB_PROJECT - W&B project name for organizing experiments

Alternatively, set these as environment variables before running.

Task Types

  • sft - Supervised Fine-Tuning (instruction-response pairs)
  • rl - Reinforcement Learning (reward-based training)
  • cpt - Continued Pre-Training (raw text data)

Available Models

Model Type Size
Qwen/Qwen3-VL-235B-A22B-Instruct Vision Large
Qwen/Qwen3-VL-30B-A3B-Instruct Vision Medium
Qwen/Qwen3-235B-A22B-Instruct-2507 Instruction Large
Qwen/Qwen3-30B-A3B-Instruct-2507 Instruction Medium
Qwen/Qwen3-30B-A3B Hybrid Medium
Qwen/Qwen3-30B-A3B-Base Base Medium
Qwen/Qwen3-32B Hybrid Medium
Qwen/Qwen3-8B Hybrid Small
Qwen/Qwen3-8B-Base Base Small
Qwen/Qwen3-4B-Instruct-2507 Instruction Compact
openai/gpt-oss-120b Reasoning Medium
openai/gpt-oss-20b Reasoning Small
deepseek-ai/DeepSeek-V3.1 Hybrid Large
deepseek-ai/DeepSeek-V3.1-Base Base Large
meta-llama/Llama-3.1-70B Base Large
meta-llama/Llama-3.3-70B-Instruct Instruction Large
meta-llama/Llama-3.1-8B Base Small
meta-llama/Llama-3.1-8B-Instruct Instruction Small
meta-llama/Llama-3.2-3B Base Compact
meta-llama/Llama-3.2-1B Base Compact
moonshotai/Kimi-K2-Thinking Reasoning Large

Usage Examples

Interactive Mode Example

$ tinker-agent

╭──────────────────────────────────────────╮
│            tinker-agent                  │
│     Fine-tuning configuration            │
╰──────────────────────────────────────────╯

Select task type:
  1    sft    Supervised Fine-Tuning
  2    rl     Reinforcement Learning
  3    cpt    Continued Pre-Training
Choice [1/2/3/sft/rl/cpt]: 1

Select model:
Key   Model                                Type         Size
1     Qwen/Qwen3-VL-235B-A22B-Instruct     Vision       Large
2     Qwen/Qwen3-VL-30B-A3B-Instruct       Vision       Medium
3     Qwen/Qwen3-235B-A22B-Instruct-2507   Instruction  Large
...
Choice (number or model name) [1]: 8

HuggingFace dataset: HuggingFaceFW/fineweb

Non-Interactive Example

# Basic usage
tinker-agent config.dataset=my-org/my-dataset config.task_type=sft

# With all options
tinker-agent \
  config.dataset=HuggingFaceFW/fineweb \
  config.task_type=sft \
  config.model=meta-llama/Llama-3.3-70B-Instruct

Environment Variables

# Set via environment
export TINKER_API_KEY="your-api-key"
export WANDB_API_KEY="your-wandb-key"
export WANDB_PROJECT="my-finetuning-project"

# Run with config
tinker-agent config.dataset=my-dataset config.task_type=rl

Features

  • ✅ Interactive CLI - Beautiful rich terminal UI for configuration
  • ✅ Non-interactive mode - Scriptable with command-line arguments
  • ✅ Flexible datasets - Use HuggingFace datasets or local directories (Obsidian vaults, markdown notes, etc.)
  • ✅ Model selection - Choose from available models
  • ✅ Environment management - Simple .env-based configuration
  • ✅ Sandboxed execution - Agent runs in isolated directory with path validation
  • ✅ Trace viewer - Streamlit-based viewer for execution traces

Sandboxing

The agent runs in a sandboxed environment with strict path validation:

  • Root directory isolation - Agent can only access files within its working directory
  • Path validation - Blocks access to ~, $HOME, absolute paths, and .. escapes
  • No system access - Cannot read sensitive files like /etc/passwd or user home directories

This ensures the agent operates safely without requiring Docker, making it more scalable for production use.

Additional Commands

View Execution Traces

tinker-viewer

Opens a Streamlit interface to view and analyze agent execution traces.

Development

Setup Development Environment

git clone https://github.com/anthropics/tinker-agent.git
cd tinker-agent
uv sync --extra dev

Run Tests

uv run pytest

Build Package

uv build

Deploy to PyPI

python deploy.py

This will:

  1. Ask for confirmation
  2. Request your PyPI API token (create one here)
  3. Clean old builds
  4. Build the package
  5. Upload to PyPI

License

MIT

Contributing

Contributions welcome! Please open an issue or PR.

Metadata

Release files for tinker-agent 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tinker-agent 0.1.9
File Size Uploaded
tinker_agent-0.1.9.tar.gz 166.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tinker-agent 0.1.9
File Interpreter ABI Platform
tinker_agent-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 208.4 kB

Release files / tinker_agent-0.1.9.tar.gz

Download URL tinker_agent-0.1.9.tar.gz
Size 166.0 kB
Tags Source
SHA-256 checksum
How to use checksums
336ceb8923ae023b5474b28592a5d5218600af5577036f125119761d5efdee5a
BLAKE2b-256 checksum
How to use checksums
c6a4e663a09b7f4ae7ad5f6f30d5275b8faecb7bddf977e86fb1f1e143194a5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release files / tinker_agent-0.1.9-py3-none-any.whl

Download URL tinker_agent-0.1.9-py3-none-any.whl
Size 42.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0cc5396a855e85125c8e2722c0ea4a8e863f4c781868af23947a8530eb4535c6
BLAKE2b-256 checksum
How to use checksums
9944ceefa992d60fba881accacd8e03cb8b6c9aed5635cd20a7322ea77795b41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.7

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page