> ## Documentation Index
> Fetch the complete documentation index at: https://docs.truthlocks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# تفويض عبر المستأجرين

> تمكين وكلاء الذكاء الاصطناعي من العمل عبر الحدود التنظيمية باستخدام سلاسل التفويض المشفرة.

# تفويض عبر المستأجرين

يتيح التفويض عبر المستأجرين لوكيل مملوك لمؤسسة واحدة تنفيذ إجراءات داخل مستأجر Truthlocks لمؤسسة أخرى — مع مسارات تدقيق كاملة وتفويض قابل للإلغاء.

## حالات الاستخدام

* **مقدمو الخدمات المدارة** الذين يديرون الوكلاء نيابة عن العملاء
* **شركاء سلسلة التوريد** الذين يشاركون بيانات التحقق عبر المؤسسات
* **مدمجو المنصات** الذين يديرون وكلاء يمتدون عبر مستأجرين متعددين للعملاء
* **شركات الاستشارات** التي تجري فحوصات الامتثال عبر بيئات العملاء

> [!TIP]
>
> تحتوي نقاط نهاية التفويض على ساحة لعب تفاعلية لواجهة برمجة التطبيقات. افتح مرجع واجهة برمجة التطبيقات [Guardrails & Delegation](https://docs.truthlocks.com/ar/api-reference/machine-identity/delegations/offer.md) وانقر على **إرسال** لتجربتها مقابل Sandbox.

## كيف يعمل

```
┌──────────────┐         ┌──────────────┐
│  Tenant A    │         │  Tenant B    │
│  (Delegator) │         │  (Delegate)  │
│              │  offer  │              │
│  Agent X ────┼────────►│  Agent Y     │
│              │         │  (accepts)   │
│              │ accept  │              │
│              │◄────────┼──            │
└──────────────┘         └──────────────┘
         │                       │
         ▼                       ▼
  delegation_id            scoped_token
  audit_trail              limited_ttl
```

## سير عمل التفويض

### الخطوة 1: تقديم التفويض

```bash theme={null}
curl -X POST https://api.truthlocks.com/v1/delegations/cross-tenant/offer \
  -H "X-API-Key: $TENANT_A_API_KEY" \
  -d '{
    "from_agent_id": "maip-agent:01JAAAA",
    "to_tenant_id": "tenant_B",
    "scopes": ["receipts:write", "attestations:read"],
    "constraints": {
      "max_actions_per_hour": 100,
      "ip_allowlist": ["10.0.0.0/8"],
      "expires_at": "2026-05-01T00:00:00Z"
    },
    "require_trust_score_above": 70,
    "metadata": {
      "purpose": "Quarterly compliance audit",
      "approved_by": "admin@tenant-a.com"
    }
  }'
```

**الاستجابة:**

```json theme={null}
{
  "id": "maip-delegation:01JDDDD",
  "status": "pending",
  "from_agent_id": "maip-agent:01JAAAA",
  "to_tenant_id": "tenant_B",
  "scopes": ["receipts:write", "attestations:read"],
  "offer_expires_at": "2026-04-13T00:00:00Z"
}
```

### الخطوة 2: قبول التفويض

```bash theme={null}
curl -X POST https://api.truthlocks.com/v1/delegations/cross-tenant/accept \
  -H "X-API-Key: $TENANT_B_API_KEY" \
  -d '{
    "accepting_agent_id": "maip-agent:01JBBBB",
    "acknowledge_constraints": true
  }'
```

**الاستجابة:**

```json theme={null}
{
  "id": "maip-delegation:01JDDDD",
  "status": "active",
  "delegated_token": "mdt_live_...",
  "effective_scopes": ["receipts:write", "attestations:read"],
  "expires_at": "2026-05-01T00:00:00Z"
}
```

### الخطوة 3: تنفيذ الإجراءات عبر المستأجرين

```bash theme={null}
curl -X POST https://api.truthlocks.com/v1/receipts \
  -H "Authorization: Bearer mdt_live_..." \
  -d '{
    "type": "compliance.check.completed",
    "subject_id": "vendor_456",
    "payload": { "result": "pass", "checks_run": 12 }
  }'
```

## نموذج الأمان

### القيود

| القيد | الوصف |
| - | - |
| `max_actions_per_hour` | حد المعدل للإجراءات المفوضة |
| `ip_allowlist` | قيود الشبكة |
| `expires_at` | تاريخ انتهاء صلاحية صارم |
| `require_trust_score_above` | الحد الأدنى لدرجة الثقة للحفاظ على التفويض |
| `scopes` | مجموعة فرعية من نطاقات الوكيل المفوض |

### مسار التدقيق

تولد جميع الإجراءات عبر المستأجرين إدخالات تدقيق مزدوجة — واحد في سجل تدقيق كل مستأجر:

```json theme={null}
{
  "event": "delegation.action",
  "delegation_id": "maip-delegation:01JDDDD",
  "acting_agent": "maip-agent:01JBBBB",
  "acting_tenant": "tenant_B",
  "target_tenant": "tenant_A",
  "action": "receipts:write",
  "timestamp": "2026-04-06T14:30:00Z"
}
```

### الإلغاء

يمكن لأي من الطرفين إلغاء التفويض في أي وقت:

```bash theme={null}
curl -X DELETE https://api.truthlocks.com/v1/delegations/maip-delegation:01JDDDD \
  -H "X-API-Key: $API_KEY" \
  -d '{ "reason": "Engagement concluded" }'
```

الإلغاء **فوري** — يتم رفض جميع الطلبات قيد التنفيذ التي تستخدم الرمز المميز المفوض.

## أفضل الممارسات

1. **تحديد وقت لجميع التفويضات** — لا تنشئ تفويضات مفتوحة
2. **الحد الأدنى من النطاقات الممكنة** — قم بتفويض النطاقات المطلوبة فعليًا فقط
3. **متطلبات درجة الثقة** — اضبط `require_trust_score_above` على 70 على الأقل
4. **قيود IP** — استخدم دائمًا `ip_allowlist` للتفويضات الإنتاجية
5. **مراقبة نشاط التفويض** — إعداد webhooks لأحداث `delegation.*`
6. **مراجعة دورية** — تدقيق التفويضات النشطة ربع سنويًا

## الخطوات التالية

> [card] [تفويض الوكيل](https://docs.truthlocks.com/guides/agent-authorization.md)
>
> تفويض قائم على النطاق وإدارة الجلسات.

> [card] [تنسيق الذكاء الاصطناعي](https://docs.truthlocks.com/guides/ai-orchestration.md)
>
> تنفيذ سير عمل متعدد الوكلاء مع دعم التفويض.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.