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

# الاستخدام

> شغّل حلقات الأدوات والمراجعة البشرية وإعادة المحاولة والوكلاء القابلين للاستئناف باستخدام Agent SDK لـ PHP.

## تجهيز بيئة التشغيل

حزمة Agent SDK غير متاحة بعد على Packagist. اتبع [تعليمات التثبيت من المصدر](./agent-sdk-installation.mdx).

## البدء السريع

```php theme={null}
<?php
require "vendor/autoload.php";

use Phaseo\AgentSdk\AgentDefinition;
use Phaseo\AgentSdk\AgentSdk;

$agent = AgentSdk::createAgent(new AgentDefinition(
    id: "quickstart-agent",
    model: "openai/gpt-5.4-nano",
    instructions: "Answer concisely and helpfully."
));

$result = $agent->run(
    input: "Give me one fun fact about cURL.",
    client: AgentSdk::createGatewayAgentClient()
);

echo $result->output . PHP_EOL;
```

## ما الذي يتضمنه

* `AgentSdk::createAgent(...)`
* `AgentSdk::defineTool(...)`
* `AgentSdk::createGatewayAgentClient(...)`
* حلقة أدوات محدودة عبر واجهة `responses` من Phaseo

## بيئة تشغيل متقدمة

يدعم PHP دوال التحقق والموافقة، وأدوات التدخل البشري واليدوية، والتقدم، والأخطاء القابلة للاسترداد، والمكررات القابلة لإعادة التشغيل، ومساعدات الإيقاف، والجولات الديناميكية، ومعلمات الجولة التالية المحفوظة، والاستخدام والتكلفة الموحدين، و`StateAccessor`.

## البث والإلغاء

تدير `Agent::stream(...)` و`Agent::continueStream(...)` تدفق Responses SSE للبوابة عبر Fiber أثناء استهلاك المكرر المُعاد. استخدم `textStream()` أو `reasoningStream()` أو `itemStream()` أو `fullStream()`؛ واستدعِ `cancel()` لإيقاف Fiber وإغلاق المولد. تحتفظ الخطوات المكتملة بمعرّفات الطلب وبيانات مزود الخدمة الوصفية وأسباب الإنهاء والتحذيرات والاستخدام والتكلفة.

## ذات صلة

* [نظرة عامة على Agent SDK](../agent-sdk/overview.mdx)
* [Agent SDK لـ TypeScript](../typescript/agent-sdk.mdx)


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