---
title: "Create Agent"
method: POST
path: "/agents/{name}"
tags: ["agents"]
---

# Create Agent

`POST /agents/{name}`

## Request

- Base URL: `https://api.agent4.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.agent4.io/agents/{name}`
- Auth: none declared

## Path parameters

- `name` string, required

## Request body

- AgentIn
  - `soul` string
  - `task` string
  - `tools` string[]
  - `skills` string[]
  - `knowledge_bases` string[]
  - `history_window` integer, nullable
  - `max_output_tokens` integer, nullable
  - `tool_call_max_tokens` integer, nullable: 发起工具调用那一轮的输出预算（token）。工具的入参也算模型输出，而导出文档的入参就是整份文档，所以这个值决定了智能体一次能写多长的文档。 调大：面对大上下文的复杂问题，智能体能把话讲透、文档写全；代价是这类回合更慢（约 160 token/秒，写满 16K 约需 100 秒），且会更快消耗月度 token 配额。 调小：更快更省，但复杂问题会被迫简答。低于下限的值会被抬回下限——设得过小不会让文档变短，而是让参数 JSON 被截断、整个导出失败。 留空使用平台默认值。
  - `model` string, nullable
  - `published` boolean
  - `greeting` string, nullable
  - `auto_greeting` boolean
  - `auto_suggest` boolean
  - `suggest_prompt` string, nullable
  - `ask_forms` boolean
  - `proactive_cta` boolean
  - `cta_prompt` string, nullable
  - `no_match_reply` string, nullable
  - `reasoning` boolean
  - `grounding_required` boolean
  - `injection_guard` boolean
  - `public_sources` boolean
  - `ambiguity_check` boolean
  - `deep_research` boolean
  - `on_demand_context` boolean
  - `guard_escalation` boolean
  - `menu_items` string[], nullable

## Response `201`

Successful Response

- AgentOut
  - `name` string, required
  - `id` string, nullable
  - `alias` string, nullable
  - `soul` string, required
  - `task` string, required
  - `tools` string[], required
  - `skills` string[]
  - `knowledge_bases` string[]
  - `history_window` integer, nullable
  - `max_output_tokens` integer, nullable
  - `tool_call_max_tokens` integer, nullable
  - `model` string, nullable
  - `published` boolean
  - `greeting` string, nullable
  - `auto_greeting` boolean
  - `auto_suggest` boolean
  - `suggest_prompt` string, nullable
  - `ask_forms` boolean
  - `proactive_cta` boolean
  - `cta_prompt` string, nullable
  - `no_match_reply` string, nullable
  - `reasoning` boolean
  - `grounding_required` boolean
  - `injection_guard` boolean
  - `public_sources` boolean
  - `ambiguity_check` boolean
  - `deep_research` boolean
  - `on_demand_context` boolean
  - `guard_escalation` boolean
  - `menu_items` string[], nullable
  - `source` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/agent4/apis/chatagent-platform.md) · [All operations](https://skmtc.dev/agent4/apis/chatagent-platform/llms.txt) · [OpenAPI document](https://skmtc.dev/agent4/apis/chatagent-platform/revisions/18e58f082ce3?raw)
