import{s as kU,n as hU,o as dU}from"../chunks/scheduler.9cda857a.js";import{S as OU,i as mU,e,s as J,c as y,h as fU,a as s,d as U,b as t,f as rU,g as a,j as n,k as DM,l as QU,m as T,n as i,t as j,o as w,p as A}from"../chunks/index.003612b0.js";import{C as VU}from"../chunks/CopyLLMTxtMenu.44d08a39.js";import{C}from"../chunks/CodeBlock.a90632f1.js";import{H as o,E as RU}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.e5cfda8c.js";function FU(vM){let g,Ol,hl,ml,u,fl,c,Ql,r,$M="This page compiles all the libraries and tools Hugging Face offers for agentic workflows:",Vl,k,BM='<li><a href="./hf-mcp-server">HF MCP Server</a>: Connect your MCP-compatible AI assistant directly to the Hugging Face Hub.</li> <li><code>tiny-agents</code>: A lightweight toolkit for MCP-powered agents, available in both JS (<code>@huggingface/tiny-agents</code>) and Python (<code>huggingface_hub</code>).</li> <li><code>Gradio MCP Server</code>: Easily create MCP servers from Gradio apps and Spaces.</li> <li><code>smolagents</code>: a Python library that enables you to run powerful agents in a few lines of code.</li>',Rl,h,Fl,d,HM="The official <strong>Hugging Face MCP (Model Context Protocol) Server</strong> enables seamless integration between the Hugging Face Hub and any MCP-compatible AI assistant—including VSCode, Cursor, and Claude Desktop.",Nl,O,SM="With the HF MCP Server, you can enhance your AI assistant’s capabilities by connecting directly to the Hub’s ecosystem. It comes with:",bl,m,ZM='<li>a curated set of <strong>built-in tools</strong> like Spaces and Papers Semantic Search, Model and Dataset exploration, etc</li> <li><strong>MCP-compatible Gradio apps</strong>: Connect to any <a href="https://huggingface.co/spaces?filter=mcp-server" rel="nofollow">MCP-compatible Gradio app</a> built by the Hugging Face community</li>',Dl,f,vl,Q,EM='Visit <a href="https://huggingface.co/settings/mcp" rel="nofollow">huggingface.co/settings/mcp</a> to configure your MCP client and get started. Read the dedicated one‑page guide: <a href="./hf-mcp-server">HF MCP Server</a>.',$l,p,xM="<p>This feature is experimental ⚗️ and will continue to evolve.</p>",Bl,V,Hl,R,GM='NEW: tiny-agents now supports <a href="https://agents.md/" rel="nofollow">AGENTS.md</a> standard. 🥳',Sl,F,PM="<code>tiny-agents</code> is a lightweight toolkit for running and building MCP-powered agents on top of the Hugging Face Inference Client + Model Context Protocol (MCP). It is available as a JS package <code>@huggingface/tiny-agents</code> and in the <code>huggingface_hub</code> Python package.",Zl,N,El,b,qM="The <code>@huggingface/tiny-agents</code> package offers a simple and straightforward CLI and a simple programmatic API for running and building MCP-powered agents in JS.",xl,D,WM="<strong>Getting Started</strong>",Gl,v,LM="First, you need to install the package:",Pl,$,ql,B,_M="Then, you can your agent:",Wl,H,Ll,S,zM='You can load agents directly from the <a href="https://huggingface.co/datasets/tiny-agents/tiny-agents" rel="nofollow">tiny-agents</a> Dataset, or specify a path to your own local agent configuration.',_l,Z,YM=`<strong>Advanced Usage</strong>
In addition to the CLI, you can use the <code>Agent</code> class for more fine-grained control. For lower-level interactions, use the <code>MCPClient</code> from the <code>@huggingface/mcp-client</code> package to connect directly to MCP servers and manage tool calls.`,zl,E,XM='Learn more about tiny-agents in the <a href="https://huggingface.co/docs/huggingface.js/en/tiny-agents/README" rel="nofollow">huggingface.js documentation</a>.',Yl,x,Xl,G,KM='The <code>huggingface_hub</code> library is the easiest way to run MCP-powered agents in Python. It includes a high-level <code>tiny-agents</code> CLI as well as programmatic access via the <code>Agent</code> and <code>MCPClient</code> classes — all built to work with <a href="https://huggingface.co/docs/inference-providers/index" rel="nofollow">Hugging Face Inference Providers</a>, local LLMs, or any inference endpoint compatible with OpenAI’s API specs.',Kl,P,lU="<strong>Getting started</strong>",lM,q,MU="Install the latest version with MCP support:",MM,W,UM,L,UU="Then, you can run your agent:",TM,_,JM,z,TU="The CLI pulls the config, connects to its MCP servers, prints the available tools, and waits for your prompt.",tM,Y,JU="<strong>Advanced Usage</strong>",eM,X,tU="For more fine-grained control, use the <code>MCPClient</code> directly. This low-level interface extends <code>AsyncInferenceClient</code> and allows LLMs to call tools via the Model Context Protocol (MCP). It supports both local (<code>stdio</code>) and remote (<code>http</code>/<code>sse</code>) MCP servers, handles tool registration and execution, and streams results back to the model in real-time.",sM,K,eU='Learn more in the <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/mcp" rel="nofollow"><code>huggingface_hub</code> MCP documentation</a>.',nM,ll,yM,Ml,sU=`To create your own agent, simply create a folder (e.g., <code>my-agent/</code>) and define your agent’s configuration in an <code>agent.json</code> file.
The following example shows a web-browsing agent configured to use the <a href="https://huggingface.co/Qwen/Qwen2.5-72B-Instruct" rel="nofollow">Qwen/Qwen2.5-72B-Instruct</a> model via Nebius inference provider, and it comes equipped with a playwright MCP server, which lets it use a web browser`,aM,Ul,iM,Tl,nU='To use a local LLM (such as <a href="https://github.com/ggerganov/llama.cpp" rel="nofollow">llama.cpp</a>, or <a href="https://lmstudio.ai/" rel="nofollow">LM Studio</a>), just provide an <code>endpointUrl</code>:',jM,Jl,wM,tl,yU="Optionally, add a <code>PROMPT.md</code> to customize the system prompt.",AM,I,aU='<p>Don’t hesitate to contribute your agent to the community by opening a Pull Request in the <a href="https://huggingface.co/datasets/tiny-agents/tiny-agents" rel="nofollow">tiny-agents</a> Hugging Face dataset.</p>',CM,el,gM,sl,iU="You can build an MCP server in just a few lines of Python with Gradio. If you have an existing Gradio app or Space you’d like to use as an MCP server / tool, it’s just a single-line change.",oM,nl,jU="To make a Gradio application an MCP server, simply pass in <code>mcp_server=True</code> when launching your demo like follows.",pM,yl,IM,al,wU="The MCP server will be available at <code>http://your-space-id.hf.space/gradio_api/mcp/sse</code> where your application is served. It will have a tool corresponding to each function in your Gradio app, with the tool description automatically generated from the docstrings of your functions.",uM,il,AU="Lastly, add this to the settings of the MCP Client of your choice (e.g. Cursor).",cM,jl,rM,wl,CU='This is very powerful because it lets the LLM use any Gradio application as a tool. You can find thousands of them on <a href="https://huggingface.co/spaces" rel="nofollow">Spaces</a>. Learn more <a href="https://www.gradio.app/guides/building-mcp-server-with-gradio" rel="nofollow">here</a>.',kM,Al,hM,Cl,gU='<a href="https://github.com/huggingface/smolagents" rel="nofollow">smolagents</a> is a lightweight library to cover all agentic use cases, from code-writing agents to computer use, in few lines of code. It is model agnostic, supporting local models served with Hugging Face Transformers, as well as models offered with <a href="../inference-providers/index.md">Inference Providers</a>, and proprietary model providers.',dM,gl,oU=`It offers a unique kind of agent :<code>CodeAgent</code>, an agent that writes its actions in Python code.
It also supports the standard agent that writes actions in JSON blobs as most other agentic frameworks do, called <code>ToolCallingAgent</code>.
To learn more about write actions in code vs JSON, check out our <a href="https://www.deeplearning.ai/short-courses/building-code-agents-with-hugging-face-smolagents/" rel="nofollow">new short course on DeepLearning.AI</a>.`,OM,ol,pU="If you want to avoid defining agents yourself, the easiest way to start an agent is through the CLI, using the <code>smolagent</code> command.",mM,pl,fM,Il,IU='Agents can be pushed to Hugging Face Hub as Spaces. Check out all the cool agents people have built <a href="https://huggingface.co/spaces?filter=smolagents&amp;sort=likes" rel="nofollow">here</a>.',QM,ul,uU="smolagents also supports MCP servers as tools, as follows:",VM,cl,RM,rl,cU='Learn more <a href="https://huggingface.co/docs/smolagents/tutorials/tools#use-mcp-tools-with-mcpclient-directly" rel="nofollow">in the documentation</a>.',FM,kl,NM,dl,bM;return u=new VU({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),c=new o({props:{title:"Agents on the Hub",local:"agents-on-the-hub",headingTag:"h1"}}),h=new o({props:{title:"HF MCP Server",local:"hf-mcp-server",headingTag:"h2"}}),f=new o({props:{title:"Getting Started",local:"getting-started",headingTag:"h4"}}),V=new o({props:{title:"tiny-agents (JS and Python)",local:"tiny-agents-js-and-python",headingTag:"h2"}}),N=new o({props:{title:"@huggingface/tiny-agents (JS)",local:"huggingfacetiny-agents-js",headingTag:"h3"}}),$=new C({props:{code:"bnBtJTIwaW5zdGFsbCUyMCU0MGh1Z2dpbmdmYWNlJTJGdGlueS1hZ2VudHMlMEElMjMlMjBvciUwQXBucG0lMjBhZGQlMjAlNDBodWdnaW5nZmFjZSUyRnRpbnktYWdlbnRz",highlighted:`npm install @huggingface/tiny-agents
<span class="hljs-comment"># or</span>
pnpm add @huggingface/tiny-agents`,wrap:!1}}),H=new C({props:{code:"bnB4JTIwJTQwaHVnZ2luZ2ZhY2UlMkZ0aW55LWFnZW50cyUyMCU1QmNvbW1hbmQlNUQlMjAlMjJhZ2VudCUyRmlkJTIyJTBBJTBBVXNhZ2UlM0ElMEElMjAlMjB0aW55LWFnZW50cyUyMCU1QmZsYWdzJTVEJTBBJTIwJTIwdGlueS1hZ2VudHMlMjBydW4lMjAlMjAlMjAlMjJhZ2VudCUyRmlkJTIyJTBBJTIwJTIwdGlueS1hZ2VudHMlMjBzZXJ2ZSUyMCUyMmFnZW50JTJGaWQlMjIlMEElMEFBdmFpbGFibGUlMjBDb21tYW5kcyUzQSUwQSUyMCUyMHJ1biUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMFJ1biUyMHRoZSUyMEFnZW50JTIwaW4lMjBjb21tYW5kLWxpbmUlMEElMjAlMjBzZXJ2ZSUyMCUyMCUyMCUyMCUyMCUyMCUyMFJ1biUyMHRoZSUyMEFnZW50JTIwYXMlMjBhbiUyME9wZW5BSS1jb21wYXRpYmxlJTIwSFRUUCUyMHNlcnZlcg==",highlighted:`npx @huggingface/tiny-agents [<span class="hljs-built_in">command</span>] <span class="hljs-string">&quot;agent/id&quot;</span>

Usage:
  tiny-agents [flags]
  tiny-agents run   <span class="hljs-string">&quot;agent/id&quot;</span>
  tiny-agents serve <span class="hljs-string">&quot;agent/id&quot;</span>

Available Commands:
  run         Run the Agent <span class="hljs-keyword">in</span> command-line
  serve       Run the Agent as an OpenAI-compatible HTTP server`,wrap:!1}}),x=new o({props:{title:"huggingface_hub (Python)",local:"huggingfacehub-python",headingTag:"h3"}}),W=new C({props:{code:"cGlwJTIwaW5zdGFsbCUyMCUyMmh1Z2dpbmdmYWNlX2h1YiU1Qm1jcCU1RCUzRSUzRDAuMzIuMiUyMg==",highlighted:'pip install <span class="hljs-string">&quot;huggingface_hub[mcp]&gt;=0.32.2&quot;</span>',wrap:!1}}),_=new C({props:{code:" ",highlighted:`&gt; tiny-agents run --<span class="hljs-built_in">help</span>
                                                                                                                                                                                     
 Usage: tiny-agents run [OPTIONS] [PATH] COMMAND [ARGS]...                                                                                                                           
                                                                                                                                                                                     
 Run the Agent <span class="hljs-keyword">in</span> the CLI                                                                                                                                                            
                                                                                                                                                                                     
                                                                                                                                                                                     
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│   path      [PATH]  Path to a <span class="hljs-built_in">local</span> folder containing an agent.json file or a built-in agent stored <span class="hljs-keyword">in</span> the <span class="hljs-string">&#x27;tiny-agents/tiny-agents&#x27;</span> Hugging Face dataset                         │
│                     (https://huggingface.co/datasets/tiny-agents/tiny-agents)                                                                                                     │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --<span class="hljs-built_in">help</span>          Show this message and <span class="hljs-built_in">exit</span>.                                                                                                                                       │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
`,wrap:!1}}),ll=new o({props:{title:"Custom Agents",local:"custom-agents",headingTag:"h3"}}),Ul=new C({props:{code:"JTdCJTBBJTA5JTIybW9kZWwlMjIlM0ElMjAlMjJRd2VuJTJGUXdlbjIuNS03MkItSW5zdHJ1Y3QlMjIlMkMlMEElMDklMjJwcm92aWRlciUyMiUzQSUyMCUyMm5lYml1cyUyMiUyQyUwQSUwOSUyMnNlcnZlcnMlMjIlM0ElMjAlNUIlMEElMDklMDklN0IlMEElMDklMDklMDklMjJ0eXBlJTIyJTNBJTIwJTIyc3RkaW8lMjIlMkMlMEElMDklMDklMDklMjJjb21tYW5kJTIyJTNBJTIwJTIybnB4JTIyJTJDJTBBJTA5JTA5JTA5JTIyYXJncyUyMiUzQSUyMCU1QiUyMiU0MHBsYXl3cmlnaHQlMkZtY3AlNDBsYXRlc3QlMjIlNUQlMEElMDklMDklN0QlMEElMDklNUQlMEElN0Q=",highlighted:`<span class="hljs-punctuation">{</span>
	<span class="hljs-attr">&quot;model&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Qwen/Qwen2.5-72B-Instruct&quot;</span><span class="hljs-punctuation">,</span>
	<span class="hljs-attr">&quot;provider&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;nebius&quot;</span><span class="hljs-punctuation">,</span>
	<span class="hljs-attr">&quot;servers&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
		<span class="hljs-punctuation">{</span>
			<span class="hljs-attr">&quot;type&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;stdio&quot;</span><span class="hljs-punctuation">,</span>
			<span class="hljs-attr">&quot;command&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;npx&quot;</span><span class="hljs-punctuation">,</span>
			<span class="hljs-attr">&quot;args&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;@playwright/mcp@latest&quot;</span><span class="hljs-punctuation">]</span>
		<span class="hljs-punctuation">}</span>
	<span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span>`,wrap:!1}}),Jl=new C({props:{code:"JTdCJTBBJTA5JTIybW9kZWwlMjIlM0ElMjAlMjJRd2VuJTJGUXdlbjMtMzJCJTIyJTJDJTBBJTA5JTIyZW5kcG9pbnRVcmwlMjIlM0ElMjAlMjJodHRwJTNBJTJGJTJGbG9jYWxob3N0JTNBMTIzNCUyRnYxJTIyJTJDJTBBJTA5JTIyc2VydmVycyUyMiUzQSUyMCU1QiUwQSUwOSUwOSU3QiUwQSUwOSUwOSUwOSUyMnR5cGUlMjIlM0ElMjAlMjJzdGRpbyUyMiUyQyUwQSUwOSUwOSUwOSUyMmNvbW1hbmQlMjIlM0ElMjAlMjJucHglMjIlMkMlMEElMDklMDklMDklMjJhcmdzJTIyJTNBJTIwJTVCJTIyJTQwcGxheXdyaWdodCUyRm1jcCU0MGxhdGVzdCUyMiU1RCUwQSUwOSUwOSU3RCUwQSUwOSU1RCUwQSU3RCUwQQ==",highlighted:`<span class="hljs-punctuation">{</span>
	<span class="hljs-attr">&quot;model&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Qwen/Qwen3-32B&quot;</span><span class="hljs-punctuation">,</span>
	<span class="hljs-attr">&quot;endpointUrl&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;http://localhost:1234/v1&quot;</span><span class="hljs-punctuation">,</span>
	<span class="hljs-attr">&quot;servers&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
		<span class="hljs-punctuation">{</span>
			<span class="hljs-attr">&quot;type&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;stdio&quot;</span><span class="hljs-punctuation">,</span>
			<span class="hljs-attr">&quot;command&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;npx&quot;</span><span class="hljs-punctuation">,</span>
			<span class="hljs-attr">&quot;args&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;@playwright/mcp@latest&quot;</span><span class="hljs-punctuation">]</span>
		<span class="hljs-punctuation">}</span>
	<span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span>
`,wrap:!1}}),el=new o({props:{title:"Gradio MCP Server / Tools",local:"gradio-mcp-server--tools",headingTag:"h2"}}),yl=new C({props:{code:"JTIzJUMyJUEwcGlwJTIwaW5zdGFsbCUyMGdyYWRpbyUwQSUwQWltcG9ydCUyMGdyYWRpbyUyMGFzJTIwZ3IlMEElMEFkZWYlMjBnZW5lcmF0ZV9pbWFnZShwcm9tcHQlM0ElMjBzdHIpJTNBJTBBJTIwJTIwJTIwJTIyJTIyJTIyJTBBJTIwJTIwJTIwR2VuZXJhdGUlMjBhbiUyMGltYWdlJTIwYmFzZWQlMjBvbiUyMGElMjB0ZXh0JTIwcHJvbXB0JTBBJTIwJTIwJTIwJTBBJTIwJTIwJTIwQXJncyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMHByb21wdCUzQSUyMGElMjB0ZXh0JTIwc3RyaW5nJTIwZGVzY3JpYmluZyUyMHRoZSUyMGltYWdlJTIwdG8lMjBnZW5lcmF0ZSUwQSUyMCUyMCUyMCUyMiUyMiUyMiUwQSUyMCUyMCUyMHBhc3MlMEElMEFkZW1vJTIwJTNEJTIwZ3IuSW50ZXJmYWNlKCUwQSUyMCUyMCUyMCUyMGZuJTNEZ2VuZXJhdGVfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBpbnB1dHMlM0QlMjJ0ZXh0JTIyJTJDJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUzRCUyMmltYWdlJTIyJTJDJTBBJTIwJTIwJTIwJTIwdGl0bGUlM0QlMjJJbWFnZSUyMEdlbmVyYXRvciUyMiUwQSklMEElMEFkZW1vLmxhdW5jaChtY3Bfc2VydmVyJTNEVHJ1ZSk=",highlighted:`<span class="hljs-comment"># pip install gradio</span>

<span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr

<span class="hljs-keyword">def</span> <span class="hljs-title function_">generate_image</span>(<span class="hljs-params">prompt: <span class="hljs-built_in">str</span></span>):
   <span class="hljs-string">&quot;&quot;&quot;
   Generate an image based on a text prompt
   
   Args:
       prompt: a text string describing the image to generate
   &quot;&quot;&quot;</span>
   <span class="hljs-keyword">pass</span>

demo = gr.Interface(
    fn=generate_image,
    inputs=<span class="hljs-string">&quot;text&quot;</span>,
    outputs=<span class="hljs-string">&quot;image&quot;</span>,
    title=<span class="hljs-string">&quot;Image Generator&quot;</span>
)

demo.launch(mcp_server=<span class="hljs-literal">True</span>)`,wrap:!1}}),jl=new C({props:{code:"JTdCJTBBJTIwJTIwJTIybWNwU2VydmVycyUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMmdyYWRpbyUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMnVybCUyMiUzQSUyMCUyMmh0dHAlM0ElMkYlMkZ5b3VyLXNlcnZlciUzQXBvcnQlMkZncmFkaW9fYXBpJTJGbWNwJTJGc3NlJTIyJTBBJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTdEJTBBJTdE",highlighted:`<span class="hljs-punctuation">{</span>
  <span class="hljs-attr">&quot;mcpServers&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
    <span class="hljs-attr">&quot;gradio&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
      <span class="hljs-attr">&quot;url&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;http://your-server:port/gradio_api/mcp/sse&quot;</span>
    <span class="hljs-punctuation">}</span>
  <span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>`,wrap:!1}}),Al=new o({props:{title:"smolagents",local:"smolagents",headingTag:"h2"}}),pl=new C({props:{code:"c21vbGFnZW50JTIwJTIyUGxhbiUyMGElMjB0cmlwJTIwdG8lMjBUb2t5byUyQyUyMEt5b3RvJTIwYW5kJTIwT3Nha2ElMjBiZXR3ZWVuJTIwTWFyJTIwMjglMjBhbmQlMjBBcHIlMjA3LiUyMiUyMCU1QyUwQS0tbW9kZWwtdHlwZSUyMCUyMkluZmVyZW5jZUNsaWVudE1vZGVsJTIyJTIwJTVDJTBBLS1tb2RlbC1pZCUyMCUyMlF3ZW4lMkZRd2VuMi41LUNvZGVyLTMyQi1JbnN0cnVjdCUyMiUyMCU1QyUwQS0taW1wb3J0cyUyMCUyMnBhbmRhcyUyMG51bXB5JTIyJTIwJTVDJTBBLS10b29scyUyMCUyMndlYl9zZWFyY2glMjI=",highlighted:`smolagent <span class="hljs-string">&quot;Plan a trip to Tokyo, Kyoto and Osaka between Mar 28 and Apr 7.&quot;</span> \\
--model-type <span class="hljs-string">&quot;InferenceClientModel&quot;</span> \\
--model-id <span class="hljs-string">&quot;Qwen/Qwen2.5-Coder-32B-Instruct&quot;</span> \\
--imports <span class="hljs-string">&quot;pandas numpy&quot;</span> \\
--tools <span class="hljs-string">&quot;web_search&quot;</span>`,wrap:!1}}),cl=new C({props:{code:"JTIzJTIwcGlwJTIwaW5zdGFsbCUyMC0tdXBncmFkZSUyMHNtb2xhZ2VudHMlMjBtY3AlMEFmcm9tJTIwc21vbGFnZW50cyUyMGltcG9ydCUyME1DUENsaWVudCUyQyUyMENvZGVBZ2VudCUwQWZyb20lMjBtY3AlMjBpbXBvcnQlMjBTdGRpb1NlcnZlclBhcmFtZXRlcnMlMEFpbXBvcnQlMjBvcyUwQSUwQXNlcnZlcl9wYXJhbWV0ZXJzJTIwJTNEJTIwU3RkaW9TZXJ2ZXJQYXJhbWV0ZXJzKCUwQSUyMCUyMCUyMCUyMGNvbW1hbmQlM0QlMjJ1dnglMjIlMkMlMjAlMjAlMjMlMjBVc2luZyUyMHV2eCUyMGVuc3VyZXMlMjBkZXBlbmRlbmNpZXMlMjBhcmUlMjBhdmFpbGFibGUlMEElMjAlMjAlMjAlMjBhcmdzJTNEJTVCJTIyLS1xdWlldCUyMiUyQyUyMCUyMnB1Ym1lZG1jcCU0MDAuMS4zJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZW52JTNEJTdCJTIyVVZfUFlUSE9OJTIyJTNBJTIwJTIyMy4xMiUyMiUyQyUyMCoqb3MuZW52aXJvbiU3RCUyQyUwQSklMEElMEF3aXRoJTIwTUNQQ2xpZW50KHNlcnZlcl9wYXJhbWV0ZXJzKSUyMGFzJTIwdG9vbHMlM0ElMEElMjAlMjAlMjAlMjBhZ2VudCUyMCUzRCUyMENvZGVBZ2VudCh0b29scyUzRHRvb2xzJTJDJTIwbW9kZWwlM0Rtb2RlbCUyQyUyMGFkZF9iYXNlX3Rvb2xzJTNEVHJ1ZSklMEElMjAlMjAlMjAlMjBhZ2VudC5ydW4oJTIyUGxlYXNlJTIwZmluZCUyMHRoZSUyMGxhdGVzdCUyMHJlc2VhcmNoJTIwb24lMjBDT1ZJRC0xOSUyMHRyZWF0bWVudC4lMjIp",highlighted:`<span class="hljs-comment"># pip install --upgrade smolagents mcp</span>
<span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> MCPClient, CodeAgent
<span class="hljs-keyword">from</span> mcp <span class="hljs-keyword">import</span> StdioServerParameters
<span class="hljs-keyword">import</span> os

server_parameters = StdioServerParameters(
    command=<span class="hljs-string">&quot;uvx&quot;</span>,  <span class="hljs-comment"># Using uvx ensures dependencies are available</span>
    args=[<span class="hljs-string">&quot;--quiet&quot;</span>, <span class="hljs-string">&quot;pubmedmcp@0.1.3&quot;</span>],
    env={<span class="hljs-string">&quot;UV_PYTHON&quot;</span>: <span class="hljs-string">&quot;3.12&quot;</span>, **os.environ},
)

<span class="hljs-keyword">with</span> MCPClient(server_parameters) <span class="hljs-keyword">as</span> tools:
    agent = CodeAgent(tools=tools, model=model, add_base_tools=<span class="hljs-literal">True</span>)
    agent.run(<span class="hljs-string">&quot;Please find the latest research on COVID-19 treatment.&quot;</span>)`,wrap:!1}}),kl=new RU({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/agents.md"}}),{c(){g=e("meta"),Ol=J(),hl=e("p"),ml=J(),y(u.$$.fragment),fl=J(),y(c.$$.fragment),Ql=J(),r=e("p"),r.textContent=$M,Vl=J(),k=e("ul"),k.innerHTML=BM,Rl=J(),y(h.$$.fragment),Fl=J(),d=e("p"),d.innerHTML=HM,Nl=J(),O=e("p"),O.textContent=SM,bl=J(),m=e("ul"),m.innerHTML=ZM,Dl=J(),y(f.$$.fragment),vl=J(),Q=e("p"),Q.innerHTML=EM,$l=J(),p=e("blockquote"),p.innerHTML=xM,Bl=J(),y(V.$$.fragment),Hl=J(),R=e("p"),R.innerHTML=GM,Sl=J(),F=e("p"),F.innerHTML=PM,Zl=J(),y(N.$$.fragment),El=J(),b=e("p"),b.innerHTML=qM,xl=J(),D=e("p"),D.innerHTML=WM,Gl=J(),v=e("p"),v.textContent=LM,Pl=J(),y($.$$.fragment),ql=J(),B=e("p"),B.textContent=_M,Wl=J(),y(H.$$.fragment),Ll=J(),S=e("p"),S.innerHTML=zM,_l=J(),Z=e("p"),Z.innerHTML=YM,zl=J(),E=e("p"),E.innerHTML=XM,Yl=J(),y(x.$$.fragment),Xl=J(),G=e("p"),G.innerHTML=KM,Kl=J(),P=e("p"),P.innerHTML=lU,lM=J(),q=e("p"),q.textContent=MU,MM=J(),y(W.$$.fragment),UM=J(),L=e("p"),L.textContent=UU,TM=J(),y(_.$$.fragment),JM=J(),z=e("p"),z.textContent=TU,tM=J(),Y=e("p"),Y.innerHTML=JU,eM=J(),X=e("p"),X.innerHTML=tU,sM=J(),K=e("p"),K.innerHTML=eU,nM=J(),y(ll.$$.fragment),yM=J(),Ml=e("p"),Ml.innerHTML=sU,aM=J(),y(Ul.$$.fragment),iM=J(),Tl=e("p"),Tl.innerHTML=nU,jM=J(),y(Jl.$$.fragment),wM=J(),tl=e("p"),tl.innerHTML=yU,AM=J(),I=e("blockquote"),I.innerHTML=aU,CM=J(),y(el.$$.fragment),gM=J(),sl=e("p"),sl.textContent=iU,oM=J(),nl=e("p"),nl.innerHTML=jU,pM=J(),y(yl.$$.fragment),IM=J(),al=e("p"),al.innerHTML=wU,uM=J(),il=e("p"),il.textContent=AU,cM=J(),y(jl.$$.fragment),rM=J(),wl=e("p"),wl.innerHTML=CU,kM=J(),y(Al.$$.fragment),hM=J(),Cl=e("p"),Cl.innerHTML=gU,dM=J(),gl=e("p"),gl.innerHTML=oU,OM=J(),ol=e("p"),ol.innerHTML=pU,mM=J(),y(pl.$$.fragment),fM=J(),Il=e("p"),Il.innerHTML=IU,QM=J(),ul=e("p"),ul.textContent=uU,VM=J(),y(cl.$$.fragment),RM=J(),rl=e("p"),rl.innerHTML=cU,FM=J(),y(kl.$$.fragment),NM=J(),dl=e("p"),this.h()},l(l){const M=fU("svelte-u9bgzb",document.head);g=s(M,"META",{name:!0,content:!0}),M.forEach(U),Ol=t(l),hl=s(l,"P",{}),rU(hl).forEach(U),ml=t(l),a(u.$$.fragment,l),fl=t(l),a(c.$$.fragment,l),Ql=t(l),r=s(l,"P",{"data-svelte-h":!0}),n(r)!=="svelte-uybl9t"&&(r.textContent=$M),Vl=t(l),k=s(l,"UL",{"data-svelte-h":!0}),n(k)!=="svelte-fge09v"&&(k.innerHTML=BM),Rl=t(l),a(h.$$.fragment,l),Fl=t(l),d=s(l,"P",{"data-svelte-h":!0}),n(d)!=="svelte-fsmwlo"&&(d.innerHTML=HM),Nl=t(l),O=s(l,"P",{"data-svelte-h":!0}),n(O)!=="svelte-1usc2x6"&&(O.textContent=SM),bl=t(l),m=s(l,"UL",{"data-svelte-h":!0}),n(m)!=="svelte-1ycpmy7"&&(m.innerHTML=ZM),Dl=t(l),a(f.$$.fragment,l),vl=t(l),Q=s(l,"P",{"data-svelte-h":!0}),n(Q)!=="svelte-1xo0uui"&&(Q.innerHTML=EM),$l=t(l),p=s(l,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),n(p)!=="svelte-1xpbjvq"&&(p.innerHTML=xM),Bl=t(l),a(V.$$.fragment,l),Hl=t(l),R=s(l,"P",{"data-svelte-h":!0}),n(R)!=="svelte-lm7ugw"&&(R.innerHTML=GM),Sl=t(l),F=s(l,"P",{"data-svelte-h":!0}),n(F)!=="svelte-12fep30"&&(F.innerHTML=PM),Zl=t(l),a(N.$$.fragment,l),El=t(l),b=s(l,"P",{"data-svelte-h":!0}),n(b)!=="svelte-170yil8"&&(b.innerHTML=qM),xl=t(l),D=s(l,"P",{"data-svelte-h":!0}),n(D)!=="svelte-qtgy0c"&&(D.innerHTML=WM),Gl=t(l),v=s(l,"P",{"data-svelte-h":!0}),n(v)!=="svelte-1w4rzaq"&&(v.textContent=LM),Pl=t(l),a($.$$.fragment,l),ql=t(l),B=s(l,"P",{"data-svelte-h":!0}),n(B)!=="svelte-16su98k"&&(B.textContent=_M),Wl=t(l),a(H.$$.fragment,l),Ll=t(l),S=s(l,"P",{"data-svelte-h":!0}),n(S)!=="svelte-1cmjtr9"&&(S.innerHTML=zM),_l=t(l),Z=s(l,"P",{"data-svelte-h":!0}),n(Z)!=="svelte-m1ruvs"&&(Z.innerHTML=YM),zl=t(l),E=s(l,"P",{"data-svelte-h":!0}),n(E)!=="svelte-bbaapj"&&(E.innerHTML=XM),Yl=t(l),a(x.$$.fragment,l),Xl=t(l),G=s(l,"P",{"data-svelte-h":!0}),n(G)!=="svelte-37noht"&&(G.innerHTML=KM),Kl=t(l),P=s(l,"P",{"data-svelte-h":!0}),n(P)!=="svelte-1nllubw"&&(P.innerHTML=lU),lM=t(l),q=s(l,"P",{"data-svelte-h":!0}),n(q)!=="svelte-afwxt0"&&(q.textContent=MU),MM=t(l),a(W.$$.fragment,l),UM=t(l),L=s(l,"P",{"data-svelte-h":!0}),n(L)!=="svelte-e7kx1l"&&(L.textContent=UU),TM=t(l),a(_.$$.fragment,l),JM=t(l),z=s(l,"P",{"data-svelte-h":!0}),n(z)!=="svelte-1qfxace"&&(z.textContent=TU),tM=t(l),Y=s(l,"P",{"data-svelte-h":!0}),n(Y)!=="svelte-1x3whta"&&(Y.innerHTML=JU),eM=t(l),X=s(l,"P",{"data-svelte-h":!0}),n(X)!=="svelte-d0b3nb"&&(X.innerHTML=tU),sM=t(l),K=s(l,"P",{"data-svelte-h":!0}),n(K)!=="svelte-vm7dnh"&&(K.innerHTML=eU),nM=t(l),a(ll.$$.fragment,l),yM=t(l),Ml=s(l,"P",{"data-svelte-h":!0}),n(Ml)!=="svelte-ovi071"&&(Ml.innerHTML=sU),aM=t(l),a(Ul.$$.fragment,l),iM=t(l),Tl=s(l,"P",{"data-svelte-h":!0}),n(Tl)!=="svelte-1v3djgc"&&(Tl.innerHTML=nU),jM=t(l),a(Jl.$$.fragment,l),wM=t(l),tl=s(l,"P",{"data-svelte-h":!0}),n(tl)!=="svelte-1mi2sgf"&&(tl.innerHTML=yU),AM=t(l),I=s(l,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),n(I)!=="svelte-fs4k72"&&(I.innerHTML=aU),CM=t(l),a(el.$$.fragment,l),gM=t(l),sl=s(l,"P",{"data-svelte-h":!0}),n(sl)!=="svelte-98db42"&&(sl.textContent=iU),oM=t(l),nl=s(l,"P",{"data-svelte-h":!0}),n(nl)!=="svelte-1i1xz1q"&&(nl.innerHTML=jU),pM=t(l),a(yl.$$.fragment,l),IM=t(l),al=s(l,"P",{"data-svelte-h":!0}),n(al)!=="svelte-7c34et"&&(al.innerHTML=wU),uM=t(l),il=s(l,"P",{"data-svelte-h":!0}),n(il)!=="svelte-jrre7u"&&(il.textContent=AU),cM=t(l),a(jl.$$.fragment,l),rM=t(l),wl=s(l,"P",{"data-svelte-h":!0}),n(wl)!=="svelte-17ayo9g"&&(wl.innerHTML=CU),kM=t(l),a(Al.$$.fragment,l),hM=t(l),Cl=s(l,"P",{"data-svelte-h":!0}),n(Cl)!=="svelte-1l4edi5"&&(Cl.innerHTML=gU),dM=t(l),gl=s(l,"P",{"data-svelte-h":!0}),n(gl)!=="svelte-6cz8i9"&&(gl.innerHTML=oU),OM=t(l),ol=s(l,"P",{"data-svelte-h":!0}),n(ol)!=="svelte-18u3l69"&&(ol.innerHTML=pU),mM=t(l),a(pl.$$.fragment,l),fM=t(l),Il=s(l,"P",{"data-svelte-h":!0}),n(Il)!=="svelte-1296ipl"&&(Il.innerHTML=IU),QM=t(l),ul=s(l,"P",{"data-svelte-h":!0}),n(ul)!=="svelte-1dgx75v"&&(ul.textContent=uU),VM=t(l),a(cl.$$.fragment,l),RM=t(l),rl=s(l,"P",{"data-svelte-h":!0}),n(rl)!=="svelte-1bky1ee"&&(rl.innerHTML=cU),FM=t(l),a(kl.$$.fragment,l),NM=t(l),dl=s(l,"P",{}),rU(dl).forEach(U),this.h()},h(){DM(g,"name","hf:doc:metadata"),DM(g,"content",NU),DM(p,"class","warning"),DM(I,"class","tip")},m(l,M){QU(document.head,g),T(l,Ol,M),T(l,hl,M),T(l,ml,M),i(u,l,M),T(l,fl,M),i(c,l,M),T(l,Ql,M),T(l,r,M),T(l,Vl,M),T(l,k,M),T(l,Rl,M),i(h,l,M),T(l,Fl,M),T(l,d,M),T(l,Nl,M),T(l,O,M),T(l,bl,M),T(l,m,M),T(l,Dl,M),i(f,l,M),T(l,vl,M),T(l,Q,M),T(l,$l,M),T(l,p,M),T(l,Bl,M),i(V,l,M),T(l,Hl,M),T(l,R,M),T(l,Sl,M),T(l,F,M),T(l,Zl,M),i(N,l,M),T(l,El,M),T(l,b,M),T(l,xl,M),T(l,D,M),T(l,Gl,M),T(l,v,M),T(l,Pl,M),i($,l,M),T(l,ql,M),T(l,B,M),T(l,Wl,M),i(H,l,M),T(l,Ll,M),T(l,S,M),T(l,_l,M),T(l,Z,M),T(l,zl,M),T(l,E,M),T(l,Yl,M),i(x,l,M),T(l,Xl,M),T(l,G,M),T(l,Kl,M),T(l,P,M),T(l,lM,M),T(l,q,M),T(l,MM,M),i(W,l,M),T(l,UM,M),T(l,L,M),T(l,TM,M),i(_,l,M),T(l,JM,M),T(l,z,M),T(l,tM,M),T(l,Y,M),T(l,eM,M),T(l,X,M),T(l,sM,M),T(l,K,M),T(l,nM,M),i(ll,l,M),T(l,yM,M),T(l,Ml,M),T(l,aM,M),i(Ul,l,M),T(l,iM,M),T(l,Tl,M),T(l,jM,M),i(Jl,l,M),T(l,wM,M),T(l,tl,M),T(l,AM,M),T(l,I,M),T(l,CM,M),i(el,l,M),T(l,gM,M),T(l,sl,M),T(l,oM,M),T(l,nl,M),T(l,pM,M),i(yl,l,M),T(l,IM,M),T(l,al,M),T(l,uM,M),T(l,il,M),T(l,cM,M),i(jl,l,M),T(l,rM,M),T(l,wl,M),T(l,kM,M),i(Al,l,M),T(l,hM,M),T(l,Cl,M),T(l,dM,M),T(l,gl,M),T(l,OM,M),T(l,ol,M),T(l,mM,M),i(pl,l,M),T(l,fM,M),T(l,Il,M),T(l,QM,M),T(l,ul,M),T(l,VM,M),i(cl,l,M),T(l,RM,M),T(l,rl,M),T(l,FM,M),i(kl,l,M),T(l,NM,M),T(l,dl,M),bM=!0},p:hU,i(l){bM||(j(u.$$.fragment,l),j(c.$$.fragment,l),j(h.$$.fragment,l),j(f.$$.fragment,l),j(V.$$.fragment,l),j(N.$$.fragment,l),j($.$$.fragment,l),j(H.$$.fragment,l),j(x.$$.fragment,l),j(W.$$.fragment,l),j(_.$$.fragment,l),j(ll.$$.fragment,l),j(Ul.$$.fragment,l),j(Jl.$$.fragment,l),j(el.$$.fragment,l),j(yl.$$.fragment,l),j(jl.$$.fragment,l),j(Al.$$.fragment,l),j(pl.$$.fragment,l),j(cl.$$.fragment,l),j(kl.$$.fragment,l),bM=!0)},o(l){w(u.$$.fragment,l),w(c.$$.fragment,l),w(h.$$.fragment,l),w(f.$$.fragment,l),w(V.$$.fragment,l),w(N.$$.fragment,l),w($.$$.fragment,l),w(H.$$.fragment,l),w(x.$$.fragment,l),w(W.$$.fragment,l),w(_.$$.fragment,l),w(ll.$$.fragment,l),w(Ul.$$.fragment,l),w(Jl.$$.fragment,l),w(el.$$.fragment,l),w(yl.$$.fragment,l),w(jl.$$.fragment,l),w(Al.$$.fragment,l),w(pl.$$.fragment,l),w(cl.$$.fragment,l),w(kl.$$.fragment,l),bM=!1},d(l){l&&(U(Ol),U(hl),U(ml),U(fl),U(Ql),U(r),U(Vl),U(k),U(Rl),U(Fl),U(d),U(Nl),U(O),U(bl),U(m),U(Dl),U(vl),U(Q),U($l),U(p),U(Bl),U(Hl),U(R),U(Sl),U(F),U(Zl),U(El),U(b),U(xl),U(D),U(Gl),U(v),U(Pl),U(ql),U(B),U(Wl),U(Ll),U(S),U(_l),U(Z),U(zl),U(E),U(Yl),U(Xl),U(G),U(Kl),U(P),U(lM),U(q),U(MM),U(UM),U(L),U(TM),U(JM),U(z),U(tM),U(Y),U(eM),U(X),U(sM),U(K),U(nM),U(yM),U(Ml),U(aM),U(iM),U(Tl),U(jM),U(wM),U(tl),U(AM),U(I),U(CM),U(gM),U(sl),U(oM),U(nl),U(pM),U(IM),U(al),U(uM),U(il),U(cM),U(rM),U(wl),U(kM),U(hM),U(Cl),U(dM),U(gl),U(OM),U(ol),U(mM),U(fM),U(Il),U(QM),U(ul),U(VM),U(RM),U(rl),U(FM),U(NM),U(dl)),U(g),A(u,l),A(c,l),A(h,l),A(f,l),A(V,l),A(N,l),A($,l),A(H,l),A(x,l),A(W,l),A(_,l),A(ll,l),A(Ul,l),A(Jl,l),A(el,l),A(yl,l),A(jl,l),A(Al,l),A(pl,l),A(cl,l),A(kl,l)}}}const NU='{"title":"Agents on the Hub","local":"agents-on-the-hub","sections":[{"title":"HF MCP Server","local":"hf-mcp-server","sections":[{"title":"Getting Started","local":"getting-started","sections":[],"depth":4}],"depth":2},{"title":"tiny-agents (JS and Python)","local":"tiny-agents-js-and-python","sections":[{"title":"@huggingface/tiny-agents (JS)","local":"huggingfacetiny-agents-js","sections":[],"depth":3},{"title":"huggingface_hub (Python)","local":"huggingfacehub-python","sections":[],"depth":3},{"title":"Custom Agents","local":"custom-agents","sections":[],"depth":3}],"depth":2},{"title":"Gradio MCP Server / Tools","local":"gradio-mcp-server--tools","sections":[],"depth":2},{"title":"smolagents","local":"smolagents","sections":[],"depth":2}],"depth":1}';function bU(vM){return dU(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class SU extends OU{constructor(g){super(),mU(this,g,bU,FU,kU,{})}}export{SU as component};
