> Source: https://clickhouse.github.io/loom/zh-CN/reference/operations/assistant/ (Markdown: https://clickhouse.github.io/loom/zh-CN/reference/operations/assistant.md)

<!-- i18n: source=docs/reference/operations/assistant.md blob=8776e14406e66ab7af3b886a055d72761355b550 model=claude-sonnet-5-5 -->
> 本页由机器从[英文原文](https://clickhouse.github.io/loom/reference/operations/assistant/)翻译，内容以英文原文为准。
> Machine-translated from the [English page](https://clickhouse.github.io/loom/reference/operations/assistant/), which is authoritative.

<a id="assistant-operations"></a>

# `assistant` 操作

每个 `assistant.*` 操作接受和返回的确切字段。

<!-- Generated by `python scripts/codegen/docs_reference.py` from the op registry; edit the models, not this page. -->

每个操作都是 HTTP 上的 `POST /v1/<op>`，同时也是 MCP 工具 `loom_<op>`。身份字段（`org`、`namespace`、`agent`、`user_id`、`session_id`）会在传输层能够提供时，由令牌和 MCP 会话填充；对于单用户服务器上不带令牌的 HTTP 调用，除 `code.*` 和 `tracker.*`（它们保留各自所属平面的 org）之外，所有操作都使用安装时的 org，而在[部分操作](https://github.com/ClickHouse/loom/blob/main/docs/reference/http-api.md#request)上，其命名空间和 agent 也由安装默认值填充；参见[身份与命名空间](https://github.com/ClickHouse/loom/blob/main/docs/concepts/identities-and-namespaces.md)。[操作索引](https://github.com/ClickHouse/loom/blob/main/docs/reference/operations.md)说明了角色、类别以及 MCP 的 `all` 列表。未知的输入字段仍会被处理，并列在 `ignored_args` 中。

<!-- prettier-ignore-start -->

<a id="assistantask"></a>

## `assistant.ask`

向 Loom 助手询问一个关于此命名空间的问题，并获得一个带引用的回答：命名空间中存放了什么、如何使用、对其行数据的计数，以及如何更好地写入。

`POST /v1/assistant.ask` · MCP `loom_assistant_ask` · 角色 `viewer` · 写入 · 未列在 MCP `all` 工具集中

| 输入字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
| `org` | `str` | 必填 | 租户（身份元组的第一个元素）。 |
| `namespace` | `str` | 必填 | 该操作读取或写入的命名空间。 |
| `question` | `str` | 必填 | 关于此命名空间的问题，以调用者的身份回答，最多 20,000 个字符。 |
| `history` | `list[AssistantMessage]` | *（计算得出）* | 对话中较早的轮次，按从旧到新排序，最多 50 轮；默认为空。 |

| 输出字段 | 类型 | 含义 |
| --- | --- | --- |
| `mirrored` | `bool` | 当此回答仅对调用者受保护的会话私有时为 true；默认为 false。 |
| `answer` | `str` | 助手的回答，其中的引用保持 agent 写出时的样子。 |
| `run_id` | `str` | 回答的 id：其工具调用所记录到的运行（agent_events.run_id）。 |
| `model` | `str` | 给出回答的模型。 |
| `citations` | `list[AssistantCitation]` | `answer` 中的每条引用，在回答结束时已检查。 |
| `support` | `str` | 回答在多大程度上以 Loom 所存放的内容为依据：supported、unsupported、unchecked 或 none（没有论断，例如问候或放弃回答）；默认为 unchecked。 |
| `unknown_names` | `list[str]` | 回答中以反引号写出的操作名，以及其中任何位置出现的 LOOM_* 名称，而此构建既不提供也没有文档记载：这些名称可能是虚构的。 |

<!-- prettier-ignore-end -->
