AI coding agent for machine learning tasks
Create, execute, and evaluate Jupyter notebooks, iterate on model architectures, and automate ML workflows directly from your terminal.
mlcode is an AI coding agent tailored for machine learning workflows. Operating inside your terminal or notebook workspace, it helps you:
- Create, edit, & run Jupyter notebooks for data exploration, model training, and evaluation.
- Iterate on ML models — tweak hyperparameters, benchmark metrics, and refactor training pipelines.
- Automate experiment loops — inspect stack traces, fix code errors, and log results.
- Maintain session history — durable session trees with branching, resume, and compaction.
tau_coding → tau_agent → tau_ai
tau_ai: Model provider streaming layer (OpenAI, Anthropic, OpenRouter, local models).tau_agent: Portable agent brain (messages, tools, events, session tree).tau_coding: CLI application, Textual interactive TUI, file/shell tools, and resources.
mlcode requires Python 3.12 or newer.
From PyPI:
# Using uv (recommended)
uv tool install mlcode-ai
# Using pip
pip install mlcode-aiFor local development:
uv run mlcodeRun mlcode from your ML project directory:
cd my-ml-project
mlcodeThen prompt mlcode in the interactive TUI:
build a baseline PyTorch model for CIFAR-10 in a notebook and evaluate accuracy
Non-interactive print mode for scripts:
mlcode -p "summarize dataset structure in data/"
mlcode --cwd /path/to/project -p "run notebook and output evaluation metrics"Start mlcode and authenticate your AI provider with /login:
/login
/login openai
/model
Supported providers include OpenAI, Anthropic, OpenRouter, OpenAI Codex, Hugging Face, and local OpenAI-compatible endpoints (Ollama, vLLM, DeepSeek).
- Interactive TUI & Print Mode: Full terminal interface powered by Textual or non-interactive CLI.
- Coding & Execution Tools:
read,write,edit, andbashexecution. - Notebook & ML Automation: Work with scripts, notebooks, and experiment loops.
- Durable Sessions: Append-only JSONL session histories with tree branching (
/tree) and recovery. - Custom Skills & Instructions: Support for project-level instructions (
AGENTS.md) and custom skills.
Released under the MIT License.