Overview
ml-intern is an open-source agent that does machine-learning engineering work end to end rather than answering questions about it. Given a goal, it researches — reading documentation and papers, looking for datasets and existing models on the Hub — then writes the code, runs it against local or cloud compute, reads the results and iterates. The output is a trained model and the code that produced it, not a suggestion.
It runs as a terminal application, either interactively as a chat or headlessly against a single prompt, which is what makes it usable for long jobs you leave running. Authentication is a Hugging Face token plus a GitHub token; models can come from a hosted provider or from any OpenAI-compatible endpoint, so Ollama, vLLM, LM Studio and llama.cpp all work as the driving model.
Practical guardrails come from the agent runtime rather than the prompt: tools can execute in a sandbox or against the local filesystem, sensitive operations sit behind approval gates, and a doom-loop detector interrupts the agent when it starts repeating the same tool pattern. Sessions can be auto-uploaded to a private Hugging Face dataset so a long run is reviewable afterwards, and MCP servers can be attached to give the agent extra tools.
What it does
- Runs the full loop — literature and docs research, dataset discovery, training code, execution, evaluation — as one agent
- Interactive chat mode and headless single-prompt execution for unattended runs
- Driven by a hosted model or any OpenAI-compatible local endpoint (Ollama, vLLM, LM Studio, llama.cpp)
- Sandbox or local-filesystem tool runtimes, with approval gates on sensitive operations
- Doom-loop detector that breaks the agent out of repeated tool patterns
- Optional session upload to a private Hugging Face dataset, and one-way notification gateways such as Slack
- MCP server integration for additional tools
Getting started
The project is installed from a checkout with uv, then exposed as the `ml-intern` command.
Clone and install
uv sync resolves the environment; uv tool install -e . puts the CLI on your PATH as an editable install.
git clone git@github.com:huggingface/ml-intern.git
cd ml-intern
uv sync
uv tool install -e .Set your tokens
A Hugging Face token gives the agent access to the Hub; a GitHub personal access token lets it work with repositories.
HF_TOKEN=<your-hugging-face-token>
GITHUB_TOKEN=<github-personal-access-token>Run it
With no arguments the agent starts in interactive chat mode; pass a prompt to run headlessly instead.
ml-internPoint it at a local model
Any OpenAI-compatible endpoint works as the driving model, so you can run the agent against Ollama, vLLM or LM Studio instead of a hosted API.
Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Hand off a post-training experiment — pick a base model, find data, fine-tune, evaluate — and read the results later
- Sweep a family of training configurations overnight in headless mode instead of babysitting a notebook
- Turn a paper you want to reproduce into a running training script grounded in the Hugging Face ecosystem
- Run the whole loop against a local model endpoint when the data cannot leave your machine
How ml-intern compares
ml-intern alongside other open-source autonomous coding agents tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| opencode | ★ 206k | OpenCode is an open source AI coding agent that runs in your terminal, with built-in build and plan agents and an optional desktop app. |
| Claude Code | ★ 145k | Anthropic's agentic coding tool for the terminal, IDE and GitHub: it understands your codebase, executes routine tasks, explains code and handles git workflows from natural-language commands. |
| OpenAI Codex | ★ 123k | OpenAI's cloud and CLI coding agent that writes features, fixes bugs, and proposes code changes across a repo, running tasks in parallel. |
| Gemini CLI | ★ 107k | An open-source command-line AI agent from Google that connects your terminal to Gemini models for reading code, editing files, running shell commands, and searching the web. |
| Pi | ★ 104k | Minimal terminal coding agent harness with four built-in tools, extended through TypeScript extensions, skills and prompt templates instead of forks. |
| OpenHands | ★ 87.2k | An open-source AI software-development agent that plans tasks, edits files, runs commands, and tests code, usable from a terminal CLI, a local web GUI, or a Python SDK. |
| Cline | ★ 67.8k | Open-source coding agent that runs as a VS Code or JetBrains extension, a terminal CLI, or an embeddable Node SDK, editing code and running commands with human-in-the-loop approval. |
| ml-intern | ★ 10.8k | An agent that reads the papers, writes the training code and ships the model |