[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-71969":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},71969,"ml-intern","huggingface\u002Fml-intern","huggingface","🤗 ml-intern: an open-source ML engineer that reads papers, trains models, and ships ML models","",null,"Python",10396,1100,45,30,0,101,235,553,303,119.13,"Apache License 2.0",false,"main",true,[],"2026-06-12 04:01:03","\u003Cp align=\"center\">\n  \u003Cimg src=\"frontend\u002Fpublic\u002Fsmolagents.webp\" alt=\"smolagents logo\" width=\"160\" \u002F>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fml-intern\u002Fblob\u002Fmain\u002FLICENSE\">\u003Cimg alt=\"License\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache_2.0-blue.svg\">\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fsmolagents-ml-intern.hf.space\u002F\">\u003Cimg alt=\"Website\" src=\"https:\u002F\u002Fimg.shields.io\u002Fwebsite\u002Fhttps\u002Fsmolagents-ml-intern.hf.space.svg?down_color=red&down_message=offline&up_message=online\">\u003C\u002Fa>\n\u003C\u002Fp>\n\n# ML Intern\n\nAn ML intern that autonomously researches, writes, and ships good quality ML related code using the Hugging Face ecosystem — with deep access to docs, papers, datasets, and cloud compute.\n\n## Quick Start\n\n### Installation\n\n```bash\ngit clone git@github.com:huggingface\u002Fml-intern.git\ncd ml-intern\nuv sync\nuv tool install -e .\n```\n\n#### That's it. Now `ml-intern` works from any directory:\n\n```bash\nml-intern\n```\n\nCreate a `.env` file in the project root (or export these in your shell):\n\n```bash\nANTHROPIC_API_KEY=\u003Cyour-anthropic-api-key> # if using anthropic models\nOPENAI_API_KEY=\u003Cyour-openai-api-key> # if using openai models\nLOCAL_LLM_BASE_URL=http:\u002F\u002Flocalhost:8000 # shared fallback for local model prefixes\nLOCAL_LLM_API_KEY=\u003Coptional-local-api-key> # optional shared local API key\nHF_TOKEN=\u003Cyour-hugging-face-token>\nGITHUB_TOKEN=\u003Cgithub-personal-access-token> \n```\nIf no `HF_TOKEN` is set, the CLI will prompt you to paste one on first launch\nunless you start on a local model. To get a GITHUB_TOKEN follow the tutorial\n[here](https:\u002F\u002Fdocs.github.com\u002Fen\u002Fauthentication\u002Fkeeping-your-account-and-data-secure\u002Fmanaging-your-personal-access-tokens#creating-a-fine-grained-personal-access-token).\n\n### Usage\n\n**Interactive mode** (start a chat session):\n\n```bash\nml-intern\n```\n\n**Headless mode** (single prompt, auto-approve):\n\n```bash\nml-intern \"fine-tune llama on my dataset\"\n```\n\n**Options:**\n\n```bash\nml-intern --model anthropic\u002Fclaude-opus-4-7 \"your prompt\"   # requires ANTHROPIC_API_KEY\nml-intern --model openai\u002Fgpt-5.5 \"your prompt\"              # requires OPENAI_API_KEY\nml-intern --model ollama\u002Fllama3.1:8b \"your prompt\"\nml-intern --model vllm\u002Fmeta-llama\u002FLlama-3.1-8B-Instruct \"your prompt\"\nml-intern --sandbox-tools \"your prompt\"                         # use HF Space sandbox tools\nml-intern --max-iterations 100 \"your prompt\"\nml-intern --no-stream \"your prompt\"\n```\n\nRun `ml-intern` then `\u002Fmodel` to see the full list of suggested model ids\n(Claude, GPT, HF-router models like MiniMax, Kimi, GLM, DeepSeek, and local\nmodel prefixes).\n\n**Local models:**\n\nLocal model support uses OpenAI-compatible HTTP endpoints through LiteLLM. The\nagent does not load model weights directly from disk; start your inference\nserver first, then select it with a provider-specific model prefix:\n\n```bash\nml-intern --model ollama\u002Fllama3.1:8b \"your prompt\"\nml-intern --model vllm\u002Fmeta-llama\u002FLlama-3.1-8B-Instruct \"your prompt\"\n```\n\nInside interactive mode, switch with `\u002Fmodel`:\n\n```text\n\u002Fmodel ollama\u002Fllama3.1:8b\n\u002Fmodel lm_studio\u002Fgoogle\u002Fgemma-3-4b\n\u002Fmodel llamacpp\u002Fllama-3.1-8b-instruct\n```\n\nSupported local prefixes are `ollama\u002F`, `vllm\u002F`, `lm_studio\u002F`, and\n`llamacpp\u002F`. Set `LOCAL_LLM_BASE_URL` and optional `LOCAL_LLM_API_KEY` to use\none shared local endpoint, or override a specific provider with its matching\n`*_BASE_URL` \u002F `*_API_KEY` variable, such as `OLLAMA_BASE_URL` or\n`VLLM_API_KEY`. Provider-specific variables take precedence over the shared\nlocal variables. Base URLs may include or omit `\u002Fv1`.\n\n**CLI tool runtime:**\n\nBy default, the CLI runs `bash`, `read`, `write`, and `edit` on your local\nfilesystem. To use HF Space sandbox tools instead, including `sandbox_create`,\nopt in with `--sandbox-tools`:\n\n```bash\nml-intern --sandbox-tools \"test this training script in a GPU sandbox\"\nml-intern --model llamacpp\u002Fggml-org\u002Fgemma-3-1b-it-GGUF --sandbox-tools\n```\n\nSandbox tool runtime requires `HF_TOKEN`, even when the selected model is local,\nbecause it creates private HF Spaces. You can also make sandbox tools your CLI\ndefault in `~\u002F.config\u002Fml-intern\u002Fcli_agent_config.json`:\n\n```json\n{ \"tool_runtime\": \"sandbox\" }\n```\n\nUse the default local runtime when you want tools to inspect or edit files in\nyour checkout. Use sandbox runtime when you want the agent to create or replace\nan HF Space sandbox, test code remotely, or request GPU sandbox hardware before\nlaunching larger HF Jobs.\n\n## Sharing Traces\n\nEvery session is auto-uploaded to your **own private Hugging Face dataset**\nin [Claude Code JSONL format](https:\u002F\u002Fhuggingface.co\u002Fchangelog\u002Fagent-trace-viewer),\nwhich the HF Agent Trace Viewer auto-detects so you can browse turns, tool\ncalls, and model responses directly on the Hub.\n\nBy default the dataset is named `{your-hf-username}\u002Fml-intern-sessions` and is\n**created private**. You can flip it to public from inside the CLI:\n\n```bash\n\u002Fshare-traces            # show current visibility + dataset URL\n\u002Fshare-traces public     # publish (anyone can view)\n\u002Fshare-traces private    # lock it back down\n```\n\nYou can also flip visibility from the dataset page on huggingface.co — the\nagent honours whatever you set there for subsequent uploads.\n\nTo opt out entirely, set in your CLI config (e.g. `configs\u002Fcli_agent_config.json`\nor `~\u002F.config\u002Fml-intern\u002Fcli_agent_config.json`):\n\n```json\n{ \"share_traces\": false }\n```\n\nTo override the destination repo, set:\n\n```json\n{ \"personal_trace_repo_template\": \"{hf_user}\u002Fmy-custom-traces\" }\n```\n\nThe shared `smolagents\u002Fml-intern-sessions` dataset is unrelated and only\nreceives anonymized telemetry rows used by the backend KPI scheduler.\n\n## Supported Gateways\n\nML Intern currently supports one-way notification gateways from CLI sessions.\nThese gateways send out-of-band status updates; they do not accept inbound chat\nmessages.\n\n### Slack\n\nSlack notifications use the Slack Web API to post messages when the agent needs\napproval, hits an error, or completes a turn. Create a Slack app with a bot token\nthat has `chat:write`, invite the bot to the target channel, then set:\n\n```bash\nSLACK_BOT_TOKEN=xoxb-...\nSLACK_CHANNEL_ID=C...\n```\n\nThe CLI automatically creates a `slack.default` destination when both variables\nare present. Optional environment variables for the env-only default:\n\n```bash\nML_INTERN_SLACK_NOTIFICATIONS=false\nML_INTERN_SLACK_DESTINATION=slack.ops\nML_INTERN_SLACK_AUTO_EVENTS=approval_required,error,turn_complete\nML_INTERN_SLACK_ALLOW_AGENT_TOOL=true\nML_INTERN_SLACK_ALLOW_AUTO_EVENTS=true\n```\n\nFor a persistent user-level config, put overrides in\n`~\u002F.config\u002Fml-intern\u002Fcli_agent_config.json` or point `ML_INTERN_CLI_CONFIG` at a\nJSON file:\n\n```json\n{\n  \"messaging\": {\n    \"enabled\": true,\n    \"auto_event_types\": [\"approval_required\", \"error\", \"turn_complete\"],\n    \"destinations\": {\n      \"slack.ops\": {\n        \"provider\": \"slack\",\n        \"token\": \"${SLACK_BOT_TOKEN}\",\n        \"channel\": \"${SLACK_CHANNEL_ID}\",\n        \"allow_agent_tool\": true,\n        \"allow_auto_events\": true\n      }\n    }\n  }\n}\n```\n\n## Architecture\n\n### Component Overview\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                         User\u002FCLI                            │\n└────────────┬─────────────────────────────────────┬──────────┘\n             │ Operations                          │ Events\n             ↓ (user_input, exec_approval,         ↑\n      submission_queue  interrupt, compact, ...)  event_queue\n             │                                          │\n             ↓                                          │\n┌────────────────────────────────────────────────────┐  │\n│            submission_loop (agent_loop.py)         │  │\n│  ┌──────────────────────────────────────────────┐  │  │\n│  │  1. Receive Operation from queue             │  │  │\n│  │  2. Route to handler (run_agent\u002Fcompact\u002F...) │  │  │\n│  └──────────────────────────────────────────────┘  │  │\n│                      ↓                             │  │\n│  ┌──────────────────────────────────────────────┐  │  │\n│  │         Handlers.run_agent()                 │  ├──┤\n│  │                                              │  │  │\n│  │  ┌────────────────────────────────────────┐  │  │  │\n│  │  │  Agentic Loop (max 300 iterations)     │  │  │  │\n│  │  │                                        │  │  │  │\n│  │  │  ┌──────────────────────────────────┐  │  │  │  │\n│  │  │  │ Session                          │  │  │  │  │\n│  │  │  │  ┌────────────────────────────┐  │  │  │  │  │\n│  │  │  │  │ ContextManager             │  │  │  │  │  │\n│  │  │  │  │ • Message history          │  │  │  │  │  │\n│  │  │  │  │   (litellm.Message[])      │  │  │  │  │  │\n│  │  │  │  │ • Auto-compaction (170k)   │  │  │  │  │  │\n│  │  │  │  │ • Session upload to HF     │  │  │  │  │  │\n│  │  │  │  └────────────────────────────┘  │  │  │  │  │\n│  │  │  │                                  │  │  │  │  │\n│  │  │  │  ┌────────────────────────────┐  │  │  │  │  │\n│  │  │  │  │ ToolRouter                 │  │  │  │  │  │\n│  │  │  │  │  ├─ HF docs & research     │  │  │  │  │  │\n│  │  │  │  │  ├─ HF repos, datasets,    │  │  │  │  │  │\n│  │  │  │  │  │  jobs, papers           │  │  │  │  │  │\n│  │  │  │  │  ├─ GitHub code search     │  │  │  │  │  │\n│  │  │  │  │  ├─ Sandbox & local tools  │  │  │  │  │  │\n│  │  │  │  │  ├─ Planning               │  │  │  │  │  │\n│  │  │  │  │  └─ MCP server tools       │  │  │  │  │  │\n│  │  │  │  └────────────────────────────┘  │  │  │  │  │\n│  │  │  └──────────────────────────────────┘  │  │  │  │\n│  │  │                                        │  │  │  │\n│  │  │  ┌──────────────────────────────────┐  │  │  │  │\n│  │  │  │ Doom Loop Detector               │  │  │  │  │\n│  │  │  │ • Detects repeated tool patterns │  │  │  │  │\n│  │  │  │ • Injects corrective prompts     │  │  │  │  │\n│  │  │  └──────────────────────────────────┘  │  │  │  │\n│  │  │                                        │  │  │  │\n│  │  │  Loop:                                 │  │  │  │\n│  │  │    1. LLM call (litellm.acompletion)   │  │  │  │\n│  │  │       ↓                                │  │  │  │\n│  │  │    2. Parse tool_calls[]               │  │  │  │\n│  │  │       ↓                                │  │  │  │\n│  │  │    3. Approval check                   │  │  │  │\n│  │  │       (jobs, sandbox, destructive ops) │  │  │  │\n│  │  │       ↓                                │  │  │  │\n│  │  │    4. Execute via ToolRouter           │  │  │  │\n│  │  │       ↓                                │  │  │  │\n│  │  │    5. Add results to ContextManager    │  │  │  │\n│  │  │       ↓                                │  │  │  │\n│  │  │    6. Repeat if tool_calls exist       │  │  │  │\n│  │  └────────────────────────────────────────┘  │  │  │\n│  └──────────────────────────────────────────────┘  │  │\n└────────────────────────────────────────────────────┴──┘\n```\n\n### Agentic Loop Flow\n\n```\nUser Message\n     ↓\n[Add to ContextManager]\n     ↓\n     ╔═══════════════════════════════════════════╗\n     ║      Iteration Loop (max 300)             ║\n     ║                                           ║\n     ║  Get messages + tool specs                ║\n     ║         ↓                                 ║\n     ║  litellm.acompletion()                    ║\n     ║         ↓                                 ║\n     ║  Has tool_calls? ──No──> Done             ║\n     ║         │                                 ║\n     ║        Yes                                ║\n     ║         ↓                                 ║\n     ║  Add assistant msg (with tool_calls)      ║\n     ║         ↓                                 ║\n     ║  Doom loop check                          ║\n     ║         ↓                                 ║\n     ║  For each tool_call:                      ║\n     ║    • Needs approval? ──Yes──> Wait for    ║\n     ║    │                         user confirm ║\n     ║    No                                     ║\n     ║    ↓                                      ║\n     ║    • ToolRouter.execute_tool()            ║\n     ║    • Add result to ContextManager         ║\n     ║         ↓                                 ║\n     ║  Continue loop ─────────────────┐         ║\n     ║         ↑                       │         ║\n     ║         └───────────────────────┘         ║\n     ╚═══════════════════════════════════════════╝\n```\n\n## Events\n\nThe agent emits the following events via `event_queue`:\n\n- `processing` - Starting to process user input\n- `ready` - Agent is ready for input\n- `assistant_chunk` - Streaming token chunk\n- `assistant_message` - Complete LLM response text\n- `assistant_stream_end` - Token stream finished\n- `tool_call` - Tool being called with arguments\n- `tool_output` - Tool execution result\n- `tool_log` - Informational tool log message\n- `tool_state_change` - Tool execution state transition\n- `approval_required` - Requesting user approval for sensitive operations\n- `turn_complete` - Agent finished processing\n- `error` - Error occurred during processing\n- `interrupted` - Agent was interrupted\n- `compacted` - Context was compacted\n- `undo_complete` - Undo operation completed\n- `shutdown` - Agent shutting down\n\n## Development\n\n### Pre-commit Checks\n\nRun Ruff before every commit:\n\n```bash\nuv run ruff check .\nuv run ruff format --check .\n```\n\nIf the format check fails, run `uv run ruff format .` and re-run the checks\nbefore committing.\n\n### Adding Built-in Tools\n\nEdit `agent\u002Fcore\u002Ftools.py`:\n\n```python\ndef create_builtin_tools() -> list[ToolSpec]:\n    return [\n        ToolSpec(\n            name=\"your_tool\",\n            description=\"What your tool does\",\n            parameters={\n                \"type\": \"object\",\n                \"properties\": {\n                    \"param\": {\"type\": \"string\", \"description\": \"Parameter description\"}\n                },\n                \"required\": [\"param\"]\n            },\n            handler=your_async_handler\n        ),\n        # ... existing tools\n    ]\n```\n\n### Adding MCP Servers\n\nEdit `configs\u002Fcli_agent_config.json` for CLI defaults, or\n`configs\u002Ffrontend_agent_config.json` for web-session defaults:\n\n```json\n{\n  \"model_name\": \"anthropic\u002Fclaude-sonnet-4-5-20250929\",\n  \"mcpServers\": {\n    \"your-server-name\": {\n      \"transport\": \"http\",\n      \"url\": \"https:\u002F\u002Fexample.com\u002Fmcp\",\n      \"headers\": {\n        \"Authorization\": \"Bearer ${YOUR_TOKEN}\"\n      }\n    }\n  }\n}\n```\n\nNote: Environment variables like `${YOUR_TOKEN}` are auto-substituted from `.env`.\n\n## Cite ml-intern\nIf you use `ml-intern` in your work, please cite it by using the following BibTeX entry or similar.\n```bibtex\n@Misc{ml-intern,\n  title =        {ml-intern: an agent that autonomously researches, writes, and ships good quality ML related code using the Hugging Face ecosystem},\n  author =       {Aksel Joonas Reedi, Henri Bonamy, Yoan Di Cosmo, Leandro von Werra, Lewis Tunstall},\n  howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fml-intern}},\n  year =         {2026}\n}\n```\n","ml-intern 是一个开源的机器学习工程师工具，能够自主阅读论文、训练模型并部署高质量的机器学习代码。项目基于 Hugging Face 生态系统，支持深度访问文档、论文、数据集和云端计算资源，主要使用 Python 语言开发。其核心功能包括通过交互式或无头模式执行指令来完成从模型微调到代码生成的任务，并且兼容多种主流大模型如 Anthropic 和 OpenAI 提供的服务。此外，它还支持本地模型的使用，只需配置相应的API密钥即可。该工具非常适合需要快速原型设计、实验新算法或自动化处理机器学习工作流的研究人员和开发者。",2,"2026-06-11 03:39:44","high_star"]