> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Subagent server tool

> Delegate a self-contained task to a configured worker model during a response.

The `orq:subagent` tool delegates a self-contained task to another model. The worker receives the task, optional context, and the configuration on the tool entry. It does not receive the parent conversation.

Use a smaller or faster worker for extraction, summarization, drafting, or data transformation while the primary model continues to own the final response.

## Quick start

The examples use the client configuration from the [Server tools overview](/docs/ai-gateway/features/server-tools).

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST https://api.orq.ai/v3/router/chat/completions \
    -H "Authorization: Bearer $ORQ_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "openai/gpt-5.4",
      "messages": [
        { "role": "user", "content": "Extract the dates and owners from this project update, then summarize the risks." }
      ],
      "tools": [
        {
          "type": "orq:subagent",
          "model": "openai/gpt-5.4-mini",
          "output_format": "JSON with dates, owners, and risks",
          "max_uses": 2
        }
      ]
    }'
  ```

  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await client.chat.completions.create({
    model: 'openai/gpt-5.4',
    messages: [
      {
        role: 'user',
        content:
          'Extract the dates and owners from this project update, then summarize the risks.',
      },
    ],
    tools: [
      {
        type: 'orq:subagent',
        model: 'openai/gpt-5.4-mini',
        output_format: 'JSON with dates, owners, and risks',
        max_uses: 2,
      },
    ] as any,
  });

  console.log(response.choices[0].message.content);
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  response = client.chat.completions.create(
      model="openai/gpt-5.4",
      messages=[
          {
              "role": "user",
              "content": "Extract the dates and owners from this project update, then summarize the risks.",
          }
      ],
      tools=[
          {
              "type": "orq:subagent",
              "model": "openai/gpt-5.4-mini",
              "output_format": "JSON with dates, owners, and risks",
              "max_uses": 2,
          }
      ],
  )

  print(response.choices[0].message.content)
  ```
</CodeGroup>

The primary model supplies a `task` and optional `context` when it calls the tool. The worker's completed output is returned to the primary model.

## Configuration

| Parameter          | Type    | Required | Default                | Description                                                                                        |
| ------------------ | ------- | -------- | ---------------------- | -------------------------------------------------------------------------------------------------- |
| `type`             | string  | Yes      |                        | Must be `orq:subagent`.                                                                            |
| `model`            | string  | Yes      |                        | Worker model in `provider/model` format.                                                           |
| `max_tokens`       | integer | No       | Provider default       | Maximum worker output tokens. Accepted range: 0 to 128,000. `0` uses the provider default.         |
| `reasoning_effort` | string  | No       | Provider default       | `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`, when supported by the worker model. |
| `temperature`      | number  | No       | Provider default       | Worker sampling temperature from 0 to 2. The selected model may impose a lower maximum.            |
| `system_prompt`    | string  | No       | Built-in worker prompt | Replace the worker's system prompt.                                                                |
| `output_format`    | string  | No       | None                   | Add output-format guidance to the worker task.                                                     |
| `max_uses`         | integer | No       | Unlimited              | Maximum delegations during the request. Set `0` or omit the field for no tool-specific limit.      |

## Cost and usage

Worker tokens are billed at the selected model's standard rate. Each Subagent call appears at `usage.server_tool_use.subagent_requests`.

`orq:sidekick` remains accepted as a legacy alias.
