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

# 为某个智能体创建咏唱引擎云会话

> 创建绑定到某个智能体的咏唱引擎云会话。会话会累积轮次、条目、记忆片段与子智能体状态。

创建一个绑定到某个智能体的会话。会话在其整个生命周期内累积轮次、条目、记忆片段与子智能体状态。向会话投递事件即可运行一个轮次。

## 接口

```http theme={null}
POST /v1/agents/sessions
```

## 认证

`Authorization: Bearer <api_key>` 或 `Authorization: ApiKey <api_key>`。

## 请求体

<ParamField body="agent_id" type="string" required>
  要将此会话绑定到的智能体标识符。
</ParamField>

<ParamField body="metadata" type="object">
  随会话存储的自由格式元数据。
</ParamField>

## 响应

<ResponseField name="id" type="string">
  会话标识符。
</ResponseField>

<ResponseField name="object" type="string">
  恒为 `agent.session`。
</ResponseField>

<ResponseField name="agent_id" type="string">
  绑定的智能体标识符。
</ResponseField>

<ResponseField name="status" type="string">
  会话状态，通常为 `active`。
</ResponseField>

<ResponseField name="metadata" type="object">
  创建时提供的元数据。
</ResponseField>

<ResponseField name="created_at" type="integer">
  Unix 秒。
</ResponseField>

## 示例

```bash theme={null}
curl -X POST https://agent.example.com/v1/agents/sessions \
  -H "Authorization: Bearer $ARIA_AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "ag_0198a...", "metadata": {"user_id": "u_42"}}'
```

```json theme={null}
{
  "id": "sess_0198c...",
  "object": "agent.session",
  "agent_id": "ag_0198a...",
  "status": "active",
  "metadata": {"user_id": "u_42"},
  "created_at": 1735000000
}
```
