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

# 에이전트

> 에이전트를 만들고, 상세를 조회하고, 고치고, 삭제해요. 쓰기는 배포와 운영 반영까지 한 번에 해요.

## 할 수 있는 일

에이전트의 프롬프트·LLM·도구·지식·발신 설정을 서버에서 관리해요.

| 메서드 · 경로 | 성공 응답 |
| - | - |
| `GET /agents` | `200` + `{ data }` ([대상 목록](https://docs.telloai.io/developer/rest/targets.md#에이전트-목록)) |
| `GET /agents/{id}` | `200` + 에이전트 객체 |
| `POST /agents` | `201` + 에이전트 객체 |
| `PATCH /agents/{id}` | `200` + 에이전트 객체 |
| `DELETE /agents/{id}` | `204` 본문 없음 |

`GET /agents` 목록은 통화에 쓸 수 있는 에이전트의 id·이름·설명만 돌려줘요. 전체 설정은
상세로 조회하세요.

> [!NOTE]
>
> 생성·수정은 저장, 배포, 운영 반영을 한 번에 해요. 응답을 받은 **다음 통화부터** 새 설정을 써요.
> API로 만든 에이전트는 바로 대상 목록에 보이고 [통화 생성](https://docs.telloai.io/developer/rest/create-call.md)에 쓸 수 있어요.

## 에이전트 객체

```json theme={null}
{
  "id": "12",
  "name": "예약 안내",
  "description": "예약 일정을 확인하고 변경을 도와줘요",
  "engineMode": "cascading",
  "systemPrompt": "당신은 예약센터 상담원이에요.",
  "firstMessage": "안녕하세요, 텔로 예약센터입니다.",
  "firstMessageOutbound": null,
  "firstMessageMode": "agent_first",
  "llm": { "model": "openai/gpt-4o-mini", "temperature": null, "maxTokens": null, "reasoningEffort": null, "verbosity": null },
  "toolIds": ["41", "7"],
  "knowledgeIds": ["3"],
  "speech": { "bargeIn": true, "greetingBargeIn": false, "waitCue": true, "customCue": false },
  "privacy": { "piiMasking": false, "maskNames": false },
  "memoryEnabled": false,
  "notifyEnabled": false,
  "webhookUrl": "https://example.com/tello/webhook",
  "outbound": {
    "retry": { "enabled": false, "maxRetries": 0, "intervalSeconds": 300, "onBusy": true, "onNoAnswer": true, "onVoicemail": false },
    "amd": { "enabled": false, "silenceTimeoutSeconds": null },
    "ivr": { "enabled": false, "goal": null, "waitEnabled": false, "waitMaxSeconds": 600, "notifyNumber": null, "notifyChannels": [] }
  },
  "status": "published",
  "revision": 5,
  "productionRevision": 5,
  "createdAt": "2026-11-12T01:00:00.000Z",
  "updatedAt": "2026-11-12T01:02:00.000Z"
}
```

| 필드 | 설명 |
| - | - |
| `engineMode` | `cascading` 또는 `s2s`. 만들 때만 정할 수 있어요 |
| `systemPrompt` | 에이전트 프롬프트예요 |
| `firstMessage` · `firstMessageOutbound` | 받는 전화·거는 전화의 첫 인사예요. 읽기 좋은 발음형으로 바꿔 저장해요 |
| `firstMessageMode` | 누가 먼저 말할지예요 |
| `llm` | 모델과 `temperature`·`maxTokens`·`reasoningEffort`·`verbosity`예요. `null`은 모델 기본값이에요 |
| `toolIds` | 붙은 도구 id 목록이에요. 늘 각 도구의 최신 판을 써요 |
| `knowledgeIds` | 붙은 지식 id 목록이에요 |
| `speech` | 말 끊기(`bargeIn`), 첫 인사 중 말 끊기(`greetingBargeIn`), 대기 호응어(`waitCue`), 사용자 호응어(`customCue`)예요 |
| `privacy` | 개인정보 가림(`piiMasking`)과 이름 가림(`maskNames`)이에요 |
| `webhookUrl` | 통화 이벤트 [웹훅](https://docs.telloai.io/developer/rest/webhooks.md) 주소예요. `null`이면 보내지 않아요. [웹훅 주소](#웹훅-주소)를 보세요 |
| `outbound.retry` | 재발신 설정이에요 |
| `outbound.amd.silenceTimeoutSeconds` | 자동응답 감지 무음 시간, 1\~60초 |
| `outbound.ivr.waitMaxSeconds` | ARS 대기 최대 시간, 30\~1800초 |
| `status` · `revision` · `productionRevision` | 배포 상태, 최신 판, 운영 판 번호예요 |

목소리·STT·TTS는 에이전트가 아니라 채널 설정이에요. 이 API로는 바꿀 수 없어요.

## 에이전트 상세

```bash theme={null}
curl "https://api.telloai.io/v1/agents/12" \
  --header "Authorization: Bearer <API_KEY>"
```

배포 여부와 관계없이 삭제되지 않은 에이전트를 돌려줘요. 다른 계정·삭제된 에이전트·없는 id·숫자가
아닌 id는 모두 `404 agent_not_found`예요.

## 에이전트 생성

```bash theme={null}
curl --request POST "https://api.telloai.io/v1/agents" \
  --header "Authorization: Bearer <API_KEY>" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: agent-reservation-001" \
  --data '{
    "name": "예약 안내",
    "systemPrompt": "당신은 예약센터 상담원이에요.",
    "firstMessage": "안녕하세요, 텔로 예약센터입니다.",
    "llm": { "model": "openai/gpt-4o-mini" },
    "toolIds": ["41"]
  }'
```

* 필수 필드는 `name` 하나예요. 나머지는 위 객체의 필드를 같은 모양으로 보내요.
* `engineMode` 기본값은 `cascading`이에요.
* `toolIds`를 빼면 기본 통화 종료 도구만 붙어요.
* `toolIds`·`knowledgeIds`에 이 계정의 것이 아닌 id가 있으면 `400 invalid_agent`예요.
  `data.reason`은 `tool_reference_invalid`나 `knowledge_reference_invalid`예요.
* `llm` 값의 범위는 모델마다 달라요. 벗어나면 `400 invalid_agent`예요.
* 모르는 필드는 무시하고, 타입이 틀린 필드는 `400 invalid_agent`예요.
* `webhookUrl`이 규칙에 맞지 않으면 `400 invalid_agent`예요. [웹훅 주소](#웹훅-주소)를 보세요.

### 중복 생성 방지

`Idempotency-Key` 헤더는 선택이에요. 규칙은 [통화 생성](https://docs.telloai.io/developer/rest/create-call.md#중복-발신-방지)과 같아요.

* 키는 계정 범위이고 24시간 동안 기억해요. 1\~255자이고 쉼표를 넣을 수 없어요.
* **`201`과 `502 write_outcome_unknown`만** 저장해요. 같은 키·같은 본문으로 다시 보내면 저장된
  상태 코드·본문을 그대로 돌려주고 새로 만들지 않아요.
* 같은 키로 다른 본문을 보내면 `409 idempotency_key_reused`, 같은 요청이 처리 중이면
  `409 idempotency_in_progress`예요.
* 그 밖의 거절(`4xx`·`500`·`503 upstream_unavailable`)은 저장하지 않아요. 원인을 해소한 뒤 같은
  키로 다시 보낼 수 있어요.

> [!WARNING]
>
> `502 write_outcome_unknown`은 에이전트가 이미 만들어졌을 수 있다는 뜻이에요. 같은 키로 다시 보내도 저장된
> `502`만 다시 오고 새로 만들지 않아요. [에이전트 상세](#에이전트-상세)나 [대상 목록](https://docs.telloai.io/developer/rest/targets.md#에이전트-목록)에서 먼저 확인하세요. 없을 때만 **새 키로** 다시
> 만드세요. 확인하지 않고 새 키로 보내면 에이전트가 두 번 생길 수 있어요.

## 에이전트 수정

`PATCH`는 **보낸 필드만** 바꿔요. `toolIds`·`knowledgeIds`는 목록을 **통째로 바꿔요**.
내용이 그대로면 새 판을 만들지 않아요.

```bash theme={null}
curl --request PATCH "https://api.telloai.io/v1/agents/12" \
  --header "Authorization: Bearer <API_KEY>" \
  --header "Content-Type: application/json" \
  --data '{"toolIds":["41","7"],"speech":{"bargeIn":false}}'
```

`engineMode`를 다른 값으로 보내면 `409 agent_engine_immutable`이에요. 엔진을 바꾸려면 새 에이전트를 만드세요.

### 웹훅 주소

`webhookUrl`은 통화가 울리고·시작하고·전환하고·끝날 때 [통화 이벤트 웹훅](https://docs.telloai.io/developer/rest/webhooks.md)을 받을 `https` 주소예요.
생성과 `PATCH`에서 보내고, `PATCH`에 `null`을 보내면 지워요.

* 판·배포와 상관없이 저장하는 즉시 다음 통화부터 적용돼요. `webhookUrl`만 바꾸면 새 판을 만들지 않아요.
* 인증 헤더·HTTP 헤더·타임아웃은 API로 정할 수 없어요. 포털 에이전트 편집의 **웹훅** 탭에서 정해요. `PATCH`에 `null`을 보내 주소를 지우면 저장된 인증 헤더와 HTTP 헤더도 함께 지워져요.
* 주소 규칙은 [웹훅 주소 규칙](https://docs.telloai.io/developer/rest/webhooks.md#주소-규칙)을 보세요.

```bash theme={null}
curl --request PATCH "https://api.telloai.io/v1/agents/12" \
  --header "Authorization: Bearer <API_KEY>" \
  --header "Content-Type: application/json" \
  --data '{"webhookUrl":"https://example.com/tello/webhook"}'
```

검사에 실패하면 `400 invalid_agent`이고 `data.detail`에 이유를 한국어로 줘요.

| `data.reason` | 의미 |
| - | - |
| `webhook_url_invalid` | `https`가 아니거나, 사용자 정보·허용하지 않는 포트가 있거나, 2048자를 넘었어요 |
| `webhook_url_blocked` | 호스트가 내부 이름이거나 공인 주소가 아닌 곳으로 풀려요 |

## 에이전트 삭제

```bash theme={null}
curl --request DELETE "https://api.telloai.io/v1/agents/12" \
  --header "Authorization: Bearer <API_KEY>"
```

성공하면 본문 없이 `204`가 와요. 아래 경우는 `409 agent_in_use`예요.

| `data.reason` | 의미 |
| - | - |
| `default_target` | 계정 기본 대상이에요 |
| `channel_linked` | 채널에 연결돼 있어요. `data.channels`에 채널, `data.numbers`에 수신 번호가 와요 |
| `inbound_linked` | 수신 번호에 연결돼 있어요 |

## 배포할 수 없을 때

배포 조건을 저장 **전에** 확인해요. 맞지 않으면 아무것도 저장하지 않고 `422 agent_not_publishable`을 돌려줘요.

| `data.reason` | 의미 |
| - | - |
| `byok_required` | 계정에 쓸 LLM 키가 등록돼 있지 않아요 |
| `deploy_config_invalid` | 배포 검증을 통과하지 못했어요 |
| `ars_gate` | `outbound.ivr.enabled`를 켤 수 있는 조건이 아니에요 |

## 오류

오류의 `message`는 코드마다 정해진 영문 문장이에요. 무엇이 문제인지는 한국어 설명인
`data.detail`을 보세요. 분기는 `error`와 `data.reason`으로 하세요. `data.detail` 문구는 달라질 수 있어요.

| HTTP | 코드 | 대처 |
| - | - | - |
| `400` | `invalid_request` | 본문을 JSON 객체로 보내세요 |
| `400` | `invalid_agent` | `data.detail`과 `data.reason`을 보고 필드를 고치세요 |
| `404` | `agent_not_found` | 현재 계정의 에이전트 id인지 확인하세요 |
| `409` | `agent_engine_immutable` | `engineMode`를 빼고 보내세요 |
| `409` | `agent_in_use` | 기본 대상·채널·수신 번호 연결을 먼저 바꾸세요 |
| `422` | `agent_not_publishable` | 위 `data.reason` 표를 보세요 |
| `409` | `idempotency_key_reused` | 같은 키로 다른 본문을 보냈어요. 새 에이전트에는 새 키를 쓰세요 |
| `409` | `idempotency_in_progress` | 같은 키의 요청이 처리 중이에요. 잠시 뒤 같은 키로 다시 보내세요 |
| `502` | `write_outcome_unknown` | 반영됐는지 알 수 없어요. 같은 키로 다시 보내도 저장된 `502`만 와요. **목록·상세로 확인한 뒤** 없을 때만 새 키로 다시 만드세요. 수정·삭제도 상세로 확인한 뒤 다시 보내세요 |
| `503` | `upstream_unavailable` | 요청이 처리되지 않았어요. 잠시 뒤 다시 보내세요 |

그 밖의 오류는 [REST 오류](https://docs.telloai.io/developer/rest/errors.md)를 보세요.

## 관련 문서

* [도구](https://docs.telloai.io/developer/rest/tools.md)
* [크루](https://docs.telloai.io/developer/rest/crews.md)
* [대상 목록](https://docs.telloai.io/developer/rest/targets.md)


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