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

# المخرجات وإعادة المحاولة

> تحقّق من المخرجات النهائية، وأعِد طلبات النموذج، وافحص عمليات تشغيل Ruby المكتملة.

تحقّق من المخرجات عندما يحتاج كود Ruby اللاحق إلى بنية نتيجة متوقعة. تعالج محاولات النموذج إخفاقات الطلب المؤقتة؛ أما إعادة محاولة الأدوات ذات الآثار الجانبية فيجب أن تكون صريحة ومتكررة بأمان.

## إعداد إعادة المحاولة

```ruby theme={null}
agent = PhaseoAgentSdk.create_agent(
  id: "research-agent",
  model: "openai/gpt-5.4-nano",
  model_retry: PhaseoAgentSdk::ModelRetryConfig.new(
    max_retries: 3,
    base_delay_ms: 500,
    max_delay_ms: 4_000
  )
)
```

تتضمن النتيجة سجل التشغيل والخطوات والرسائل والاستخدام الموحّد وسبب الإيقاف والمخرجات النهائية.

```ruby theme={null}
result = agent.run(input: prompt, client: client)

puts result.output
puts result.run.status
puts result.usage[:total_tokens]
puts result.usage[:cost]
```

استخدم [شروط الإيقاف](./agent-sdk-stop-conditions.mdx) لفرض الميزانيات، و[الأخطاء واستكشاف المشكلات](./agent-sdk-observability.mdx) لاختيار السلوك عند الإخفاقات القابلة للتعافي.


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