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

# Create Agent

> Create a new AI agent with the specified configuration.

Create a new AI agent with the specified configuration.

### Request body

`AgentConfigRequest`

**model\_name** `string` *required*

Name of the model to use

**max\_new\_tokens** `integer`

Maximum tokens to generate

**temperature** `number`

Sampling temperature

**top\_p** `number`

Top-p sampling parameter

**top\_k** `integer`

Top-k sampling parameter

**system\_prompt** `string,null`

System prompt for the agent

**use\_chat\_template** `boolean`

Whether to use chat template

**enable\_planning** `boolean`

Enable long-term planning

**planning\_config** `object,null`

Planning configuration overrides

### Response

`AgentCreatedResponse`

**agent\_id** `string` *required*

Unique identifier for the created agent

**created\_at** `string (date-time)`

Creation timestamp

**config** `AgentConfigRequest` *required*

Agent configuration

**AgentConfigRequest**

**model\_name** `string` *required*

Name of the model to use

**max\_new\_tokens** `integer`

Maximum tokens to generate

**temperature** `number`

Sampling temperature

**top\_p** `number`

Top-p sampling parameter

**top\_k** `integer`

Top-k sampling parameter

**system\_prompt** `string,null`

System prompt for the agent

**use\_chat\_template** `boolean`

Whether to use chat template

**enable\_planning** `boolean`

Enable long-term planning

**planning\_config** `object,null`

Planning configuration overrides

**message** `string`

Status message

### Status codes

| Code | Meaning |
| - | - |
| `200` | Successful response |
| `201` | Agent created successfully |
| `400` | Invalid configuration |
| `401` | Authentication required |
| `422` | Validation Error |
| `429` | Rate limit exceeded |
| `500` | Internal server error |

```bash cURL theme={null}
curl --request POST \
  --url 'http://localhost:8000/agents' \
  --header "Authorization: Bearer $STATESET_AGENTS_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "enable_planning": true,
  "max_new_tokens": 256,
  "model_name": "gpt2",
  "planning_config": {
    "max_steps": 4
  },
  "system_prompt": "You are a helpful AI assistant.",
  "temperature": 0.7,
  "top_p": 0.9
}'
```

```json 200 theme={null}
{
  "agent_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "created_at": "2026-08-31T14:22:05Z",
  "config": {
    "enable_planning": true,
    "max_new_tokens": 256,
    "model_name": "gpt2",
    "planning_config": {
      "max_steps": 4
    },
    "system_prompt": "You are a helpful AI assistant.",
    "temperature": 0.7,
    "top_p": 0.9
  },
  "message": "Agent created successfully"
}
```


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