向 Forward Session 写入用户或系统输入事件。
请求头
Header | 是否必填 | 说明 |
Authorization | 是 |
|
Content-Type | 是 |
|
Idempotency-Key | 否 | 有副作用请求可选的幂等键。 |
路径参数
参数 | 类型 | 是否必填 | 说明 |
| string | 是 | Session ID。 |
请求体
字段 | 类型 | 必选 | 说明 |
| array | 是 | 事件对象数组 |
| string | 是 | 事件类型 |
| string \ | array | 视类型 |
| string | 是 | 内容块类型,如 |
| string | 是 | 文本内容 |
content 支持两种格式:
简写:纯字符串
"content": "文本内容"完整:内容块数组
"content": [{"type": "text", "text": "文本内容"}]
纯文本消息建议使用简写格式;需要发送多媒体内容(如图片)时使用完整格式。
支持的事件类型
type | 说明 | 必填字段 |
| 用户发送消息 |
|
| 用户中断 Agent 执行 | - |
| 对 Agent 的工具调用进行授权 |
|
| 返回自定义工具的执行结果 |
|
| 用户定义预期结果 |
|
示例请求
curl -s -X POST 'https://api.qoder.com.cn/api/v1/forward/sessions/sess_xxx/events' \
-H "Authorization: Bearer $QODER_PAT" \
-H "Content-Type: application/json" \
-d '{
"events": [
{
"type": "user.message",
"content": [
{
"type": "text",
"text": "Continue the analysis."
}
]
}
]
}'
示例响应
HTTP 200 OK
{
"data": [
{
"id": "evt_xxx",
"type": "user.message",
"session_id": "sess_xxx",
"content": [
{
"type": "text",
"text": "Continue the analysis."
}
],
"processed_at": "2026-06-22T11:00:00Z"
}
]
}
响应字段
字段 | 类型 | 说明 |
| array | 创建后的 Event 对象数组,已按 Forward 规则过滤。 |
错误
HTTP | Type | Code | 触发条件 |
400 |
|
| Event 类型或字段不合法。 |
404 |
|
| Session 不存在。 |
409 |
|
| Session 已归档。 |
409 |
|
| 当前 Turn 状态不允许新建 Turn。 |
404 |
|
| 工具确认或结果找不到对应 Pending Action。 |
409 |
|
| Pending Action 已处理。 |
401 |
|
| PAT 无效或已过期。 |
备注
允许写入的类型包括
user.message、user.interrupt、user.tool_confirmation、user.tool_result、user.custom_tool_result、user.define_outcome和system.message。system.message每次请求最多一条,必须是最后一个事件。响应不会返回运行时原始 event JSON。