> ## 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.

# 运行智能体 - POST /v1/workspaces/:workspace_id/agent/run

> 通过 POST /v1/workspaces/:workspace_id/agent/run 让自主智能体按目标运行，SSE 流式返回。最小角色 viewer。

让一个自主智能体（ReAct Agent）围绕给定目标运行若干步，可携带编队（Agent Loadout）。接口以 **SSE** 流式返回执行过程与结果。

## 接口

```http theme={null}
POST /v1/workspaces/:workspace_id/agent/run
```

## 认证

`Authorization: Bearer <jwt>` 或 `X-API-Key <sk_...>`。最小角色：**viewer**。

## 路径参数

<ParamField path="workspace_id" type="string" required>
  工作空间 id。
</ParamField>

## 请求体

<ParamField body="goal" type="string" required>
  智能体要达成的目标。
</ParamField>

<ParamField body="max_steps" type="integer">
  最大执行步数。
</ParamField>

<ParamField body="agent_id" type="string">
  要套用的智能体编队 id；省略则使用默认能力。
</ParamField>

## 响应（流式）

`Content-Type: text/event-stream`。每个 `data:` 行是增量文本；若目标关联了编队，智能体会自动装配其绑定的知识库、记忆立方、技能等资产。

## 示例

<RequestExample>
  ```bash cURL theme={null}
  curl -N -X POST https://memo.ariacompute.cn/v1/workspaces/ws_01a2b3c4d5e6/agent/run \
    -H "Authorization: Bearer <jwt>" \
    -H "Content-Type: application/json" \
    -d '{"goal":"整理本周新增文档的要点","max_steps":10,"agent_id":"agent_01a2b3c4d5e6"}'
  ```
</RequestExample>

<ResponseExample>
  ```text stream theme={null}
  data: 正在检索知识库...
  data: 已提取 3 条要点：
  data: 1. AriaMem 支持双向转换
  data: 2. 记忆分四层
  data: 3. 立方体可设可见性
  ```
</ResponseExample>


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