Hub 文件

代理函式庫

Hugging Face's logo
加入 Hugging Face 社群

並獲得增強的文件體驗

開始使用

Agent 函式庫

tiny-agents

一個輕量級工具組,用於在 Hugging Face 推論(Inference)之上執行基於 MCP 的 Agent。提供 JavaScript (@huggingface/tiny-agents) 與 Python (huggingface_hub) 版本。

# JavaScript
npx @huggingface/tiny-agents run "agent/id"

# Python
pip install "huggingface_hub[mcp]"
tiny-agents run "agent/id"

透過 agent.json 設定檔建立您自己的 Agent

{
	"model": "Qwen/Qwen2.5-72B-Instruct",
	"provider": "together",
	"servers": [
		{
			"type": "stdio",
			"command": "npx",
			"args": ["@playwright/mcp@latest"]
		}
	]
}

若要使用本地大型語言模型(LLM),請新增指向您伺服器的 endpointUrl(例如 https://:1234/v1)。請參閱 SDK 指南以了解更多資訊。

Gradio MCP Server

只需修改一行程式碼,即可將任何 Gradio 應用程式轉換為 MCP 伺服器

demo.launch(mcp_server=True)

該伺服器將每個函式公開為工具(tool),並從文件字串(docstring)自動產生說明。您可以將其連接到任何 MCP 客戶端。在 Hub 上有數千個相容於 MCP 的 Spaces 可供使用。請參閱 Gradio MCP 指南以了解更多資訊。

smolagents

smolagents 是一個輕量級的 Python 函式庫,可用於以極簡程式碼建構 Agent。它支援 CodeAgent(以 Python 編寫動作)與 ToolCallingAgent(使用 JSON 工具呼叫),可透過 Inference Providers 與任何模型搭配使用,並能與 MCP 伺服器整合。

smolagent "Plan a trip to Tokyo, Kyoto and Osaka between Mar 28 and Apr 7." \
--model-type "InferenceClientModel" \
--model-id "Qwen/Qwen2.5-Coder-32B-Instruct" \
--tools "web_search"

Agent 可以作為 Spaces 推送到 Hub 上。請在此瀏覽社群建立的 Agent。請參閱 smolagents 文件以了解更多資訊。

在 GitHub 上更新

© . This site is unofficial and not affiliated with Hugging Face, Inc.