# مكتبات الوكلاء

## tiny-agents

أدوات خفيفة الوزن لتشغيل الوكلاء المدعومين بـ MCP فوق Hugging Face Inference. متوفرة في [JavaScript](https://huggingface.co/docs/huggingface.js/en/tiny-agents/README) (`@huggingface/tiny-agents`) و[Python](https://huggingface.co/docs/huggingface_hub/main/en/package_reference/mcp) (`huggingface_hub`).

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

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

أنشئ وكيلك الخاص باستخدام ملف إعدادات `agent.json`:

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

لنماذج اللغة المحلية، أضف `endpointUrl` يشير إلى خادمك (مثل `http://localhost:1234/v1`). لمعرفة المزيد، راجع [دليل SDK](./agents-sdk).

## خادم Gradio MCP

حوّل أي تطبيق Gradio إلى خادم MCP بتعديل سطر واحد:

```python
demo.launch(mcp_server=True)
```

يعرض الخادم كل دالة كأداة، مع أوصاف تُنشأ تلقائيًا من سلاسل التوثيق (docstrings). اربطه بأي عميل متوافق مع MCP. يتوفر آلاف المساحات (Spaces) المتوافقة مع MCP على [Hub](https://huggingface.co/spaces?filter=mcp-server). تعرّف على المزيد في [دليل Gradio MCP](https://www.gradio.app/guides/building-mcp-server-with-gradio).

## smolagents

[smolagents](https://github.com/huggingface/smolagents) هي مكتبة بايثون خفيفة لبناء الوكلاء في بضع سطور من الكود. تدعم `CodeAgent` (تكتب الإجراءات بلغة بايثون) و`ToolCallingAgent` (تستخدم استدعاءات الأدوات بصيغة JSON)، وتعمل مع أي نموذج عبر [Inference Providers](../inference-providers/index)، وتتكامل مع خوادم MCP.

```bash
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"
```

يمكن دفع الوكلاء إلى Hub على شكل Spaces. تصفح وكلاء المجتمع [هنا](https://huggingface.co/spaces?filter=smolagents&sort=likes). تعرّف على المزيد في [توثيق smolagents](https://huggingface.co/docs/smolagents/tutorials/tools#use-mcp-tools-with-mcpclient-directly).

