> ## 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 Instructions
> Phaseo Gateway base URL: https://api.phaseo.app/v1. Send `Authorization: Bearer $PHASEO_API_KEY` with every request.
> Model IDs look like `provider/model`, for example `openai/gpt-6-astra`. Do not guess IDs: list them with `GET /v1/models` or check https://phaseo.app/models. `phaseo/free` routes to an available free model and needs no wallet balance.
> For new text integrations prefer `POST /v1/responses`. `POST /v1/chat/completions` (OpenAI format) and `POST /v1/messages` (Anthropic format) suit existing code.
> The full API contract is https://phaseo.app/docs/openapi/v1/openapi.yaml. Official SDKs: `@phaseo/sdk` (TypeScript) and `phaseo` (Python), plus Go, C#, PHP, Ruby and Rust.
> Search these docs over MCP at https://phaseo.app/docs/mcp, and install Phaseo skills with `npx skills add https://phaseo.app/docs`. If a page is wrong or out of date, report it with the MCP `submit_feedback` tool.
> Manage Phaseo accounts with the `phaseo` CLI (`npm install -g @phaseo/cli`, then `phaseo login` or `phaseo login --device-code`), the `/v1` Management API or the MCP server at `https://mcp.phaseo.app/mcp?access=manage`. Do not send users to the dashboard for account tasks. A person is still needed for sign-up, approving a sign-in, paying the first top-up on the checkout link that `phaseo credits add` returns when no card is saved, confirming each saved-card top-up from the emailed link, and account security (password, MFA, passkeys). Create API keys with `phaseo keys create --name <name> --json`; never guess one. Credit top-ups need `phaseo login --scopes billing:write` first. Task map: https://phaseo.app/docs/v1/developers/manage-from-an-agent.md.

# DevTools

> سجّل كل تشغيل للوكيل وكل متابعة في ملف محلي أثناء التطوير.

مرّر إعداد DevTools إلى تشغيل أو متابعة أثناء التطوير لإلحاق سطر JSON واحد لكل تشغيل بالملف `generations.jsonl` في مجلد محلي. يتضمن كل سطر مدخلات التشغيل وخطواته ونشاط الأدوات والمخرجات والاستخدام ومعرّفات طلبات Gateway. لا يُلتقط أي شيء ما لم تفعّله.

```typescript TypeScript theme={null}
import { createAgentDevtools } from "@phaseo/agent-sdk";

const result = await agent.run({
  input,
  client,
  devtools: createAgentDevtools(),
});
```

```python Python theme={null}
from phaseo_agent import create_agent_devtools

result = agent.run(input="Summarise this ticket", client=client, devtools=create_agent_devtools())
```

```go Go theme={null}
result, err := agent.Run(ctx, phaseoagent.RunOptions{
  Input:    prompt,
  Client:   client,
  Devtools: phaseoagent.CreateAgentDevtools(".phaseo-devtools"),
})
```

```csharp C# theme={null}
var result = await agent.Run(new RunOptions
{
    Input = prompt,
    Client = client,
    Devtools = AgentSdk.CreateAgentDevtools(".phaseo-devtools"),
});
```

```php PHP theme={null}
$result = $agent->run(
    input: $prompt,
    client: $client,
    devtools: AgentSdk::createAgentDevtools(".phaseo-devtools")
);
```

```ruby Ruby theme={null}
result = agent.run(
  input: prompt,
  client: client,
  devtools: PhaseoAgentSdk.create_agent_devtools(directory: ".phaseo-devtools")
)
```

```java Java theme={null}
var result = agent.run(new AgentSdk.RunOptions(
    prompt, client, null, null, null, null, null, null, null,
    AgentSdk.createAgentDevtools(".phaseo-devtools")));
```

> [!NOTE]
>
> لا يتوفر التقاط DevTools في Rust `0.2`. استخدم [خطافات دورة الحياة](https://phaseo.app/docs/ar/v1/sdk-reference/agent/lifecycle-hooks.md) مع `run_with_events` واكتب الأحداث بنفسك.

| اللغة | إنشاء إعداد | مرّره بوصفه | اختيار المجلد |
| - | - | - | - |
| TypeScript | `createAgentDevtools()` | `devtools` في خيارات التشغيل والمتابعة | `createAgentDevtools({ directory: ".local/agent-runs" })` |
| Python | `create_agent_devtools()` | `devtools=` في `run()` أو `stream()` أو متابعة | `create_agent_devtools(directory=".local/agent-runs")` |
| Go | `CreateAgentDevtools(directory)` | `Devtools` في `RunOptions` أو `ContinueOptions` | الوسيط `directory` |
| C# | `AgentSdk.CreateAgentDevtools(directory)` | `Devtools` في `RunOptions` أو `ContinueOptions` | الوسيط `directory` (الافتراضي `.phaseo-devtools`) |
| PHP | `AgentSdk::createAgentDevtools($directory)` | `devtools:` في `run()` أو `continueRun()` | الوسيط `$directory` (الافتراضي `.phaseo-devtools`) |
| Ruby | `PhaseoAgentSdk.create_agent_devtools(directory:, enabled:)` | `devtools:` في `run` أو `continue_run` | `directory:` (الافتراضي `.phaseo-devtools`) |
| Java | `AgentSdk.createAgentDevtools(directory)` | الوسيط `devtools` في `RunOptions` أو `ContinueOptions` | الوسيط `directory` |

## فعّل الالتقاط من البيئة

في غياب إعداد DevTools، يُفعَّل الالتقاط عندما تكون `PHASEO_DEVTOOLS=true`. تُكتب الملفات في `PHASEO_DEVTOOLS_DIR`، أو في `.phaseo-devtools` داخل مجلد العمل إذا لم يكن مضبوطًا. يعمل هذا بالطريقة نفسها في كل لغة تتوفر فيها DevTools.

## ما الذي يُكتب

| الملف | المحتوى |
| - | - |
| `generations.jsonl` | إدخال واحد لكل تشغيل وإدخال واحد لكل متابعة |
| `metadata.json` | معرّف الجلسة ووقت البدء واسم SDK (`"sdk": "typescript"` أو `"python"` أو `"go"` أو `"csharp"` أو `"php"` أو `"ruby"` أو `"java"`)، ويُكتب مرة واحدة |
| `assets/images`، `assets/audio`، `assets/video` | تُنشأ فارغة لعارض DevTools |

قيمة `type` لكل إدخال هي `agent.run` للتشغيل و`agent.continue` للمتابعة. `agent.continue` نوع إدخال وليس اسم دالة: إنه ما يكتبه استدعاء `continueRun()` (TypeScript وPHP وJava) أو `continue_run()` (Python وRuby) أو `Continue` (Go) أو `ContinueRun` (C#).

يتضمن الإدخال معرّفي التشغيل والوكيل، وعدد الأدوات، ونتيجة التشغيل كاملة: الحالة والرسائل والخطوات مع النموذج والمزوّد ومعرّفات طلبات Gateway، ونشاط الأدوات والاستخدام والمخرجات. يحصل التشغيل الفاشل على إدخال يتضمن الخطأ (`error.message` في Go وJava؛ وتفاصيل فشل منظَّمة في TypeScript). في Java تُتجاهل أخطاء الكتابة، لذا لا يتسبب الالتقاط أبدًا في فشل التشغيل.

> [!WARNING]
>
> تحتوي الإدخالات على المطالبات والرسائل وسياق التطبيق ومدخلات الأدوات ومخرجاتها كنص عادي. أبقِ المجلد خارج نظام التحكم بالمصدر وصور الإنتاج، ولا تستخدمه مخزنًا للتدقيق. لقياسات الإنتاج عن بُعد، استخدم [خطافات دورة الحياة](https://phaseo.app/docs/ar/v1/sdk-reference/agent/lifecycle-hooks.md).


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