Files
crewAI/docs/edge/ar/tools/integration/mergeagenthandlertool.mdx
Lucas Gomide a237ebabba feat: adopt directory-based docs versioning with Edge channel (#6202)
* feat: adopt directory-based docs versioning with Edge channel

Switch docs.crewai.com from navigation-only versioning (every version
selector entry rendered the same docs/<lang>/* source files) to
Mintlify's directory-based versioning so each version selector entry
renders its own snapshot. Add an "Edge" channel under docs/edge/<lang>/*
that always reflects main HEAD for unreleased work, eliminating
pre-release leakage onto frozen release labels. External links to
canonical /<lang>/* URLs are preserved via wildcard redirects that
always land on the current default version.

Layout:
- docs/edge/<lang>/*         rolling source (you edit here)
- docs/edge/enterprise-api.*.yaml
- docs/v<X.Y.Z>/<lang>/*     frozen, immutable snapshots
- docs/v<X.Y.Z>/enterprise-api.*.yaml
- docs/images/               shared, append-only
- docs/docs.json             nav + redirects

URLs follow the Mintlify-idiomatic shape: /edge/<lang>/<page> for
Edge, /v<X.Y.Z>/<lang>/<page> for every frozen snapshot. The wildcard
redirects /<lang>/:slug* -> /<default>/<lang>/:slug* keep stale links
working, and every freeze rewrites them (plus all per-section/per-page
redirects) so destinations always resolve to the current default
without depending on a second redirect hop.

Release flow integration (devtools release):
- New module crewai_devtools.docs_versioning.freeze() materialises
  docs/v<X.Y.Z>/ from docs/edge/, rewrites openapi: refs inside the
  snapshot, inserts the version into every language block in
  docs.json, and refreshes all redirect destinations.
- _update_docs_and_create_pr() in cli.py now calls that freeze during
  Phase 2 of devtools release. Edge changelogs are updated first (so
  the snapshot freeze picks them up), then the snapshot is staged
  alongside docs.json, branched as docs/freeze-v<X.Y.Z>, and the PR
  is titled [docs-freeze] docs: snapshot and changelog for v<X.Y.Z>
  — the title prefix the new CI guard reads.
- The PR still gates tag, GitHub release, PyPI publish, and the
  enterprise release as before; no new PRs are added.
- Pre-releases (1.X.YaN, 1.X.YbN, ...) skip the snapshot — they ride
  Edge — and the docs PR title omits the [docs-freeze] prefix.
- docs_check (AI-generated docs scaffolding) writes to
  docs/edge/<lang>/* so newly-generated unreleased docs land in Edge
  and never accidentally touch a frozen snapshot.

Migration scripts (one-shot):
- scripts/docs/freeze_historical_versions.py reconstructs all 16
  historical snapshots (v1.10.0 .. v1.14.7) from git tags via
  git archive | tar, rewriting openapi: MDX refs so each snapshot
  reads its own enterprise-api YAML rather than the live one.
- scripts/docs/prefix_version_paths.py one-shot-migrates docs.json:
  rewrites every page path in 16 versioned blocks to point under
  docs/v<X.Y.Z>/, inserts a new Edge entry per language, tags
  v1.14.7 as Latest (default), prunes pages whose target file
  doesn't exist in the snapshot (e.g. docs/ar/ didn't exist before
  v1.12.0), and writes the wildcard + per-section redirects.
- scripts/docs/freeze_current_edge.py is now a thin CLI wrapper
  around docs_versioning.freeze for manual one-off freezes (e.g.
  retroactively snapshotting a forgotten release).

CI guards (.github/workflows/docs-snapshots.yml):
- Frozen snapshots under docs/v[0-9]*/ are immutable; only PRs whose
  title contains [docs-freeze] (i.e. release-cut PRs generated by
  devtools release or the manual wrapper) may modify them.
- Images under docs/images/ are append-only since snapshots share a
  single image directory. Deleting or renaming an image breaks every
  historical snapshot that still references it.

Restored docs/images/crewai-otel-export.png from PR #3673; it was
deleted in PR #4908 but v1.10.0 / v1.10.1 snapshots still reference
it. Restoring instead of editing the snapshots preserves historical
rendering fidelity and validates the new append-only rule
retroactively.

Tests:
- lib/devtools/tests/test_docs_versioning.py covers the freeze: file
  copy, openapi rewrite, version insertion, default demotion, redirect
  upserts, per-section redirect rewriting, idempotency, and invalid
  inputs.

Verified locally with mintlify broken-links: 0 broken links across
the full site (Edge + 16 frozen versions, 4 locales).

AGENTS.md (repo root) is the contributor guide for the new model;
RELEASING.md is the release-cut runbook; README's Contribution
section links to both.

Co-authored-by: Cursor <cursoragent@cursor.com>

* style: resolve linter issues

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:56:59 -04:00

368 lines
15 KiB
Plaintext

---
title: أداة معالج وكيل Merge
description: تتيح لوكلاء CrewAI الوصول بأمان إلى تكاملات الأطراف الثالثة مثل Linear و GitHub و Slack والمزيد من خلال منصة معالج الوكيل من Merge
icon: diagram-project
mode: "wide"
---
# `MergeAgentHandlerTool`
تتيح `MergeAgentHandlerTool` لوكلاء CrewAI الوصول بأمان إلى تكاملات الأطراف الثالثة من خلال منصة [معالج الوكيل من Merge](https://www.merge.dev/products/merge-agent-handler). يوفر معالج الوكيل موصلات جاهزة وآمنة لأدوات شائعة مثل Linear و GitHub و Slack و Notion ومئات غيرها - جميعها مع مصادقة وصلاحيات ومراقبة مدمجة.
## التثبيت
```bash
uv pip install 'crewai[tools]'
```
## المتطلبات
- حساب معالج وكيل Merge مع حزمة أدوات مُهيأة
- مفتاح API لمعالج الوكيل
- مستخدم مسجل واحد على الأقل مرتبط بحزمة الأدوات الخاصة بك
- تكاملات أطراف ثالثة مُهيأة في حزمة الأدوات الخاصة بك
## البدء مع معالج الوكيل
1. **التسجيل** في حساب معالج وكيل Merge على [ah.merge.dev/signup](https://ah.merge.dev/signup)
2. **إنشاء حزمة أدوات** وتكوين التكاملات التي تحتاجها
3. **تسجيل المستخدمين** الذين سيقومون بالمصادقة مع خدمات الأطراف الثالثة
4. **الحصول على مفتاح API** من لوحة تحكم معالج الوكيل
5. **تعيين متغير البيئة**: `export AGENT_HANDLER_API_KEY='your-key-here'`
6. **البدء بالبناء** مع MergeAgentHandlerTool في CrewAI
## ملاحظات
- يمكن العثور على معرّفات حزمة الأدوات ومعرّفات المستخدمين المسجلين في لوحة تحكم معالج الوكيل أو إنشاؤها عبر API
- تستخدم الأداة بروتوكول سياق النموذج (MCP) للتواصل مع معالج الوكيل
- يتم توليد معرّفات الجلسة تلقائياً ولكن يمكن تخصيصها لاستمرارية السياق
- يتم تسجيل جميع استدعاءات الأدوات وإمكانية مراجعتها من خلال منصة معالج الوكيل
- يتم اكتشاف معاملات الأدوات ديناميكياً من واجهة برمجة تطبيقات معالج الوكيل والتحقق منها تلقائياً
## الاستخدام
### استخدام أداة واحدة
إليك كيفية استخدام أداة محددة من حزمة الأدوات الخاصة بك:
```python {2, 4-9}
from crewai import Agent, Task, Crew
from crewai_tools import MergeAgentHandlerTool
# Create a tool for Linear issue creation
linear_create_tool = MergeAgentHandlerTool.from_tool_name(
tool_name="linear__create_issue",
tool_pack_id="134e0111-0f67-44f6-98f0-597000290bb3",
registered_user_id="91b2b905-e866-40c8-8be2-efe53827a0aa"
)
# Create a CrewAI agent that uses the tool
project_manager = Agent(
role='Project Manager',
goal='Manage project tasks and issues efficiently',
backstory='I am an expert at tracking project work and creating actionable tasks.',
tools=[linear_create_tool],
verbose=True
)
# Create a task for the agent
create_issue_task = Task(
description="Create a new high-priority issue in Linear titled 'Implement user authentication' with a detailed description of the requirements.",
agent=project_manager,
expected_output="Confirmation that the issue was created with its ID"
)
# Create a crew with the agent
crew = Crew(
agents=[project_manager],
tasks=[create_issue_task],
verbose=True
)
# Run the crew
result = crew.kickoff()
print(result)
```
### تحميل أدوات متعددة من حزمة أدوات
يمكنك تحميل جميع الأدوات المتاحة من حزمة الأدوات دفعة واحدة:
```python {2, 4-8}
from crewai import Agent, Task, Crew
from crewai_tools import MergeAgentHandlerTool
# Load all tools from the Tool Pack
tools = MergeAgentHandlerTool.from_tool_pack(
tool_pack_id="134e0111-0f67-44f6-98f0-597000290bb3",
registered_user_id="91b2b905-e866-40c8-8be2-efe53827a0aa"
)
# Create an agent with access to all tools
automation_expert = Agent(
role='Automation Expert',
goal='Automate workflows across multiple platforms',
backstory='I can work with any tool in the toolbox to get things done.',
tools=tools,
verbose=True
)
automation_task = Task(
description="Check for any high-priority issues in Linear and post a summary to Slack.",
agent=automation_expert
)
crew = Crew(
agents=[automation_expert],
tasks=[automation_task],
verbose=True
)
result = crew.kickoff()
```
### تحميل أدوات محددة فقط
تحميل الأدوات التي تحتاجها فقط:
```python {2, 4-10}
from crewai import Agent, Task, Crew
from crewai_tools import MergeAgentHandlerTool
# Load specific tools from the Tool Pack
selected_tools = MergeAgentHandlerTool.from_tool_pack(
tool_pack_id="134e0111-0f67-44f6-98f0-597000290bb3",
registered_user_id="91b2b905-e866-40c8-8be2-efe53827a0aa",
tool_names=["linear__create_issue", "linear__get_issues", "slack__post_message"]
)
developer_assistant = Agent(
role='Developer Assistant',
goal='Help developers track and communicate about their work',
backstory='I help developers stay organized and keep the team informed.',
tools=selected_tools,
verbose=True
)
daily_update_task = Task(
description="Get all issues assigned to the current user in Linear and post a summary to the #dev-updates Slack channel.",
agent=developer_assistant
)
crew = Crew(
agents=[developer_assistant],
tasks=[daily_update_task],
verbose=True
)
result = crew.kickoff()
```
## معاملات الأداة
### طريقة `from_tool_name()`
| المعامل | النوع | مطلوب | الافتراضي | الوصف |
|:---------|:-----|:---------|:--------|:------------|
| **tool_name** | `str` | نعم | None | اسم الأداة المحددة المراد استخدامها (مثل "linear__create_issue") |
| **tool_pack_id** | `str` | نعم | None | معرّف UUID لحزمة أدوات معالج الوكيل |
| **registered_user_id** | `str` | نعم | None | معرّف UUID أو origin_id للمستخدم المسجل |
| **base_url** | `str` | لا | "https://ah-api.merge.dev" | عنوان URL الأساسي لواجهة برمجة تطبيقات معالج الوكيل |
| **session_id** | `str` | لا | يتم توليده تلقائياً | معرّف جلسة MCP للحفاظ على السياق |
### طريقة `from_tool_pack()`
| المعامل | النوع | مطلوب | الافتراضي | الوصف |
|:---------|:-----|:---------|:--------|:------------|
| **tool_pack_id** | `str` | نعم | None | معرّف UUID لحزمة أدوات معالج الوكيل |
| **registered_user_id** | `str` | نعم | None | معرّف UUID أو origin_id للمستخدم المسجل |
| **tool_names** | `list[str]` | لا | None | أسماء أدوات محددة للتحميل. إذا كانت None، يتم تحميل جميع الأدوات المتاحة |
| **base_url** | `str` | لا | "https://ah-api.merge.dev" | عنوان URL الأساسي لواجهة برمجة تطبيقات معالج الوكيل |
## متغيرات البيئة
```bash
AGENT_HANDLER_API_KEY=your_api_key_here # Required for authentication
```
## الاستخدام المتقدم
### سير عمل متعدد الوكلاء مع صلاحيات أدوات مختلفة
```python {2, 4-20}
from crewai import Agent, Task, Crew, Process
from crewai_tools import MergeAgentHandlerTool
# Create specialized tools for different agents
github_tools = MergeAgentHandlerTool.from_tool_pack(
tool_pack_id="134e0111-0f67-44f6-98f0-597000290bb3",
registered_user_id="91b2b905-e866-40c8-8be2-efe53827a0aa",
tool_names=["github__create_pull_request", "github__get_pull_requests"]
)
linear_tools = MergeAgentHandlerTool.from_tool_pack(
tool_pack_id="134e0111-0f67-44f6-98f0-597000290bb3",
registered_user_id="91b2b905-e866-40c8-8be2-efe53827a0aa",
tool_names=["linear__create_issue", "linear__update_issue"]
)
slack_tool = MergeAgentHandlerTool.from_tool_name(
tool_name="slack__post_message",
tool_pack_id="134e0111-0f67-44f6-98f0-597000290bb3",
registered_user_id="91b2b905-e866-40c8-8be2-efe53827a0aa"
)
# Create specialized agents
code_reviewer = Agent(
role='Code Reviewer',
goal='Review pull requests and ensure code quality',
backstory='I am an expert at reviewing code changes and providing constructive feedback.',
tools=github_tools
)
task_manager = Agent(
role='Task Manager',
goal='Track and update project tasks based on code changes',
backstory='I keep the project board up to date with the latest development progress.',
tools=linear_tools
)
communicator = Agent(
role='Team Communicator',
goal='Keep the team informed about important updates',
backstory='I make sure everyone knows what is happening in the project.',
tools=[slack_tool]
)
# Create sequential tasks
review_task = Task(
description="Review all open pull requests in the 'api-service' repository and identify any that need attention.",
agent=code_reviewer,
expected_output="List of pull requests that need review or have issues"
)
update_task = Task(
description="Update Linear issues based on the pull request review findings. Mark completed PRs as done.",
agent=task_manager,
expected_output="Summary of updated Linear issues"
)
notify_task = Task(
description="Post a summary of today's code review and task updates to the #engineering Slack channel.",
agent=communicator,
expected_output="Confirmation that the message was posted"
)
# Create a crew with sequential processing
crew = Crew(
agents=[code_reviewer, task_manager, communicator],
tasks=[review_task, update_task, notify_task],
process=Process.sequential,
verbose=True
)
result = crew.kickoff()
```
### إدارة الجلسات المخصصة
الحفاظ على السياق عبر استدعاءات أدوات متعددة باستخدام معرّفات الجلسة:
```python {2, 4-17}
from crewai import Agent, Task, Crew
from crewai_tools import MergeAgentHandlerTool
# Create tools with the same session ID to maintain context
session_id = "project-sprint-planning-2024"
create_tool = MergeAgentHandlerTool(
name="linear_create_issue",
description="Creates a new issue in Linear",
tool_name="linear__create_issue",
tool_pack_id="134e0111-0f67-44f6-98f0-597000290bb3",
registered_user_id="91b2b905-e866-40c8-8be2-efe53827a0aa",
session_id=session_id
)
update_tool = MergeAgentHandlerTool(
name="linear_update_issue",
description="Updates an existing issue in Linear",
tool_name="linear__update_issue",
tool_pack_id="134e0111-0f67-44f6-98f0-597000290bb3",
registered_user_id="91b2b905-e866-40c8-8be2-efe53827a0aa",
session_id=session_id
)
sprint_planner = Agent(
role='Sprint Planner',
goal='Plan and organize sprint tasks',
backstory='I help teams plan effective sprints with well-defined tasks.',
tools=[create_tool, update_tool],
verbose=True
)
planning_task = Task(
description="Create 5 sprint tasks for the authentication feature and set their priorities based on dependencies.",
agent=sprint_planner
)
crew = Crew(
agents=[sprint_planner],
tasks=[planning_task],
verbose=True
)
result = crew.kickoff()
```
## حالات الاستخدام
### الوصول الموحد للتكاملات
- الوصول إلى مئات أدوات الأطراف الثالثة من خلال واجهة برمجة تطبيقات موحدة واحدة دون إدارة حزم SDK متعددة
- تمكين الوكلاء من العمل مع Linear و GitHub و Slack و Notion و Jira و Asana والمزيد من نقطة تكامل واحدة
- تقليل تعقيد التكامل من خلال السماح لمعالج الوكيل بإدارة المصادقة وإصدارات API
### سير عمل المؤسسات الآمنة
- الاستفادة من إدارة المصادقة والصلاحيات المدمجة لجميع تكاملات الأطراف الثالثة
- الحفاظ على معايير أمان المؤسسة مع التحكم المركزي في الوصول وتسجيل المراجعة
- تمكين الوكلاء من الوصول إلى أدوات الشركة دون كشف مفاتيح API أو بيانات الاعتماد في الكود
### الأتمتة عبر المنصات
- بناء سير عمل يمتد عبر منصات متعددة (مثل إنشاء مشكلات GitHub من مهام Linear، مزامنة صفحات Notion مع Slack)
- تمكين تدفق البيانات السلس بين الأدوات المختلفة في مجموعتك التقنية
- إنشاء أتمتة ذكية تفهم السياق عبر المنصات المختلفة
### اكتشاف الأدوات الديناميكي
- تحميل جميع الأدوات المتاحة أثناء التشغيل دون ترميز منطق التكامل بشكل ثابت
- تمكين الوكلاء من اكتشاف واستخدام أدوات جديدة عند إضافتها إلى حزمة الأدوات
- بناء وكلاء مرنة يمكنها التكيف مع تغير توفر الأدوات
### الوصول إلى الأدوات حسب المستخدم
- يمكن لمستخدمين مختلفين الحصول على صلاحيات ومستويات وصول مختلفة للأدوات
- تمكين سير عمل متعدد المستأجرين حيث تعمل الوكلاء نيابة عن مستخدمين محددين
- الحفاظ على الإسناد والصلاحيات المناسبة لجميع إجراءات الأدوات
## التكاملات المتاحة
يدعم معالج وكيل Merge مئات التكاملات عبر فئات متعددة:
- **إدارة المشاريع**: Linear، Jira، Asana، Monday.com، ClickUp
- **إدارة الكود**: GitHub، GitLab، Bitbucket
- **التواصل**: Slack، Microsoft Teams، Discord
- **التوثيق**: Notion، Confluence، Google Docs
- **إدارة علاقات العملاء**: Salesforce، HubSpot، Pipedrive
- **والمزيد...**
قم بزيارة [وثائق معالج وكيل Merge](https://docs.ah.merge.dev/) للحصول على قائمة كاملة بالتكاملات المتاحة.
## معالجة الأخطاء
توفر الأداة معالجة شاملة للأخطاء:
- **أخطاء المصادقة**: مفاتيح API غير صالحة أو مفقودة
- **أخطاء الصلاحيات**: المستخدم يفتقر إلى صلاحية الإجراء المطلوب
- **أخطاء API**: مشكلات في التواصل مع معالج الوكيل أو خدمات الأطراف الثالثة
- **أخطاء التحقق**: معاملات غير صالحة مُمررة لطرق الأداة
يتم تغليف جميع الأخطاء في `MergeAgentHandlerToolError` لمعالجة أخطاء متسقة.