agent-squad-python
ما الذي تفعله
هذه المهارة دليل لبناء تطبيقات Python بحزمة agent-squad، وهي إطار لأنظمة الذكاء الاصطناعي متعددة الوكلاء. وتشرح أي نوع من الوكلاء يناسب كل حاجة. وهي موجهة إلى مطوري Python الذين يبنون مساعدين أو فرقاً من وكلاء الذكاء الاصطناعي.
متى تستخدمها
- ✓عندما تبني تطبيق Python يوجه الطلبات إلى عدة وكلاء متخصصين.
- ✓عندما تحتاج إلى مساعد واحد، أو خط معالجة ثابت، أو فريق يديره مشرف، أو إجابات مرتبطة بالبيانات.
- ✓عندما تريد ربط خوادم أدوات خارجية بالوكيل عبر بروتوكول MCP.
رابط المهارة
https://github.com/2FastLabs/agent-squad/blob/main/python/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“ابنِ تطبيق Python بحزمة agent-squad يوجه أسئلة العملاء إلى وكيل للفوترة ووكيل للدعم.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تشرح المهارة متى تستخدم مساعداً واحداً، أو عدة وكلاء مع منسّق، أو وكيلاً مرتبطاً بالبيانات لإجابات مطابقة للبيانات، أو سلسلة لخطوات ثابتة، أو مشرفاً لفريق. وتوجهك إلى المصدر والوثائق للتفاصيل الدقيقة.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
agent-squad Python — assistant guide
Async-first, dependency-optional multi-agent orchestration framework (Python 3.11+). This is a
guide and a map — not an API reference. Read exact signatures from the source
(python/src/agent_squad/) and the docs site (docs/src/content/docs/); this file tells you
what to use, when, and what to watch out for.
When to use what
- One assistant — a single
Agentsubclass; no orchestrator needed, callprocess_requestdirectly. - Several specialists — multiple agents + an
AgentSquadorchestrator; the classifier routes each turn to the right agent automatically. - Answers must not drift from data (prices, balances, live stock) —
GroundedAgent: a gatherer LLM calls tools and sees raw results but never speaks to the user; an isolated presenter LLM writes the reply grounded only on curated facts. - Fixed pipeline —
ChainAgent: routes the output of one agent as the input to the next, sequentially. - Team coordination —
SupervisorAgent: a leadBedrockLLMAgentorAnthropicAgentdelegates to a team of sub-agents via an internal tool loop, maintaining shared context. Can itself be registered in anAgentSquad. - External tool servers —
MCPToolProvider(requiresagent-squad[mcp]) connects any number of MCP servers (stdio or SSE) and makes their tools available to any agent.
How to install
All third-party integrations are optional extras — never forced on users who don't need them.
pip install agent-squad # core only (no LLM runtime)
pip install "agent-squad[aws]" # + boto3 — BedrockLLMAgent, BedrockClassifier, DynamoDbChatStorage, etc.
pip install "agent-squad[anthropic]" # + anthropic SDK — AnthropicAgent, AnthropicClassifier
pip install "agent-squad[openai]" # + openai SDK — OpenAIAgent, OpenAIClassifier
pip install "agent-squad[sql]" # + libsql-client — SqlChatStorage (Turso/libSQL)
pip install "agent-squad[strands-agents]"# + strands-agents — StrandsAgent
pip install "agent-squad[dakera]" # + dakera — DakeraRetriever
pip install "agent-squad[mcp]" # + mcp — MCPToolProvider
pip install "agent-squad[all]" # everything except strands-agents
How a turn works
AgentSquad.route_request is the one entry point worth memorising. It is a coroutine — you must
await it.
import asyncio
from agent_squad.orchestrator import AgentSquad
from agent_squad.agents import BedrockLLMAgent, BedrockLLMAgentOptions
from agent_squad.classifiers import BedrockClassifier, BedrockClassifierOptions
orchestrator = AgentSquad(
classifier=BedrockClassifier(BedrockClassifierOptions())
)
orchestrator.add_agent(BedrockLLMAgent(BedrockLLMAgentOptions(
name="General Assistant",
description="Handles general knowledge questions",
)))
async def main():
response = await orchestrator.route_request(
user_input="What is the capital of France?",
user_id="user-123",
session_id="session-abc",
)
if response.streaming:
# response.output is an async generator of AgentStreamResponse
async for chunk in response.output:
if chunk.text:
print(chunk.text, end="", flush=True)
if chunk.final_message:
pass # full ConversationMessage — already persisted
else:
# response.output is a ConversationMessage
print(response.output.content[0]["text"])
asyncio.run(main())
AgentResponse has three fields: metadata (AgentProcessingResult), output, and streaming
(bool). Always branch on response.streaming — the type of output differs.
To stream back from route_request, pass stream_response=True:
response = await orchestrator.route_request(
user_input="...",
user_id="u1",
session_id="s1",
stream_response=True,
)
If no agent is selected and no default agent is configured, route_request returns an
AgentResponse with the NO_SELECTED_AGENT_MESSAGE text rather than raising.
The pieces
AgentSquad (orchestrator)
from agent_squad.orchestrator import AgentSquad
The top-level object. Holds an agent registry, a classifier, and a ChatStorage.
from agent_squad.types import AgentSquadConfig
orchestrator = AgentSquad(
options=AgentSquadConfig(
LOG_CLASSIFIER_OUTPUT=True,
MAX_MESSAGE_PAIRS_PER_AGENT=20,
USE_DEFAULT_AGENT_IF_NONE_IDENTIFIED=T
الأسئلة الشائعة
هل تعطي مرجع API كاملاً؟
لا. هي دليل وخريطة. وتوجهك المهارة إلى الشيفرة المصدرية والوثائق للتواقيع الدقيقة.
أي إصدار من Python مطلوب؟
Python 3.11 أو أحدث.
هل يمكنها ربط أدوات خارجية؟
نعم. يمكن لمزود الأدوات الاختياري عبر MCP ربط أي عدد من خوادم MCP، فتصبح أدواتها متاحة للوكلاء.
التفاصيل
الوصف الأصلي من المؤلف
Use when building or modifying a Python app that uses the agent-squad Python package — async multi-agent orchestration for Python 3.11+: orchestrator, agents (BedrockLLMAgent, AnthropicAgent, OpenAIAgent, SupervisorAgent, GroundedAgent, ChainAgent, and more), classifier routing (Bedrock, Anthropic, OpenAI), storage (in-memory, DynamoDB, SQL/Turso), retrievers (Amazon KB, Dakera), tools (AgentTools, MCPToolProvider), and custom implementations.
repo: 2FastLabs/agent-squad
الشعبية
- نجوم GitHub
- 7.8k
- الترتيب
- #12830
- الترخيص
- Apache-2.0
- آخر تحديث
- 8/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
agent-squad-swift
7.8kيساعد وكيلك على بناء تطبيقات Swift لأجهزة iPhone وMac تشغّل عدة مساعدين ذكيين معاً، مع التوجيه والأدوات والتخزين على الجهاز.
agent-squad-typescript
7.8kيساعد وكيلك على بناء تطبيقات Node.js يعمل فيها عدة وكلاء ذكاء اصطناعي معاً، مع التوجيه وتخزين البيانات والاتصال بأدوات خارجية.
مهارات مشابهة
add-model-provider
394kتتيح لوكيلك ربط مزوّد نموذج ذكاء اصطناعي جديد بـ OpenClaw باستخدام أوامر إعداد آمنة، وإبقاء مفاتيح API خارج النص العادي، وإجراء اختبار حي.
acp-router
394kيساعد وكيلك على إرسال مهمة إلى مساعد برمجة مثل Claude Code أو Cursor عبر OpenClaw، فيعمل العمل داخل تلك الأداة.
browser-automation
394kتعلّم وكيلك التحكم في صفحات الويب خطوة بخطوة، بما في ذلك تسجيل الدخول والتبويبات والتعافي عندما تتوقف الصفحة عن الاستجابة.