# 智能体与工具

> 智能体配置定义智能体的行为方式（模型、提示词、允许的工具、限额），认知工具定义智能体可调用的一项能力及其结构、安全等级和限额。目前两者都是受治理的定义，尚无节点运行智能体。

Source: https://docs.sommatic.ai/zh/ai/agents-and-tools/ (updated 2026-11-26)

在 Sommatic AI 中，智能体不是“提示词加上几个工具”，而是由组织治理的一份配置：用哪个模型、从哪些指令出发、可以调用哪些工具、最多走多少步、活动审计到什么程度。工具同样受治理：每个工具都要声明参数、结果、风险等级以及谁可以调用它。

> **注意: 目前为定义**
>
> 智能体配置和认知工具带有状态，可以在控制台和 API 中管理，但目前还没有工作流节点运行智能体循环或调用认知工具。你现在使用的 AI 节点直接调用[大模型提供方](https://docs.sommatic.ai/zh/ai/llm-providers.md)、[提示词模板](https://docs.sommatic.ai/zh/ai/prompt-templates.md)和[知识资源](https://docs.sommatic.ai/zh/ai/knowledge-resources.md)。

## 智能体配置

| 字段                                  | 说明                                                                        |
| ----------------------------------- | ------------------------------------------------------------------------- |
| `slug`、`name`、`description`         | 稳定键与显示名称。                                                                 |
| `organization_id`                   | 所属组织。                                                                     |
| `llm_provider_slug`                 | 智能体默认用于推理的大模型提供方。                                                         |
| `default_prompt_template_id`        | 作为起点的提示词模板。                                                               |
| `cognitive_tool_ids`                | 允许调用的工具，列表之外的一律不可调用。                                                      |
| `memory_store_ids`、`datasource_ids` | 可使用的[记忆存储与数据源](https://docs.sommatic.ai/zh/ai/memory-and-datasources.md)。 |
| `behavior_policies`                 | 行为规则，例如温度范围或推理模式。                                                         |
| `safety_rules`                      | 安全约束。                                                                     |
| `max_tool_calls_per_step`           | 单个推理周期内工具调用次数上限。                                                          |
| `max_reasoning_steps`               | 推理或工具调用循环次数上限。                                                            |
| `audit_level`                       | 活动的审计程度。                                                                  |
| `tags`、`is_system`                  | 标签，以及是否为系统配置。                                                             |

```json
{
  "slug": "agent.support-router",
  "name": "客服分流",
  "llm_provider_slug": "<llm-provider-slug>",
  "default_prompt_template_id": "<prompt-template-id>",
  "cognitive_tool_ids": ["<cognitive-tool-id>"],
  "behavior_policies": { "temperature": { "min": 0.0, "max": 0.4 } },
  "max_tool_calls_per_step": 3,
  "max_reasoning_steps": 5
}
```

## 认知工具

认知工具是智能体无需在工作流图中新增节点即可调用的一项能力：一次 HTTP 调用、一次数据库操作或一个子工作流。工具放在图之外，工作流才能保持确定性。

| 字段                                                          | 说明                                                                                                             |
| ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `slug`、`name`、`description`                                 | 稳定键与显示名称。`slug`、`name` 和 `invocation_kind` 为必填。                                                                |
| `organization_id`、`project_id`                              | 所属组织，以及可选的所属项目。                                                                                                |
| `invocation_kind`                                           | 能力类型，例如 `http-endpoint`、`internal-function`、`sub-flow`、`vector-query`、`database-operation` 或 `identity-check`。 |
| `execution_mode`                                            | `sync`（立即返回结果）、`async`（稍后完成）或 `stream`（增量返回结果）。                                                                |
| `async_result_strategy`、`async_result_ingress_binding_slug` | `async` 结果如何返回。                                                                                                |
| `connector_slug`、`endpoint_key`、`target_flow_slug`          | 工具调用的对象：连接器、端点模板或工作流。                                                                                          |
| `parameter_schema`、`result_schema`                          | 带类型的参数与规范化的结果。                                                                                                 |
| `agent_result_projection`                                   | 原始响应如何映射到 `result_schema`。                                                                                     |
| `requires_auth_context`                                     | 调用是否需要已认证的身份。                                                                                                  |
| `allowed_agent_profile_ids`、`allowed_operator_slugs`        | 谁可以调用。                                                                                                         |
| `safety_classification`                                     | `read-only`、`idempotent-write`、`state-changing`、`sensitive` 或 `high-risk`。                                     |
| `safety_rules`                                              | 调用前检查的前置条件。                                                                                                    |
| `max_invocations_per_run`、`timeout_ms`                      | 每次运行与每次调用的限额。                                                                                                  |
| `audit_level`、`tags`、`is_system`                            | 审计级别、标签与系统标记。                                                                                                  |

两类构件的状态均为 `enabled`、`review`、`deprecated` 和 `archived`。

## 这些定义所表达的规则

- **显式白名单。** 智能体只能调用 `cognitive_tool_ids` 中的工具，工具则在 `allowed_agent_profile_ids` 中列出允许调用它的配置。
- **上限。** 步数、每步调用次数、每次运行调用次数和每次调用耗时都有上限。
- **风险需声明。** `safety_classification` 说明工具会改变什么，让你在授权前就心中有数。
- **从来不是唯一路径。** 智能体在治理之下提出建议或执行操作；关键操作始终有一条不依赖推理的显式路径，例如工作流、[任务](https://docs.sommatic.ai/zh/human-in-the-loop.md)或指挥中心命令。

## 管理

在控制台中进入 **Advanced → Cognitive Infrastructure**，打开 **Agent Profile** 或 **Cognitive Tool**。通过 API 使用 `/cognitive-infrastructure/cognitive-assets/agent-profile/` 和 `/cognitive-infrastructure/cognitive-assets/cognitive-tool/`（见 [API 参考](https://docs.sommatic.ai/zh/api/reference/cognitive-infrastructure.md)）。

## 下一步

- [记忆与数据源](https://docs.sommatic.ai/zh/ai/memory-and-datasources.md): 智能体可以在哪里记忆、可以查询什么。
- [人工介入](https://docs.sommatic.ai/zh/human-in-the-loop.md): 让需要人来判断的决策交给人。
