
Hugging Face Blog
· 2 min read
Tiny Agents in Python: a MCP-powered agent in ~70 lines of code
NEW: tiny-agents now supports AGENTS.md standard. 🥳
Inspired by Tiny Agents in JS, we ported the idea to Python 🐍 and extended the huggingface_hub client SDK to act as a MCP Client so it can pull tools from MCP servers and pass them to the LLM during inference.
MCP (Model Context Protocol) is an open protocol that standardizes how Large Language Models (LLMs) interact with external tools and APIs. Essentially, it removed the need to write custom integrations for each tool, making it simpler to plug new capabilities into your LLMs.
In this blog post, we'll show you how to get started with a tiny Agent in Python connected to MCP servers to unlock powerful tool capabilities. You'll see just how easy it is to spin up your own Agent and start building!
Spoiler : An Agent is essentially a while loop built right on top of an MCP Client!
How to Run the Demo
This section walks you through how to use existing Tiny Agents. We'll cover the setup and the commands to get an agent running.
First, you need to install the latest version of huggingface_hub with the mcp extra to get all the necessary components.
pip install "huggingface_hub[mcp]>=0.32.0"
Now, let's run an agent using the CLI!
The coolest part is that you can load agents directly from the Hugging Face Hub tiny-agents Dataset, or specify a path to your own local agent configuration!
If you don't provide a path to a specific agent configuration, our Tiny Agent will connect by default to the following two MCP servers:
- the "canonical" file system server, which gets access to your Desktop,
- and the Playwright MCP server, which knows how to use a sandboxed Chromium browser for you.
The following example shows a web-browsing agent configured to use the Qwen/Qwen2.5-72B-Instruct model via Nebius inference provider, and it comes equipped with a playwright MCP server, which lets it use a web browser! The agent config is loaded specifying its path in the tiny-agents/tiny-agents Hugging Face dataset.
Prompt used in this demo:
PROMPT.md
Original source
This story was published by Hugging Face Blog. SyncAI.news shows a preview; the complete article is on the publisher's site.
Read the full story on huggingface.co


