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

# Create Agent

> Create an agent for a chatbot specified by chatbot uuid

### Path

<ParamField path="uuid" type="string" required>
  Chatbot uuid
</ParamField>

### Body

<ParamField body="name" type="string" required />

<ParamField body="type" type="string" required>
  One of the following values: `user-facing`, `background`, `human-escalation`,
  `pre-canned`, `spam-defense`
</ParamField>

<ParamField body="description" type="string" />

<ParamField body="prompt" type="string" />

<ParamField body="temperature" type="float" />

<ParamField body="meta" type="meta Object">
  <Expandable title="Chatbot meta">
    <ParamField body="model" type="string" />| Model | Message Credits |
    \|-------|-----------------| | gpt-3.5-turbo | 1 | | gpt-3.5-turbo-16k | 8 |
    \| gpt-4-0125-preview-8k | 35 | | gpt-4-1106-preview-1k | 5 | |
    gpt-4-1106-preview-2k | 10 | | gpt-4-1106-preview-4k | 20 | |
    gpt-4-1106-preview-16k | 60 | | gpt-4o-1k | 3 | | gpt-4o-2k | 5 | |
    gpt-4o-4k | 10 | | gpt-4o-8k | 20 | | gpt-4o-16k | 40 | | gpt-4o-mini-4k | 1
    \| | gpt-4o-mini-16k | 8 | Only for <code>user-facing</code> and{" "}
    <code>background</code> agents.
  </Expandable>
</ParamField>

<ParamField body="temperature" type="float">
  Between <code>0</code> and <code>1</code>

  <br />

  Only for <code>user-facing</code> agents.
</ParamField>

<ParamField body="bias" type="float">
  Between <code>0</code> and <code>1</code>.<br />
  Only for <code>user-facing</code>, <code>human-escalation</code>, <code>pre-canned</code> and <code>spam-defense</code> agents.
</ParamField>

<ParamField body="stickness" type="float">
  Between <code>0</code> and <code>1</code>.<br />
  Only for <code>user-facing</code>, <code>human-escalation</code>, <code>pre-canned</code> and <code>spam-defense</code> agents.
</ParamField>

<ParamField body="default_message" type="string">
  Only for <code>pre-canned</code> and <code>spam-defense</code> agents.
</ParamField>

<ParamField body="tags" type="tags Object">
  Only for <code>background</code> agents.
</ParamField>

<ParamField body="use_all_sources" type="boolean">
  Only for <code>user-facing</code> agents.
</ParamField>

### Response

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

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

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

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

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

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

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

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

<Note>By default, a newly created agent is disabled</Note>

<ResponseField name="meta" type="meta Object" />

<ResponseField name="data_source_uuids" type="List[string]" />

<ResponseField name="human_escalation_settings" type="HumanEscalationSettings Object" />

<ResponseField name="tool_functions" type="List[ToolFunction]" />

<ResponseField name="variables" type="List[AgentVariable]" />

<RequestExample>
  ```bash Curl theme={null}
  curl --location --request POST 'https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/agent/create' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <token>' \
  --data-raw '{
    "name": "string",
    "type": "string",
    "description": "string",
    "prompt": "string",
    "model": "string",
  }'
  ```

  ```py Python theme={null}
  import requests

  url = 'https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/agent/create'
  headers = {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer <token>'
  }

  data = {
    "name": "string",
    "type": "user-facing",
    "description": "string",
    "prompt": "string",
    "model": "gpt-4o-mini-4k",
  }

  response = requests.post(url, headers=headers, json=data)

  if response.status_code == 200:
      print("Request successful!")
      print(response.json())
  else:
      print("Request failed with status code:", response.status_code)
      print(response.text)
  ```

  ```ts JavaScript theme={null}
  const axios = require("axios");

  const url = "https://app.gpt-trainer.com/api/v1/chatbot/{uuid}/agent/create";
  const headers = {
    "Content-Type": "application/json",
    Authorization: "Bearer <token>",
  };

  const data = {
    name: "string",
    prompt: "string",
    temperature: 0,
    model: "gpt-3.5-turbo",
    rate_limit: [20, 240],
    rate_limit_message: "Too many messages",
    show_citations: false,
    visibility: "private",
  };

  axios
    .post(url, data, { headers })
    .then((response) => {
      console.log("Request successful!");
      console.log(response.data);
    })
    .catch((error) => {
      console.error("Request failed:", error);
    });
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "created_at": "2024-07-25T21:19:01Z",
    "description": "test for creating new agents",
    "enabled": 0,
    "meta": {
      "model": "gpt-4o-mini-4k",
      "tags": [],
      "temperature": 0.0
    },
    "modified_at": "2024-07-25T21:19:01Z",
    "name": "TEST create new agent",
    "prompt": "a test user-facing agent",
    "type": "user-facing",
    "uuid": "43474da7ae3b4b7191ee29c2de798257",
    "variables": []
  }
  ```
</ResponseExample>
