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

# Build a complete agent — rules, tools and settings — in one atomic call

> Preferred over create + configure + add_rule + add_function. Pass template_id to seed a proven ruleset.

Preferred over create + configure + add\_rule + add\_function. Pass template\_id to seed a proven ruleset.

### Headers

<ParamField header="Idempotency-Key" type="string">
  Optional client-generated key that makes the POST safe to retry: a repeat with the same key and body replays the original response instead of creating a duplicate.
</ParamField>

### Request body

`ProvisionAgent`

<ParamField body="name" type="string" required>
  Minimum length: `1`. Maximum length: `200`.
</ParamField>

<ParamField body="template_id" type="string">
  Seeds rules/attributes/examples from a starter template. Maximum length: `100`.
</ParamField>

<ParamField body="type" type="string">
  One of: assistant, customer\_service, sales. Minimum length: `1`. Maximum length: `100`.
</ParamField>

<ParamField body="description" type="string">
  Maximum length: `5000`.
</ParamField>

<ParamField body="instructions" type="string">
  The system prompt / persona. Maximum length: `50000`.
</ParamField>

<ParamField body="goal" type="string">
  Maximum length: `2000`.
</ParamField>

<ParamField body="role" type="string">
  Maximum length: `2000`.
</ParamField>

<ParamField body="activated" type="boolean" />

<ParamField body="rules" type="object[]">
  Maximum items: `50`.

  <Expandable title="rules">
    <ParamField body="rule_name" type="string" required>
      Minimum length: `1`. Maximum length: `200`.
    </ParamField>

    <ParamField body="rule_type" type="string" required>
      One of: escalation, qualification, response, routing. Minimum length: `1`. Maximum length: `100`.
    </ParamField>

    <ParamField body="description" type="string">
      Maximum length: `5000`.
    </ParamField>

    <ParamField body="activated" type="boolean" />

    <ParamField body="conditions" type="object">
      \{any|all: \[\{field, operator, value}]}. Fields: company\_size, confidence, intent, knowledge\_sources, latest\_message, missing\_required\_fields, timeline. Operators: contains\_any, eq, exists, gte, in, lt, not\_empty.

      <Expandable title="conditions">
        <ParamField body="any" type="any[]" />

        <ParamField body="all" type="any[]" />
      </Expandable>
    </ParamField>

    <ParamField body="actions" type="any[]">
      \[\{type, ...}]. Types: collect\_fields, fallback, handoff, include\_sources, require\_context, require\_source\_for\_claims, require\_verification, response\_pattern, tag. Maximum items: `100`.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="functions" type="object[]">
  Maximum items: `50`.

  <Expandable title="functions">
    <ParamField body="function_name" type="string" required>
      Minimum length: `1`. Maximum length: `200`.
    </ParamField>

    <ParamField body="endpoint" type="string" required>
      Public http(s) URL. Private and metadata addresses are rejected. Minimum length: `1`. Maximum length: `2000`.
    </ParamField>

    <ParamField body="method" type="string" required>
      Minimum length: `1`. Maximum length: `20`.
    </ParamField>

    <ParamField body="description" type="string">
      Maximum length: `5000`.
    </ParamField>

    <ParamField body="activated" type="boolean" />

    <ParamField body="parameters" type="object[]">
      Maximum items: `100`.

      <Expandable title="parameters">
        <ParamField body="name" type="string" required>
          Minimum length: `1`. Maximum length: `100`.
        </ParamField>

        <ParamField body="type" type="string" required>
          Minimum length: `1`. Maximum length: `50`.
        </ParamField>

        <ParamField body="description" type="string">
          Maximum length: `1000`.
        </ParamField>

        <ParamField body="required" type="boolean" />
      </Expandable>
    </ParamField>

    <ParamField body="headers" type="object">
      Additional keys map to values of type `string`.
    </ParamField>

    <ParamField body="timeout" type="integer">
      Minimum: `1000`. Maximum: `300000`.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="settings" type="object">
  Model config. Defaults to the template's when a template is used.

  <Expandable title="settings">
    <ParamField body="model_name" type="string">
      e.g. 'gpt-4.1', 'claude-sonnet-5'. Maximum length: `200`.
    </ParamField>

    <ParamField body="model_provider" type="string">
      e.g. 'openai', 'anthropic'. Maximum length: `100`.
    </ParamField>

    <ParamField body="model_type" type="string">
      Maximum length: `100`.
    </ParamField>

    <ParamField body="temperature" type="number">
      Minimum: `0`. Maximum: `2`.
    </ParamField>

    <ParamField body="max_tokens" type="integer">
      Minimum: `1`. Maximum: `128000`.
    </ParamField>

    <ParamField body="top_p" type="number">
      Minimum: `0`. Maximum: `1`.
    </ParamField>

    <ParamField body="escalation_tag_name" type="string">
      Maximum length: `200`.
    </ParamField>

    <ParamField body="escalation_team_id" type="string">
      Maximum length: `200`.
    </ParamField>

    <ParamField body="agent_take_over_tag" type="string">
      Maximum length: `200`.
    </ParamField>
  </Expandable>
</ParamField>

### Response

`Agent`

<ResponseField name="object" type="string">
  Fixed value: `'agent'`.
</ResponseField>

<ResponseField name="id" type="string" />

<ResponseField name="name" type="string,null" />

<ResponseField name="type" type="string,null" />

<ResponseField name="description" type="string,null" />

<ResponseField name="activated" type="boolean" />

<ResponseField name="goal" type="string,null" />

<ResponseField name="role" type="string,null" />

<ResponseField name="updated_at" type="string,null" />

<ResponseField name="instructions" type="string,null">
  Present on single-agent reads and writes only.
</ResponseField>

<ResponseField name="settings" type="AgentSettingsOut">
  <Expandable title="AgentSettingsOut">
    <ResponseField name="object" type="string">
      Fixed value: `'agent.settings'`.
    </ResponseField>

    <ResponseField name="configured" type="boolean">
      False when no settings row exists yet (fields are all null).
    </ResponseField>
  </Expandable>
</ResponseField>

### Status codes

| Code | Meaning |
| - | - |
| `201` | The provisioned agent, with a summary of what was created |
| `400` | Invalid request. `issues` names the offending field(s). |
| `401` | Missing, invalid, or expired API key. |
| `403` | The key lacks a required scope. |
| `409` | Conflict — either the creation ceiling was reached for this organization (`agent_limit_reached`), or a request with the same Idempotency-Key is still in flight (`idempotency_in_progress`); retry the latter after the first attempt settles. |
| `422` | The Idempotency-Key was already used with a DIFFERENT request body (`idempotency_key_reused`). Reuse a key only to retry the identical request. |
| `429` | Rate limit exceeded. |

### Access

| | |
| - | - |
| Required scope | `agents:write` |
| Rate limit | 10 requests per minute |

### Using this contract

Read the [source OpenAPI document](/spec/responsecx.json) for declared schemas and alternatives.
This page also includes documented corrections from the [spec overlays](https://github.com/stateset/docs/tree/main/spec/overlays).
Example IDs and values are illustrative; replace them with records from your workspace.

<RequestExample>
  ```bash cURL theme={null}
  curl --silent --show-error --fail-with-body --request POST \
    --url 'https://response.stateset.com/api/v1/agents/provision' \
    --header "Authorization: Bearer $RESPONSECX_API_KEY" \
    --header "Idempotency-Key: ${IDEMPOTENCY_KEY:?Set a unique key for this operation; preserve it on retries}" \
    --header 'Content-Type: application/json' \
    --data '{
    "name": "Two-Person Tent",
    "template_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "type": "standard",
    "description": "Two-person tent, green — replacement for damaged pole set.",
    "instructions": "Two-person tent, green — replacement for damaged pole set.",
    "goal": "string",
    "role": "string",
    "activated": true,
    "rules": [
      {
        "rule_name": "string",
        "rule_type": "string",
        "description": "Two-person tent, green — replacement for damaged pole set.",
        "activated": true,
        "conditions": {
          "any": [],
          "all": []
        },
        "actions": []
      }
    ],
    "functions": [
      {
        "function_name": "string",
        "endpoint": "https://example.com/webhooks/stateset",
        "method": "string",
        "description": "Two-person tent, green — replacement for damaged pole set.",
        "activated": true,
        "parameters": [
          {
            "name": "Two-Person Tent",
            "type": "standard",
            "description": "Two-person tent, green — replacement for damaged pole set.",
            "required": true
          }
        ],
        "headers": {},
        "timeout": 1000
      }
    ],
    "settings": {
      "model_name": "string",
      "model_provider": "string",
      "model_type": "string",
      "temperature": 1.5,
      "max_tokens": 1,
      "top_p": 1,
      "escalation_tag_name": "string",
      "escalation_team_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "agent_take_over_tag": "string"
    }
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "object": "agent",
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "Two-Person Tent",
    "type": "standard",
    "description": "Two-person tent, green — replacement for damaged pole set.",
    "activated": true,
    "goal": "string",
    "role": "string",
    "updated_at": "2026-08-31T14:22:05Z",
    "instructions": "Two-person tent, green — replacement for damaged pole set.",
    "settings": {
      "object": "agent.settings",
      "configured": true
    }
  }
  ```
</ResponseExample>


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