AI Pulse by Inblix

Hugging Face's 'tiny-agents' Builds a Python AI Agent in Just 70 Lines of Code

Hugging Face Blog · May 23, 2025 · 2 min read · Read original article →

Curated by the Inblix editorial team


Featured image for article: Hugging Face's 'tiny-agents' Builds a Python AI Agent in Just 70 Lines of Code

Hugging Face has a compelling argument for AI skeptics who think building agents requires complex frameworks: you can do it in about 70 lines of Python. Their new open-source library, tiny-agents, strips the concept down to its skeleton—essentially a while loop wired directly to an MCP (Model Context Protocol) client.

For those tired of bespoke API integrations, MCP is the real news here. It’s an open standard that lets LLMs talk to external tools without custom code for each one. The Hugging Face team extended their huggingface_hub SDK to act as an MCP client, meaning an agent can now pull tools from any compatible MCP server during inference. No more writing a new connector for every database, browser, or file system you want your model to use.

Getting started is dead simple. After installing huggingface_hub[mcp]>=0.32.0, you run a single CLI command (tiny-agents run). By default, it connects to two servers: a canonical file system server with desktop access and a Playwright server that controls a sandboxed Chromium browser. You can also point it to agent configs hosted on the Hugging Face Hub or a local agent.json file. The team demoed a web-browsing agent powered by Qwen2.5-72B-Instruct via Nebius that executed a multi-step prompt involving a web search, opening a result in a browser, and extracting information. Another example showed the same model driving a FLUX.1 image generator hosted as a Gradio Space MCP server.

What’s quietly significant here is the distribution model. Agent configurations live as datasets on the Hub, making them as shareable as model weights. This could lower the barrier for non-developers to spin up capable agents by remixing pre-built configs, though the obvious trade-off is trusting community-uploaded configurations with potentially broad tool access. The tiny-agents project also now supports the AGENTS.md standard, hinting at a push toward more interoperable agent definitions across platforms—a move that feels necessary if MCP is going to stick.

💡 Key Takeaways

  1. Hugging Face's `tiny-agents` builds a functional Python agent in ~70 lines of code by treating the agent as a while loop around an MCP client.
  2. The `huggingface_hub` SDK now acts as an MCP client, letting agents discover and use tools from any MCP server without custom integration code.
  3. Agent configurations are stored and shared as Hugging Face Hub datasets, creating a new distribution channel for reusable, tool-equipped AI assistants.

Keep reading: See related articles below for more coverage on this topic.

Get smarter about AI

The sharpest AI news, curated daily. Delivered free to your inbox.

Learn more

Glossary terms

← Back to all articles