import{s as kU,o as hU,n as rU}from"../chunks/scheduler.12fdeddc.js";import{S as dU,i as mU,g as e,s as J,r as a,A as OU,h as s,f as U,c as t,j as IU,u as j,x as n,k as uU,y as fU,a as T,v as w,d as i,t as A,w as C}from"../chunks/index.88dae322.js";import{T as cU}from"../chunks/Tip.64e66512.js";import{C as p}from"../chunks/CodeBlock.8e54a086.js";import{H as I,E as QU}from"../chunks/getInferenceSnippets.00466244.js";function VU(ml){let y,o="This feature is experimental ⚗️ and will continue to evolve.";return{c(){y=e("p"),y.textContent=o},l(g){y=s(g,"P",{"data-svelte-h":!0}),n(y)!=="svelte-pryo4y"&&(y.textContent=o)},m(g,u){T(g,y,u)},p:rU,d(g){g&&U(y)}}}function RU(ml){let y,o='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.';return{c(){y=e("p"),y.innerHTML=o},l(g){y=s(g,"P",{"data-svelte-h":!0}),n(y)!=="svelte-1kij619"&&(y.innerHTML=o)},m(g,u){T(g,y,u)},p:rU,d(g){g&&U(y)}}}function FU(ml){let y,o,g,u,k,fl,h,bM="This page compiles all the libraries and tools Hugging Face offers for agentic workflows:",Ql,d,DM="<li><code>HF MCP Server</code>: 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>",Vl,m,Rl,O,$M="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.",Fl,f,vM="With the HF MCP Server, you can enhance your AI assistant’s capabilities by connecting directly to the Hub’s ecosystem. It comes with:",Nl,Q,BM='<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>',bl,V,Dl,R,HM='Visit <a href="https://huggingface.co/settings/mcp" rel="nofollow">huggingface.co/settings/mcp</a> to configure your MCP client and get started.',$l,c,vl,F,Bl,N,ZM='NEW: tiny-agents now supports <a href="https://agents.md/" rel="nofollow">AGENTS.md</a> standard. 🥳',Hl,b,SM="<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,D,Sl,$,EM="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.",El,v,GM="<strong>Getting Started</strong>",Gl,B,xM="First, you need to install the package:",xl,H,Pl,Z,PM="Then, you can your agent:",Wl,S,ql,E,WM='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.',Ll,G,qM=`<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.`,_l,x,LM='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,P,zl,W,_M='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.',Xl,q,YM="<strong>Getting started</strong>",Kl,L,zM="Install the latest version with MCP support:",lM,_,MM,Y,XM="Then, you can run your agent:",UM,z,TM,X,KM="The CLI pulls the config, connects to its MCP servers, prints the available tools, and waits for your prompt.",JM,K,lU="<strong>Advanced Usage</strong>",tM,ll,MU="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.",eM,Ml,UU='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>.',sM,Ul,nM,Tl,TU=`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`,yM,Jl,aM,tl,JU='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,el,wM,sl,tU="Optionally, add a <code>PROMPT.md</code> to customize the system prompt.",iM,r,AM,nl,CM,yl,eU="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.",gM,al,sU="To make a Gradio application an MCP server, simply pass in <code>mcp_server=True</code> when launching your demo like follows.",oM,jl,pM,wl,nU="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.",IM,il,yU="Lastly, add this to the settings of the MCP Client of your choice (e.g. Cursor).",uM,Al,cM,Cl,aU='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>.',rM,gl,kM,ol,jU='<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.',hM,pl,wU=`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>.`,dM,Il,iU="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,ul,OM,cl,AU='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>.',fM,rl,CU="smolagents also supports MCP servers as tools, as follows:",QM,kl,VM,hl,gU='Learn more <a href="https://huggingface.co/docs/smolagents/tutorials/tools#use-mcp-tools-with-mcpclient-directly" rel="nofollow">in the documentation</a>.',RM,dl,FM,Ol,NM;return k=new I({props:{title:"Agents on the Hub",local:"agents-on-the-hub",headingTag:"h1"}}),m=new I({props:{title:"HF MCP Server",local:"hf-mcp-server",headingTag:"h2"}}),V=new I({props:{title:"Getting Started",local:"getting-started",headingTag:"h4"}}),c=new cU({props:{warning:!0,$$slots:{default:[VU]},$$scope:{ctx:ml}}}),F=new I({props:{title:"tiny-agents (JS and Python)",local:"tiny-agents-js-and-python",headingTag:"h2"}}),D=new I({props:{title:"@huggingface/tiny-agents (JS)",local:"huggingfacetiny-agents-js",headingTag:"h3"}}),H=new p({props:{code:"bnBtJTIwaW5zdGFsbCUyMCU0MGh1Z2dpbmdmYWNlJTJGdGlueS1hZ2VudHMlMEElMjMlMjBvciUwQXBucG0lMjBhZGQlMjAlNDBodWdnaW5nZmFjZSUyRnRpbnktYWdlbnRz",highlighted:`npm install @huggingface/tiny-agents
<span class="hljs-comment"># or</span>
pnpm add @huggingface/tiny-agents`,wrap:!1}}),S=new p({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}}),P=new I({props:{title:"huggingface_hub (Python)",local:"huggingfacehub-python",headingTag:"h3"}}),_=new p({props:{code:"cGlwJTIwaW5zdGFsbCUyMCUyMmh1Z2dpbmdmYWNlX2h1YiU1Qm1jcCU1RCUzRSUzRDAuMzIuMiUyMg==",highlighted:'pip install <span class="hljs-string">&quot;huggingface_hub[mcp]&gt;=0.32.2&quot;</span>',wrap:!1}}),z=new p({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}}),Ul=new I({props:{title:"Custom Agents",local:"custom-agents",headingTag:"h3"}}),Jl=new p({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}}),el=new p({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}}),r=new cU({props:{$$slots:{default:[RU]},$$scope:{ctx:ml}}}),nl=new I({props:{title:"Gradio MCP Server / Tools",local:"gradio-mcp-server--tools",headingTag:"h2"}}),jl=new p({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}}),Al=new p({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}}),gl=new I({props:{title:"smolagents",local:"smolagents",headingTag:"h2"}}),ul=new p({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}}),kl=new p({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}}),dl=new QU({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/agents.md"}}),{c(){y=e("meta"),o=J(),g=e("p"),u=J(),a(k.$$.fragment),fl=J(),h=e("p"),h.textContent=bM,Ql=J(),d=e("ul"),d.innerHTML=DM,Vl=J(),a(m.$$.fragment),Rl=J(),O=e("p"),O.innerHTML=$M,Fl=J(),f=e("p"),f.textContent=vM,Nl=J(),Q=e("ul"),Q.innerHTML=BM,bl=J(),a(V.$$.fragment),Dl=J(),R=e("p"),R.innerHTML=HM,$l=J(),a(c.$$.fragment),vl=J(),a(F.$$.fragment),Bl=J(),N=e("p"),N.innerHTML=ZM,Hl=J(),b=e("p"),b.innerHTML=SM,Zl=J(),a(D.$$.fragment),Sl=J(),$=e("p"),$.innerHTML=EM,El=J(),v=e("p"),v.innerHTML=GM,Gl=J(),B=e("p"),B.textContent=xM,xl=J(),a(H.$$.fragment),Pl=J(),Z=e("p"),Z.textContent=PM,Wl=J(),a(S.$$.fragment),ql=J(),E=e("p"),E.innerHTML=WM,Ll=J(),G=e("p"),G.innerHTML=qM,_l=J(),x=e("p"),x.innerHTML=LM,Yl=J(),a(P.$$.fragment),zl=J(),W=e("p"),W.innerHTML=_M,Xl=J(),q=e("p"),q.innerHTML=YM,Kl=J(),L=e("p"),L.textContent=zM,lM=J(),a(_.$$.fragment),MM=J(),Y=e("p"),Y.textContent=XM,UM=J(),a(z.$$.fragment),TM=J(),X=e("p"),X.textContent=KM,JM=J(),K=e("p"),K.innerHTML=lU,tM=J(),ll=e("p"),ll.innerHTML=MU,eM=J(),Ml=e("p"),Ml.innerHTML=UU,sM=J(),a(Ul.$$.fragment),nM=J(),Tl=e("p"),Tl.innerHTML=TU,yM=J(),a(Jl.$$.fragment),aM=J(),tl=e("p"),tl.innerHTML=JU,jM=J(),a(el.$$.fragment),wM=J(),sl=e("p"),sl.innerHTML=tU,iM=J(),a(r.$$.fragment),AM=J(),a(nl.$$.fragment),CM=J(),yl=e("p"),yl.textContent=eU,gM=J(),al=e("p"),al.innerHTML=sU,oM=J(),a(jl.$$.fragment),pM=J(),wl=e("p"),wl.innerHTML=nU,IM=J(),il=e("p"),il.textContent=yU,uM=J(),a(Al.$$.fragment),cM=J(),Cl=e("p"),Cl.innerHTML=aU,rM=J(),a(gl.$$.fragment),kM=J(),ol=e("p"),ol.innerHTML=jU,hM=J(),pl=e("p"),pl.innerHTML=wU,dM=J(),Il=e("p"),Il.innerHTML=iU,mM=J(),a(ul.$$.fragment),OM=J(),cl=e("p"),cl.innerHTML=AU,fM=J(),rl=e("p"),rl.textContent=CU,QM=J(),a(kl.$$.fragment),VM=J(),hl=e("p"),hl.innerHTML=gU,RM=J(),a(dl.$$.fragment),FM=J(),Ol=e("p"),this.h()},l(l){const M=OU("svelte-u9bgzb",document.head);y=s(M,"META",{name:!0,content:!0}),M.forEach(U),o=t(l),g=s(l,"P",{}),IU(g).forEach(U),u=t(l),j(k.$$.fragment,l),fl=t(l),h=s(l,"P",{"data-svelte-h":!0}),n(h)!=="svelte-uybl9t"&&(h.textContent=bM),Ql=t(l),d=s(l,"UL",{"data-svelte-h":!0}),n(d)!=="svelte-tofbup"&&(d.innerHTML=DM),Vl=t(l),j(m.$$.fragment,l),Rl=t(l),O=s(l,"P",{"data-svelte-h":!0}),n(O)!=="svelte-fsmwlo"&&(O.innerHTML=$M),Fl=t(l),f=s(l,"P",{"data-svelte-h":!0}),n(f)!=="svelte-1usc2x6"&&(f.textContent=vM),Nl=t(l),Q=s(l,"UL",{"data-svelte-h":!0}),n(Q)!=="svelte-1ycpmy7"&&(Q.innerHTML=BM),bl=t(l),j(V.$$.fragment,l),Dl=t(l),R=s(l,"P",{"data-svelte-h":!0}),n(R)!=="svelte-utvcca"&&(R.innerHTML=HM),$l=t(l),j(c.$$.fragment,l),vl=t(l),j(F.$$.fragment,l),Bl=t(l),N=s(l,"P",{"data-svelte-h":!0}),n(N)!=="svelte-lm7ugw"&&(N.innerHTML=ZM),Hl=t(l),b=s(l,"P",{"data-svelte-h":!0}),n(b)!=="svelte-12fep30"&&(b.innerHTML=SM),Zl=t(l),j(D.$$.fragment,l),Sl=t(l),$=s(l,"P",{"data-svelte-h":!0}),n($)!=="svelte-170yil8"&&($.innerHTML=EM),El=t(l),v=s(l,"P",{"data-svelte-h":!0}),n(v)!=="svelte-qtgy0c"&&(v.innerHTML=GM),Gl=t(l),B=s(l,"P",{"data-svelte-h":!0}),n(B)!=="svelte-1w4rzaq"&&(B.textContent=xM),xl=t(l),j(H.$$.fragment,l),Pl=t(l),Z=s(l,"P",{"data-svelte-h":!0}),n(Z)!=="svelte-16su98k"&&(Z.textContent=PM),Wl=t(l),j(S.$$.fragment,l),ql=t(l),E=s(l,"P",{"data-svelte-h":!0}),n(E)!=="svelte-1cmjtr9"&&(E.innerHTML=WM),Ll=t(l),G=s(l,"P",{"data-svelte-h":!0}),n(G)!=="svelte-m1ruvs"&&(G.innerHTML=qM),_l=t(l),x=s(l,"P",{"data-svelte-h":!0}),n(x)!=="svelte-bbaapj"&&(x.innerHTML=LM),Yl=t(l),j(P.$$.fragment,l),zl=t(l),W=s(l,"P",{"data-svelte-h":!0}),n(W)!=="svelte-37noht"&&(W.innerHTML=_M),Xl=t(l),q=s(l,"P",{"data-svelte-h":!0}),n(q)!=="svelte-1nllubw"&&(q.innerHTML=YM),Kl=t(l),L=s(l,"P",{"data-svelte-h":!0}),n(L)!=="svelte-afwxt0"&&(L.textContent=zM),lM=t(l),j(_.$$.fragment,l),MM=t(l),Y=s(l,"P",{"data-svelte-h":!0}),n(Y)!=="svelte-e7kx1l"&&(Y.textContent=XM),UM=t(l),j(z.$$.fragment,l),TM=t(l),X=s(l,"P",{"data-svelte-h":!0}),n(X)!=="svelte-1qfxace"&&(X.textContent=KM),JM=t(l),K=s(l,"P",{"data-svelte-h":!0}),n(K)!=="svelte-1x3whta"&&(K.innerHTML=lU),tM=t(l),ll=s(l,"P",{"data-svelte-h":!0}),n(ll)!=="svelte-d0b3nb"&&(ll.innerHTML=MU),eM=t(l),Ml=s(l,"P",{"data-svelte-h":!0}),n(Ml)!=="svelte-vm7dnh"&&(Ml.innerHTML=UU),sM=t(l),j(Ul.$$.fragment,l),nM=t(l),Tl=s(l,"P",{"data-svelte-h":!0}),n(Tl)!=="svelte-ovi071"&&(Tl.innerHTML=TU),yM=t(l),j(Jl.$$.fragment,l),aM=t(l),tl=s(l,"P",{"data-svelte-h":!0}),n(tl)!=="svelte-1v3djgc"&&(tl.innerHTML=JU),jM=t(l),j(el.$$.fragment,l),wM=t(l),sl=s(l,"P",{"data-svelte-h":!0}),n(sl)!=="svelte-1mi2sgf"&&(sl.innerHTML=tU),iM=t(l),j(r.$$.fragment,l),AM=t(l),j(nl.$$.fragment,l),CM=t(l),yl=s(l,"P",{"data-svelte-h":!0}),n(yl)!=="svelte-98db42"&&(yl.textContent=eU),gM=t(l),al=s(l,"P",{"data-svelte-h":!0}),n(al)!=="svelte-1i1xz1q"&&(al.innerHTML=sU),oM=t(l),j(jl.$$.fragment,l),pM=t(l),wl=s(l,"P",{"data-svelte-h":!0}),n(wl)!=="svelte-7c34et"&&(wl.innerHTML=nU),IM=t(l),il=s(l,"P",{"data-svelte-h":!0}),n(il)!=="svelte-jrre7u"&&(il.textContent=yU),uM=t(l),j(Al.$$.fragment,l),cM=t(l),Cl=s(l,"P",{"data-svelte-h":!0}),n(Cl)!=="svelte-17ayo9g"&&(Cl.innerHTML=aU),rM=t(l),j(gl.$$.fragment,l),kM=t(l),ol=s(l,"P",{"data-svelte-h":!0}),n(ol)!=="svelte-1l4edi5"&&(ol.innerHTML=jU),hM=t(l),pl=s(l,"P",{"data-svelte-h":!0}),n(pl)!=="svelte-6cz8i9"&&(pl.innerHTML=wU),dM=t(l),Il=s(l,"P",{"data-svelte-h":!0}),n(Il)!=="svelte-18u3l69"&&(Il.innerHTML=iU),mM=t(l),j(ul.$$.fragment,l),OM=t(l),cl=s(l,"P",{"data-svelte-h":!0}),n(cl)!=="svelte-1296ipl"&&(cl.innerHTML=AU),fM=t(l),rl=s(l,"P",{"data-svelte-h":!0}),n(rl)!=="svelte-1dgx75v"&&(rl.textContent=CU),QM=t(l),j(kl.$$.fragment,l),VM=t(l),hl=s(l,"P",{"data-svelte-h":!0}),n(hl)!=="svelte-1bky1ee"&&(hl.innerHTML=gU),RM=t(l),j(dl.$$.fragment,l),FM=t(l),Ol=s(l,"P",{}),IU(Ol).forEach(U),this.h()},h(){uU(y,"name","hf:doc:metadata"),uU(y,"content",NU)},m(l,M){fU(document.head,y),T(l,o,M),T(l,g,M),T(l,u,M),w(k,l,M),T(l,fl,M),T(l,h,M),T(l,Ql,M),T(l,d,M),T(l,Vl,M),w(m,l,M),T(l,Rl,M),T(l,O,M),T(l,Fl,M),T(l,f,M),T(l,Nl,M),T(l,Q,M),T(l,bl,M),w(V,l,M),T(l,Dl,M),T(l,R,M),T(l,$l,M),w(c,l,M),T(l,vl,M),w(F,l,M),T(l,Bl,M),T(l,N,M),T(l,Hl,M),T(l,b,M),T(l,Zl,M),w(D,l,M),T(l,Sl,M),T(l,$,M),T(l,El,M),T(l,v,M),T(l,Gl,M),T(l,B,M),T(l,xl,M),w(H,l,M),T(l,Pl,M),T(l,Z,M),T(l,Wl,M),w(S,l,M),T(l,ql,M),T(l,E,M),T(l,Ll,M),T(l,G,M),T(l,_l,M),T(l,x,M),T(l,Yl,M),w(P,l,M),T(l,zl,M),T(l,W,M),T(l,Xl,M),T(l,q,M),T(l,Kl,M),T(l,L,M),T(l,lM,M),w(_,l,M),T(l,MM,M),T(l,Y,M),T(l,UM,M),w(z,l,M),T(l,TM,M),T(l,X,M),T(l,JM,M),T(l,K,M),T(l,tM,M),T(l,ll,M),T(l,eM,M),T(l,Ml,M),T(l,sM,M),w(Ul,l,M),T(l,nM,M),T(l,Tl,M),T(l,yM,M),w(Jl,l,M),T(l,aM,M),T(l,tl,M),T(l,jM,M),w(el,l,M),T(l,wM,M),T(l,sl,M),T(l,iM,M),w(r,l,M),T(l,AM,M),w(nl,l,M),T(l,CM,M),T(l,yl,M),T(l,gM,M),T(l,al,M),T(l,oM,M),w(jl,l,M),T(l,pM,M),T(l,wl,M),T(l,IM,M),T(l,il,M),T(l,uM,M),w(Al,l,M),T(l,cM,M),T(l,Cl,M),T(l,rM,M),w(gl,l,M),T(l,kM,M),T(l,ol,M),T(l,hM,M),T(l,pl,M),T(l,dM,M),T(l,Il,M),T(l,mM,M),w(ul,l,M),T(l,OM,M),T(l,cl,M),T(l,fM,M),T(l,rl,M),T(l,QM,M),w(kl,l,M),T(l,VM,M),T(l,hl,M),T(l,RM,M),w(dl,l,M),T(l,FM,M),T(l,Ol,M),NM=!0},p(l,[M]){const oU={};M&2&&(oU.$$scope={dirty:M,ctx:l}),c.$set(oU);const pU={};M&2&&(pU.$$scope={dirty:M,ctx:l}),r.$set(pU)},i(l){NM||(i(k.$$.fragment,l),i(m.$$.fragment,l),i(V.$$.fragment,l),i(c.$$.fragment,l),i(F.$$.fragment,l),i(D.$$.fragment,l),i(H.$$.fragment,l),i(S.$$.fragment,l),i(P.$$.fragment,l),i(_.$$.fragment,l),i(z.$$.fragment,l),i(Ul.$$.fragment,l),i(Jl.$$.fragment,l),i(el.$$.fragment,l),i(r.$$.fragment,l),i(nl.$$.fragment,l),i(jl.$$.fragment,l),i(Al.$$.fragment,l),i(gl.$$.fragment,l),i(ul.$$.fragment,l),i(kl.$$.fragment,l),i(dl.$$.fragment,l),NM=!0)},o(l){A(k.$$.fragment,l),A(m.$$.fragment,l),A(V.$$.fragment,l),A(c.$$.fragment,l),A(F.$$.fragment,l),A(D.$$.fragment,l),A(H.$$.fragment,l),A(S.$$.fragment,l),A(P.$$.fragment,l),A(_.$$.fragment,l),A(z.$$.fragment,l),A(Ul.$$.fragment,l),A(Jl.$$.fragment,l),A(el.$$.fragment,l),A(r.$$.fragment,l),A(nl.$$.fragment,l),A(jl.$$.fragment,l),A(Al.$$.fragment,l),A(gl.$$.fragment,l),A(ul.$$.fragment,l),A(kl.$$.fragment,l),A(dl.$$.fragment,l),NM=!1},d(l){l&&(U(o),U(g),U(u),U(fl),U(h),U(Ql),U(d),U(Vl),U(Rl),U(O),U(Fl),U(f),U(Nl),U(Q),U(bl),U(Dl),U(R),U($l),U(vl),U(Bl),U(N),U(Hl),U(b),U(Zl),U(Sl),U($),U(El),U(v),U(Gl),U(B),U(xl),U(Pl),U(Z),U(Wl),U(ql),U(E),U(Ll),U(G),U(_l),U(x),U(Yl),U(zl),U(W),U(Xl),U(q),U(Kl),U(L),U(lM),U(MM),U(Y),U(UM),U(TM),U(X),U(JM),U(K),U(tM),U(ll),U(eM),U(Ml),U(sM),U(nM),U(Tl),U(yM),U(aM),U(tl),U(jM),U(wM),U(sl),U(iM),U(AM),U(CM),U(yl),U(gM),U(al),U(oM),U(pM),U(wl),U(IM),U(il),U(uM),U(cM),U(Cl),U(rM),U(kM),U(ol),U(hM),U(pl),U(dM),U(Il),U(mM),U(OM),U(cl),U(fM),U(rl),U(QM),U(VM),U(hl),U(RM),U(FM),U(Ol)),U(y),C(k,l),C(m,l),C(V,l),C(c,l),C(F,l),C(D,l),C(H,l),C(S,l),C(P,l),C(_,l),C(z,l),C(Ul,l),C(Jl,l),C(el,l),C(r,l),C(nl,l),C(jl,l),C(Al,l),C(gl,l),C(ul,l),C(kl,l),C(dl,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(ml){return hU(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ZU extends dU{constructor(y){super(),mU(this,y,bU,FU,kU,{})}}export{ZU as component};
