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

# Subagent Server Tool

> Let the main model delegate focused work to a worker model.

Use `phaseo:subagent` when the main model should hand off a self-contained task to a smaller or faster worker model during the same request.

The main model calls the Subagent tool with a task description. Phaseo runs the worker model server-side, returns the worker result as tool context, and lets the main model finish the answer.

## Quick start

```bash theme={null}
curl https://api.phaseo.app/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5-nano",
    "messages": [
      { "role": "user", "content": "Compare these release notes and summarize the breaking changes." }
    ],
    "tools": [
      {
        "type": "phaseo:subagent",
        "parameters": {
          "model": "openai/gpt-5-nano",
          "instructions": "Return concise findings for the main model. Do not address the end user directly.",
          "max_uses": 3,
          "max_completion_tokens": 1200
        }
      }
    ]
  }'
```

## Parameters

```json theme={null}
{
  "type": "phaseo:subagent",
  "parameters": {
    "model": "openai/gpt-5-nano",
    "instructions": "You are a fast, focused worker. Complete only the delegated task.",
    "max_uses": 3,
    "max_completion_tokens": 1200,
    "reasoning": { "effort": "low" },
    "temperature": 0.2
  }
}
```

| Parameter | Type | Default | Description |
| - | - | - | - |
| `model` | string | `openai/gpt-5-nano` | Worker model to call. |
| `instructions` | string | focused worker instructions | Extra instructions appended to the default Subagent behavior. |
| `max_uses` | integer | `10` | Maximum Subagent calls during the server-tool loop. |
| `max_completion_tokens` | integer | Advisor default | Max output tokens for each worker response. |
| `max_tokens` | integer | Advisor default | Legacy alias for `max_completion_tokens`. |
| `reasoning` | object | provider default | Reasoning config forwarded to the worker call when supported. |
| `temperature` | number | provider default | Sampling temperature for the worker call. |

## Tool-call arguments

The model normally calls Subagent with `task_description`:

```json theme={null}
{
  "task_description": "Extract the three highest-risk migration steps from the supplied plan."
}
```

Phaseo also accepts `task`, `prompt`, or `input` as aliases when a model emits a slightly different argument name.

## What the tool returns

Subagent returns JSON as the tool result:

```json theme={null}
{
  "status": "ok",
  "model": "openai/gpt-5-nano",
  "result": "The highest-risk steps are schema migration, traffic cutover, and rollback verification."
}
```

If the worker request cannot run, Phaseo returns a tool error such as `subagent_invalid_request`, `subagent_max_uses_exceeded`, or `subagent_request_failed`.

## Usage and pricing

Subagent calls increment:

```json theme={null}
{
  "usage": {
    "server_tool_use": {
      "subagent_requests": 1
    }
  }
}
```

The worker model's tokens are included in total usage and can be priced at the selected worker model's rates.

## Related

* [Advisor](https://phaseo.app/docs/v1/guides/server-tools/advisor.md)
* [Fusion](https://phaseo.app/docs/v1/guides/server-tools/fusion.md)
* [Server Tools](https://phaseo.app/docs/v1/guides/server-tools/index.md)


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