# Create New AI Agent

`POST /api/agents/`

### Overview
Creates a new AI Agent with custom system prompt instructions, foundational model assignment, tool bindings, and personalization policies.

### Authentication & Headers
- **Auth**: Bearer Token (Role Level 1 or 2)
- **Required Header**: `API-Version: 1`

### Parameters & Request Body Fields
- **`name`** *(string, required)*: Display title of the AI Agent.
- **`description`** *(string, optional)*: Summary of the agent's capabilities and business domain.
- **`system_instruction`** *(string, required)*: The core system prompt that dictates the agent's persona and reasoning logic.
- **`model_id`** *(string, required)*: Unique ID of the backed LLM model (e.g. `mdl_gpt4o_enterprise`).
- **`temperature`** *(number, optional, default: 0.2)*: Sampling temperature between 0.0 (deterministic) and 1.0 (creative).
- **`allow_personalization`** *(boolean, optional, default: true)*: Whether interactive users' preferences can customize responses.
- **`tool_ids`** *(array of strings, optional)*: List of external tool IDs attached to this agent.

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `description` | string \| null | no |  |
| `avatar_url` | string \| null | no |  |
| `model_id` | string \| null | no |  |
| `identity` | string \| null | no |  |
| `mission` | string \| null | no |  |
| `methodology` | string \| null | no |  |
| `boundaries` | string \| null | no |  |
| `examples` | string \| null | no |  |
| `tools` | object[] | no |  |
| `sub_agents` | object[] | no |  |
| `output_key` | string \| null | no |  |
| `output_schema` | object \| null | no |  |
| `input_schema` | object \| null | no |  |
| `generate_content_config` | object | no |  |
| `disallow_transfer_to_parent` | boolean | no |  |
| `disallow_transfer_to_peers` | boolean | no |  |
| `planner` | object \| null | no |  |
| `orchestration_type` | string | no |  |
| `orchestration_config` | object | no |  |
| `canvas_position` | object \| null | no |  |
| `canvas_connections` | object \| null | no |  |
| `allow_personalization` | boolean | no |  |
| `is_public` | boolean | no |  |
| `is_template` | boolean | no |  |
| `is_sub_agent` | boolean | no |  |
| `role_group_id` | string \| null | no |  |

```json
{
  "name": "string",
  "description": "string",
  "avatar_url": "string",
  "model_id": "string",
  "identity": "string",
  "mission": "string",
  "methodology": "string",
  "boundaries": "string",
  "examples": "string",
  "tools": [
    null
  ],
  "sub_agents": [
    null
  ],
  "output_key": "string",
  "output_schema": {},
  "input_schema": {},
  "generate_content_config": {},
  "disallow_transfer_to_parent": false,
  "disallow_transfer_to_peers": false,
  "planner": {},
  "orchestration_type": "agent",
  "orchestration_config": {},
  "canvas_position": {},
  "canvas_connections": {},
  "allow_personalization": true,
  "is_public": false,
  "is_template": false,
  "is_sub_agent": false,
  "role_group_id": "string"
}
```

## Responses

### 201 — Agent successfully created in draft state

### 400 — Bad Request - The request parameters or headers are invalid (e.g. unsupported API-Version).

### 401 — Unauthorized - Missing, invalid, or expired JWT Bearer token.

### 403 — Forbidden - Insufficient role permissions or resource access denied by RBAC policy.

### 404 — Not Found - The requested resource ID was not found.

### 422 — Validation Error

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `detail` | object[] | no |  |
| `detail[].loc` | string | integer[] | yes |  |
| `detail[].msg` | string | yes |  |
| `detail[].type` | string | yes |  |
| `detail[].input` | object | no |  |
| `detail[].ctx` | object | no |  |

```json
{
  "detail": [
    {
      "loc": [
        null
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

## Example

```bash
curl -X POST "$PINTER_URL/api/agents/" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","description":"string","avatar_url":"string","model_id":"string","identity":"string","mission":"string","methodology":"string","boundaries":"string","examples":"string","tools":[null],"sub_agents":[null],"output_key":"string","output_schema":{},"input_schema":{},"generate_content_config":{},"disallow_transfer_to_parent":false,"disallow_transfer_to_peers":false,"planner":{},"orchestration_type":"agent","orchestration_config":{},"canvas_position":{},"canvas_connections":{},"allow_personalization":true,"is_public":false,"is_template":false,"is_sub_agent":false,"role_group_id":"string"}'
```
