> ## 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 の設定を渡すと、ローカルディレクトリの `generations.jsonl` に、実行ごとに1行の JSON が追記されます。各行には、実行の入力、ステップ、ツールの動き、出力、使用量、Gateway のリクエスト ID が入っています。有効にしない限り、何も記録されません。

```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]
>
> Rust `0.2` には DevTools への記録機能がありません。`run_with_events` で[ライフサイクルフック](https://phaseo.app/docs/ja/v1/sdk-reference/agent/lifecycle-hooks.md)を使い、イベントを自分で書き出してください。

| 言語 | 設定の作成 | 渡し方 | ディレクトリの指定 |
| - | - | - | - |
| TypeScript | `createAgentDevtools()` | run と continue のオプションの `devtools` | `createAgentDevtools({ directory: ".local/agent-runs" })` |
| Python | `create_agent_devtools()` | `run()`、`stream()`、または続行の `devtools=` | `create_agent_devtools(directory=".local/agent-runs")` |
| Go | `CreateAgentDevtools(directory)` | `RunOptions` または `ContinueOptions` の `Devtools` | 引数 `directory` |
| C# | `AgentSdk.CreateAgentDevtools(directory)` | `RunOptions` または `ContinueOptions` の `Devtools` | 引数 `directory`（デフォルトは `.phaseo-devtools`） |
| PHP | `AgentSdk::createAgentDevtools($directory)` | `run()` または `continueRun()` の `devtools:` | 引数 `$directory`（デフォルトは `.phaseo-devtools`） |
| Ruby | `PhaseoAgentSdk.create_agent_devtools(directory:, enabled:)` | `run` または `continue_run` の `devtools:` | `directory:`（デフォルトは `.phaseo-devtools`） |
| Java | `AgentSdk.createAgentDevtools(directory)` | `RunOptions` または `ContinueOptions` の `devtools` 引数 | 引数 `directory` |

## 環境変数で記録を有効にする

DevTools の設定がない場合、`PHASEO_DEVTOOLS=true` のときに記録が有効になります。ファイルは `PHASEO_DEVTOOLS_DIR` に、未設定の場合は作業ディレクトリの `.phaseo-devtools` に書き出されます。これは DevTools があるすべての言語で同じように動作します。

## 書き出される内容

| ファイル | 内容 |
| - | - |
| `generations.jsonl` | 実行ごとに1件、続行ごとに1件のエントリー |
| `metadata.json` | セッション ID、開始時刻、SDK 名（`"sdk": "typescript"`、`"python"`、`"go"`、`"csharp"`、`"php"`、`"ruby"`、`"java"` のいずれか）。1回だけ書き出されます |
| `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#）の呼び出しが書き出すものです。

エントリーには、実行 ID とエージェント ID、ツールの数、そして実行結果全体（ステータス、メッセージ、モデル・プロバイダー・Gateway のリクエスト ID を含むステップ、ツールの動き、使用量、出力）が入っています。失敗した実行には、エラーを含むエントリーが書き出されます（Go と Java では `error.message`、TypeScript では構造化された失敗の詳細）。Java では書き込みエラーは無視されるため、記録が原因で実行が失敗することはありません。

> [!WARNING]
>
> エントリーには、プロンプト、メッセージ、アプリケーションのコンテキスト、ツールの入力と出力がプレーンテキストで入っています。このディレクトリはソース管理や本番のイメージに含めず、監査用のストアとしても使わないでください。本番環境のテレメトリーには[ライフサイクルフック](https://phaseo.app/docs/ja/v1/sdk-reference/agent/lifecycle-hooks.md)を使ってください。


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