> ## 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.

# أمثلة

> استخدم أنماط Go عملية للأدوات والموافقات والبث وعمليات التشغيل المحدودة.

## نشر يتطلب موافقة

```go theme={null}
deploy := phaseoagent.Tool{
  ID: "deploy",
  Description: "Deploy the selected release",
  RequireApproval: true,
  Execute: func(input any, runtime phaseoagent.RuntimeContext) (any, error) {
    return deploymentService.Deploy(runtime.Context, input)
  },
}
```

شغّل الوكيل واحفظ السجل المعاد عندما تصبح حالته `waiting_for_human`. تابعه بقرار مرتبط بمعرّف استدعاء الأداة المعلّق.

## البث إلى الطرفية

```go theme={null}
stream := agent.Stream(ctx, phaseoagent.RunOptions{Input: prompt, Client: client})
for delta := range stream.Text() { fmt.Print(delta) }
result, err := stream.Result()
```

## تقييد البحث المستقل

اجمع `StepCountIs` و`MaxTokensUsed` و`MaxCost` و`MaxDuration` حتى لا يتجاوز الوكيل طويل التشغيل ميزانية المنتج، حتى إذا واصل العثور على عمل مفيد.

للاطلاع على التفاصيل الكاملة، راجع [الأدوات](./agent-sdk-tools.mdx) و[الحالة والموافقة](./agent-sdk-state-and-approval.mdx) و[شروط الإيقاف](./agent-sdk-stop-conditions.mdx).


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