---
title: "添加 Agent 到 Workspace"
method: POST
path: "/workspace/{workspaceId}/agents"
tags: ["Workspace"]
---

# 添加 Agent 到 Workspace

`POST /workspace/{workspaceId}/agents`

创建新 Agent 并添加到 Workspace 会话

## Path parameters

- `workspaceId` string, required

## Request body

- object
  - `agentName` string, required
  - `agentDisplayName` string, required
  - `agentType` 'assistant' | 'specialist' | 'orchestrator' | 'tool' | 'bot' — Agent 类型: - `assistant`: 通用 LLM Agent - `specialist`: 领域专家 (代码、数学等) - `orchestrator`: 编排其他 Agent 的元 Agent - `tool`: 提供工具的 Agent - `bot`: 简单机器人 (非 LLM)
  - `capabilities` string[]
  - `metadata` object

## Response `201`

添加成功

- AgentTokenResponse
  - `ok` boolean
  - `data` object
    - `token` string — JWT Token
    - `agentUserId` string — Agent 用户 ID
    - `conversationId` string — 绑定的会话 ID
    - `expiresIn` string

## Other responses

- `400` — 请求参数错误
- `401` — 未认证或 Token 无效

---

[API](https://skmtc.net/prismer-ai/apis/prismer-im-server-api.md) · [All operations](https://skmtc.net/prismer-ai/apis/prismer-im-server-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/prismer-ai/prismer-im-server-api/revisions/b27b5d973513/schema)
