本页内容
Sommatic 文档
打开控制台

AI 构件 Beta

大模型提供方、提示词模板、知识资源与绑定、智能体、工具与连接器。

以 Markdown 查看
在以下应用中打开

创建智能体配置。

POST /cognitive-infrastructure/cognitive-assets/agent-profile/

返回根据所提供数据创建的智能体配置。

认证: Bearer 令牌

请求体

要创建的智能体配置对象。

organization_id string

拥有此配置文件的组织(租户)的标识符。

slug string 必填

唯一标识此配置文件的稳定语义键(例如 agent.support_router)。

name string 必填

配置文件的可读名称,用于编辑器、日志和文档。

description string

可选描述,说明该智能体的认知角色(例如“Support router AI”)。

llm_provider_slug string

默认用于推理、工具调用和消息生成的 LLM 提供方配置(LLMProviderModel)的标识符。可按节点覆盖。

default_prompt_template_id string

可选的 PromptTemplateModel 引用,用作系统提示词或行为框架。

cognitive_tool_ids array<string>

该智能体在推理过程中允许调用的 CognitiveToolModel 键列表。

memory_store_ids array<string>

该智能体可用的 MemoryStoreModel 标识符列表,可选,用于对话记忆、上下文检索或长期状态。

datasource_ids array<string>

该智能体在推理过程中可查询的 DatasourceModel 标识符列表,可选(只读或受治理的写入)。

behavior_policies object

可选的结构化对象,用于定义行为规则,例如温度范围、护栏、安全模式、思维链可见性、语气、风格、最大推理深度、工具使用偏好和回退策略。

safety_rules array<object>

在推理步骤之前或之后强制执行的安全约束列表,可选(例如 PII 脱敏、基于角色的输出过滤、合规检查)。

max_tool_calls_per_step integer

该智能体在单个推理周期内可执行的工具调用次数上限,可选。

max_reasoning_steps integer

出于安全和性能考虑,对迭代推理或工具使用循环次数的限制,可选。

audit_level string

对该智能体认知操作应用的审计级别。

tags array<string>

用于搜索、治理和分类的自由格式标签,可选。

is_system boolean

为 true 表示此配置文件由平台管理,而非由租户创建。

is_enabled boolean

为 true 表示此智能体配置文件当前可用。

is_deprecated boolean

为 true 表示此配置文件已弃用,不应在新流程中使用。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X POST https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/agent-profile/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234",
    "slug": "agent.support_router",
    "name": "Support Router Agent",
    "description": "Routes customer support messages by analyzing intent and invoking cognitive tools.",
    "llm_provider_slug": "llm.openai.gpt4o",
    "default_prompt_template_id": "prompt.support_routing.v1",
    "cognitive_tool_ids": [
      "tool.lookup_customer_profile",
      "tool.search_kb_vectors",
      "tool.create_support_ticket"
    ],
    "memory_store_ids": [
      "mem.support_conversation"
    ],
    "datasource_ids": [
      "ds.support_kb"
    ],
    "behavior_policies": {
      "temperature": {
        "min": 0,
        "max": 0.4
      },
      "reasoning_mode": "structured",
      "allow_chain_of_thought": false,
      "fallback_strategy": "reduce-tools-then-retry"
    },
    "safety_rules": [
      {
        "type": "pii-scan",
        "description": "Mask sensitive information"
      },
      {
        "type": "role-filter",
        "description": "Ensure routing suggestions match authorized categories"
      }
    ],
    "max_tool_calls_per_step": 3,
    "max_reasoning_steps": 5,
    "audit_level": "extended",
    "tags": [
      "support",
      "router",
      "agent"
    ],
    "is_system": false
  }
}

更新现有智能体配置。

PATCH /cognitive-infrastructure/cognitive-assets/agent-profile/

使用所提供的数据更新现有智能体配置。

认证: Bearer 令牌

请求体

要创建的智能体配置对象。

organization_id string

拥有此配置文件的组织(租户)的标识符。

slug string 必填

唯一标识此配置文件的稳定语义键(例如 agent.support_router)。

name string 必填

配置文件的可读名称,用于编辑器、日志和文档。

description string

可选描述,说明该智能体的认知角色(例如“Support router AI”)。

llm_provider_slug string

默认用于推理、工具调用和消息生成的 LLM 提供方配置(LLMProviderModel)的标识符。可按节点覆盖。

default_prompt_template_id string

可选的 PromptTemplateModel 引用,用作系统提示词或行为框架。

cognitive_tool_ids array<string>

该智能体在推理过程中允许调用的 CognitiveToolModel 键列表。

memory_store_ids array<string>

该智能体可用的 MemoryStoreModel 标识符列表,可选,用于对话记忆、上下文检索或长期状态。

datasource_ids array<string>

该智能体在推理过程中可查询的 DatasourceModel 标识符列表,可选(只读或受治理的写入)。

behavior_policies object

可选的结构化对象,用于定义行为规则,例如温度范围、护栏、安全模式、思维链可见性、语气、风格、最大推理深度、工具使用偏好和回退策略。

safety_rules array<object>

在推理步骤之前或之后强制执行的安全约束列表,可选(例如 PII 脱敏、基于角色的输出过滤、合规检查)。

max_tool_calls_per_step integer

该智能体在单个推理周期内可执行的工具调用次数上限,可选。

max_reasoning_steps integer

出于安全和性能考虑,对迭代推理或工具使用循环次数的限制,可选。

audit_level string

对该智能体认知操作应用的审计级别。

tags array<string>

用于搜索、治理和分类的自由格式标签,可选。

is_system boolean

为 true 表示此配置文件由平台管理,而非由租户创建。

is_enabled boolean

为 true 表示此智能体配置文件当前可用。

is_deprecated boolean

为 true 表示此配置文件已弃用,不应在新流程中使用。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X PATCH https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/agent-profile/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234",
    "slug": "agent.support_router",
    "name": "Support Router Agent",
    "description": "Routes customer support messages by analyzing intent and invoking cognitive tools.",
    "llm_provider_slug": "llm.openai.gpt4o",
    "default_prompt_template_id": "prompt.support_routing.v1",
    "cognitive_tool_ids": [
      "tool.lookup_customer_profile",
      "tool.search_kb_vectors",
      "tool.create_support_ticket"
    ],
    "memory_store_ids": [
      "mem.support_conversation"
    ],
    "datasource_ids": [
      "ds.support_kb"
    ],
    "behavior_policies": {
      "temperature": {
        "min": 0,
        "max": 0.4
      },
      "reasoning_mode": "structured",
      "allow_chain_of_thought": false,
      "fallback_strategy": "reduce-tools-then-retry"
    },
    "safety_rules": [
      {
        "type": "pii-scan",
        "description": "Mask sensitive information"
      },
      {
        "type": "role-filter",
        "description": "Ensure routing suggestions match authorized categories"
      }
    ],
    "max_tool_calls_per_step": 3,
    "max_reasoning_steps": 5,
    "audit_level": "extended",
    "tags": [
      "support",
      "router",
      "agent"
    ],
    "is_system": false
  }
}

按 id 删除智能体配置。

DELETE /cognitive-infrastructure/cognitive-assets/agent-profile/

根据所提供的 ID 删除智能体配置。

认证: Bearer 令牌

请求体

要删除的智能体配置 ID

id string

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X DELETE https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/agent-profile/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "<id>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Agent profile successfully deleted",
  "result": null
}

按查询选择器获取智能体配置。

GET /cognitive-infrastructure/cognitive-assets/agent-profile/{queryselector}

返回与路由中指定的查询选择器和搜索条件匹配的智能体配置信息。

认证: Bearer 令牌

参数

queryselector enum 路径 必填

此查询可用的筛选条件

idorganization-idall

search string 查询

用于搜索实体的关键字。

include_status string 查询

可选的状态参数,用于包含指定状态的智能体配置。

exclude_status string 查询

可选的状态参数,用于排除指定状态的智能体配置。

page integer 查询

页码,从 1 开始(默认 1)。

pageSize integer 查询

每页记录数(默认 25)。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X GET https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/agent-profile/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234",
    "slug": "agent.support_router",
    "name": "Support Router Agent",
    "description": "Routes customer support messages by analyzing intent and invoking cognitive tools.",
    "llm_provider_slug": "llm.openai.gpt4o",
    "default_prompt_template_id": "prompt.support_routing.v1",
    "cognitive_tool_ids": [
      "tool.lookup_customer_profile",
      "tool.search_kb_vectors",
      "tool.create_support_ticket"
    ],
    "memory_store_ids": [
      "mem.support_conversation"
    ],
    "datasource_ids": [
      "ds.support_kb"
    ],
    "behavior_policies": {
      "temperature": {
        "min": 0,
        "max": 0.4
      },
      "reasoning_mode": "structured",
      "allow_chain_of_thought": false,
      "fallback_strategy": "reduce-tools-then-retry"
    },
    "safety_rules": [
      {
        "type": "pii-scan",
        "description": "Mask sensitive information"
      },
      {
        "type": "role-filter",
        "description": "Ensure routing suggestions match authorized categories"
      }
    ],
    "max_tool_calls_per_step": 3,
    "max_reasoning_steps": 5,
    "audit_level": "extended",
    "tags": [
      "support",
      "router",
      "agent"
    ],
    "is_system": false
  }
}

创建认知工具。

POST /cognitive-infrastructure/cognitive-assets/cognitive-tool/

返回根据所提供数据创建的认知工具。

认证: Bearer 令牌

请求体

要创建的认知工具对象。

organization_id string

拥有此工具的组织(租户)的标识符。

project_id string

拥有此工具的项目 ID(租户作用域),可选。

slug string 必填

唯一标识此工具的稳定语义键(例如 tool.openai_async_chat)。

name string 必填

工具的可读名称,用于编辑器、提示词和文档。

description string

对工具用途、副作用及预期使用领域的可读说明。

invocation_kind string 必填

工具实现的能力类型:"http-endpoint"、"internal-function"、"sub-flow"、"vector-query"、"database-operation"、"identity-check" 等。

execution_mode string

此工具的执行模式:"sync" 表示立即以内联方式将结果返回给调用方智能体;"async" 表示通过回调或恢复事件延迟完成;"stream" 表示在底层连接器或提供方支持时增量交付结果。

async_result_strategy string

execution_mode 为 "async" 时采用的策略,可选,例如 "callback-ingress"、"resume-flow-instance" 或 "fire-and-forget"。

async_result_ingress_binding_slug string

可选的 IngressBindingModel 键引用,用于接收异步完成载荷。

connector_slug string

此工具与外部系统交互时使用的 ConnectorModel 引用,可选。

endpoint_key string

用于 HTTP 或 RPC 操作的 EndpointTemplateModel 引用,可选。

target_flow_slug string

工具执行带版本的子流程时使用的流程键,可选。

parameter_schema object

类 JSON Schema 定义,描述调用该工具所需的类型化参数。

result_schema object

类 JSON Schema 结构,描述规范化后的结果对象。

agent_result_projection object

可选的映射规则,将后端原始响应转换为规范化的结果 schema。

requires_auth_context boolean

该工具是否需要已认证的身份上下文。

allowed_agent_profile_ids array<string>

允许调用此工具的 AgentProfileModel 标识符列表,可选。

allowed_operator_slugs array<string>

可以引用此工具的算子类型列表,可选。

safety_classification string

此工具的安全级别:"read-only"、"idempotent-write"、"state-changing"、"sensitive" 或 "high-risk"。

safety_rules array<object>

调用工具前校验的结构化约束或前置条件。

max_invocations_per_run integer

单次执行中智能体调用此工具次数的软限制。

timeout_ms integer

工具执行的超时时间(毫秒)。

audit_level string

对此工具应用的审计级别。

tags array<string>

用于目录搜索和分组的标签,可选。

is_system boolean

表示此工具是否由平台管理。

is_enabled boolean

表示此工具是否已启用。

is_deprecated boolean

表示此工具是否已弃用。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X POST https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/cognitive-tool/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>",
    "invocation_kind": "<invocation_kind>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234",
    "slug": "tool.openai_async_chat",
    "name": "OpenAI Async Chat Completion",
    "description": "Enqueues a chat completion request against an OpenAI-compatible chat endpoint and returns results asynchronously via a configured ingress callback.\n",
    "invocation_kind": "http-endpoint",
    "execution_mode": "async",
    "async_result_strategy": "callback-ingress",
    "async_result_ingress_binding_slug": "ingress.cognitivetool.openai.chatCompletionResult",
    "connector_slug": "connector:http.openai",
    "endpoint_key": "postAsyncChatCompletions",
    "target_flow_slug": null,
    "parameter_schema": {
      "type": "object",
      "required": [
        "model",
        "messages"
      ],
      "properties": {
        "model": {
          "type": "string",
          "description": "OpenAI-compatible chat model identifier."
        },
        "messages": {
          "type": "array",
          "description": "Chat messages to send to the provider.",
          "items": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string"
              },
              "content": {
                "type": "string"
              }
            }
          }
        },
        "temperature": {
          "type": "number",
          "nullable": true
        },
        "max_tokens": {
          "type": "integer",
          "nullable": true
        },
        "somatic_metadata": {
          "type": "object",
          "nullable": true
        }
      }
    },
    "result_schema": {
      "type": "object",
      "properties": {
        "completion_text": {
          "type": "string"
        },
        "finish_reason": {
          "type": "string"
        },
        "usage": {
          "type": "object",
          "properties": {
            "prompt_tokens": {
              "type": "integer"
            },
            "completion_tokens": {
              "type": "integer"
            },
            "total_tokens": {
              "type": "integer"
            }
          }
        }
      }
    },
    "agent_result_projection": {
      "type": "object",
      "properties": {
        "source": {
          "type": "string"
        },
        "mapping": {
          "type": "object",
          "properties": {
            "completion_text": {
              "type": "string"
            },
            "finish_reason": {
              "type": "string"
            },
            "usage.prompt_tokens": {
              "type": "string"
            },
            "usage.completion_tokens": {
              "type": "string"
            },
            "usage.total_tokens": {
              "type": "string"
            }
          }
        }
      }
    },
    "requires_auth_context": true,
    "allowed_agent_profile_ids": [
      "agent_sommatic_default"
    ],
    "allowed_operator_slugs": [
      "ai.chat",
      "ai.agent"
    ],
    "safety_classification": "sensitive",
    "safety_rules": [
      {
        "type": "tenant-check",
        "description": "Ensure configuration is tenant-bound."
      },
      {
        "type": "content-policy",
        "description": "Apply content policies before exposing results."
      }
    ],
    "max_invocations_per_run": 50,
    "timeout_ms": 10000,
    "audit_level": "extended",
    "tags": [
      "openai",
      "llm",
      "async",
      "completion"
    ],
    "is_system": false
  }
}

更新现有认知工具。

PATCH /cognitive-infrastructure/cognitive-assets/cognitive-tool/

使用所提供的数据更新现有认知工具。

认证: Bearer 令牌

请求体

要创建的认知工具对象。

organization_id string

拥有此工具的组织(租户)的标识符。

project_id string

拥有此工具的项目 ID(租户作用域),可选。

slug string 必填

唯一标识此工具的稳定语义键(例如 tool.openai_async_chat)。

name string 必填

工具的可读名称,用于编辑器、提示词和文档。

description string

对工具用途、副作用及预期使用领域的可读说明。

invocation_kind string 必填

工具实现的能力类型:"http-endpoint"、"internal-function"、"sub-flow"、"vector-query"、"database-operation"、"identity-check" 等。

execution_mode string

此工具的执行模式:"sync" 表示立即以内联方式将结果返回给调用方智能体;"async" 表示通过回调或恢复事件延迟完成;"stream" 表示在底层连接器或提供方支持时增量交付结果。

async_result_strategy string

execution_mode 为 "async" 时采用的策略,可选,例如 "callback-ingress"、"resume-flow-instance" 或 "fire-and-forget"。

async_result_ingress_binding_slug string

可选的 IngressBindingModel 键引用,用于接收异步完成载荷。

connector_slug string

此工具与外部系统交互时使用的 ConnectorModel 引用,可选。

endpoint_key string

用于 HTTP 或 RPC 操作的 EndpointTemplateModel 引用,可选。

target_flow_slug string

工具执行带版本的子流程时使用的流程键,可选。

parameter_schema object

类 JSON Schema 定义,描述调用该工具所需的类型化参数。

result_schema object

类 JSON Schema 结构,描述规范化后的结果对象。

agent_result_projection object

可选的映射规则,将后端原始响应转换为规范化的结果 schema。

requires_auth_context boolean

该工具是否需要已认证的身份上下文。

allowed_agent_profile_ids array<string>

允许调用此工具的 AgentProfileModel 标识符列表,可选。

allowed_operator_slugs array<string>

可以引用此工具的算子类型列表,可选。

safety_classification string

此工具的安全级别:"read-only"、"idempotent-write"、"state-changing"、"sensitive" 或 "high-risk"。

safety_rules array<object>

调用工具前校验的结构化约束或前置条件。

max_invocations_per_run integer

单次执行中智能体调用此工具次数的软限制。

timeout_ms integer

工具执行的超时时间(毫秒)。

audit_level string

对此工具应用的审计级别。

tags array<string>

用于目录搜索和分组的标签,可选。

is_system boolean

表示此工具是否由平台管理。

is_enabled boolean

表示此工具是否已启用。

is_deprecated boolean

表示此工具是否已弃用。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X PATCH https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/cognitive-tool/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>",
    "invocation_kind": "<invocation_kind>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234",
    "slug": "tool.openai_async_chat",
    "name": "OpenAI Async Chat Completion",
    "description": "Enqueues a chat completion request against an OpenAI-compatible chat endpoint and returns results asynchronously via a configured ingress callback.\n",
    "invocation_kind": "http-endpoint",
    "execution_mode": "async",
    "async_result_strategy": "callback-ingress",
    "async_result_ingress_binding_slug": "ingress.cognitivetool.openai.chatCompletionResult",
    "connector_slug": "connector:http.openai",
    "endpoint_key": "postAsyncChatCompletions",
    "target_flow_slug": null,
    "parameter_schema": {
      "type": "object",
      "required": [
        "model",
        "messages"
      ],
      "properties": {
        "model": {
          "type": "string",
          "description": "OpenAI-compatible chat model identifier."
        },
        "messages": {
          "type": "array",
          "description": "Chat messages to send to the provider.",
          "items": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string"
              },
              "content": {
                "type": "string"
              }
            }
          }
        },
        "temperature": {
          "type": "number",
          "nullable": true
        },
        "max_tokens": {
          "type": "integer",
          "nullable": true
        },
        "somatic_metadata": {
          "type": "object",
          "nullable": true
        }
      }
    },
    "result_schema": {
      "type": "object",
      "properties": {
        "completion_text": {
          "type": "string"
        },
        "finish_reason": {
          "type": "string"
        },
        "usage": {
          "type": "object",
          "properties": {
            "prompt_tokens": {
              "type": "integer"
            },
            "completion_tokens": {
              "type": "integer"
            },
            "total_tokens": {
              "type": "integer"
            }
          }
        }
      }
    },
    "agent_result_projection": {
      "type": "object",
      "properties": {
        "source": {
          "type": "string"
        },
        "mapping": {
          "type": "object",
          "properties": {
            "completion_text": {
              "type": "string"
            },
            "finish_reason": {
              "type": "string"
            },
            "usage.prompt_tokens": {
              "type": "string"
            },
            "usage.completion_tokens": {
              "type": "string"
            },
            "usage.total_tokens": {
              "type": "string"
            }
          }
        }
      }
    },
    "requires_auth_context": true,
    "allowed_agent_profile_ids": [
      "agent_sommatic_default"
    ],
    "allowed_operator_slugs": [
      "ai.chat",
      "ai.agent"
    ],
    "safety_classification": "sensitive",
    "safety_rules": [
      {
        "type": "tenant-check",
        "description": "Ensure configuration is tenant-bound."
      },
      {
        "type": "content-policy",
        "description": "Apply content policies before exposing results."
      }
    ],
    "max_invocations_per_run": 50,
    "timeout_ms": 10000,
    "audit_level": "extended",
    "tags": [
      "openai",
      "llm",
      "async",
      "completion"
    ],
    "is_system": false
  }
}

按 id 删除认知工具。

DELETE /cognitive-infrastructure/cognitive-assets/cognitive-tool/

根据所提供的 ID 删除认知工具。

认证: Bearer 令牌

请求体

要删除的认知工具 ID

id string

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X DELETE https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/cognitive-tool/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "<id>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Cognitive tool successfully deleted",
  "result": null
}

按查询选择器获取认知工具。

GET /cognitive-infrastructure/cognitive-assets/cognitive-tool/{queryselector}

返回与路由中指定的查询选择器和搜索条件匹配的认知工具信息。

认证: Bearer 令牌

参数

queryselector enum 路径 必填

此查询可用的筛选条件

idorganization-idall

search string 查询

用于搜索实体的关键字。

include_status string 查询

可选的状态参数,用于包含指定状态的认知工具。

exclude_status string 查询

可选的状态参数,用于排除指定状态的认知工具。

page integer 查询

页码,从 1 开始(默认 1)。

pageSize integer 查询

每页记录数(默认 25)。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X GET https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/cognitive-tool/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234",
    "slug": "tool.openai_async_chat",
    "name": "OpenAI Async Chat Completion",
    "description": "Enqueues a chat completion request against an OpenAI-compatible chat endpoint and returns results asynchronously via a configured ingress callback.\n",
    "invocation_kind": "http-endpoint",
    "execution_mode": "async",
    "async_result_strategy": "callback-ingress",
    "async_result_ingress_binding_slug": "ingress.cognitivetool.openai.chatCompletionResult",
    "connector_slug": "connector:http.openai",
    "endpoint_key": "postAsyncChatCompletions",
    "target_flow_slug": null,
    "parameter_schema": {
      "type": "object",
      "required": [
        "model",
        "messages"
      ],
      "properties": {
        "model": {
          "type": "string",
          "description": "OpenAI-compatible chat model identifier."
        },
        "messages": {
          "type": "array",
          "description": "Chat messages to send to the provider.",
          "items": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string"
              },
              "content": {
                "type": "string"
              }
            }
          }
        },
        "temperature": {
          "type": "number",
          "nullable": true
        },
        "max_tokens": {
          "type": "integer",
          "nullable": true
        },
        "somatic_metadata": {
          "type": "object",
          "nullable": true
        }
      }
    },
    "result_schema": {
      "type": "object",
      "properties": {
        "completion_text": {
          "type": "string"
        },
        "finish_reason": {
          "type": "string"
        },
        "usage": {
          "type": "object",
          "properties": {
            "prompt_tokens": {
              "type": "integer"
            },
            "completion_tokens": {
              "type": "integer"
            },
            "total_tokens": {
              "type": "integer"
            }
          }
        }
      }
    },
    "agent_result_projection": {
      "type": "object",
      "properties": {
        "source": {
          "type": "string"
        },
        "mapping": {
          "type": "object",
          "properties": {
            "completion_text": {
              "type": "string"
            },
            "finish_reason": {
              "type": "string"
            },
            "usage.prompt_tokens": {
              "type": "string"
            },
            "usage.completion_tokens": {
              "type": "string"
            },
            "usage.total_tokens": {
              "type": "string"
            }
          }
        }
      }
    },
    "requires_auth_context": true,
    "allowed_agent_profile_ids": [
      "agent_sommatic_default"
    ],
    "allowed_operator_slugs": [
      "ai.chat",
      "ai.agent"
    ],
    "safety_classification": "sensitive",
    "safety_rules": [
      {
        "type": "tenant-check",
        "description": "Ensure configuration is tenant-bound."
      },
      {
        "type": "content-policy",
        "description": "Apply content policies before exposing results."
      }
    ],
    "max_invocations_per_run": 50,
    "timeout_ms": 10000,
    "audit_level": "extended",
    "tags": [
      "openai",
      "llm",
      "async",
      "completion"
    ],
    "is_system": false
  }
}

创建知识资源绑定。

POST /cognitive-infrastructure/cognitive-assets/knowledge-resource-binding/

创建并返回新的认知知识资源绑定。

认证: Bearer 令牌

请求体

要创建的知识资源绑定对象。

id string

绑定的唯一标识符。

organization_id string 必填

拥有该绑定的租户。

resource_id string 必填

所引用的认知知识资源的标识符。

target_type string 必填

该资源所绑定的实体类型。

可选值 projectworkflowworkflow-nodeagent-profileappconversationreportanomaly
target_id string 必填

目标实体的标识符。

role string 必填

资源在目标上下文中的语义用途。

可选值 knowledgepolicyinstructionsdatasettemplatereference
mode string 必填

Sommatic AI 在运行时使用该资源的方式。

可选值 retrievalcontextbothinstructionroutingvalidation
tags array<string>

在绑定层级应用的上下文标签,可选。

metadata object

绑定的附加上下文。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X POST https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/knowledge-resource-binding/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": "<organization_id>",
    "resource_id": "<resource_id>",
    "target_type": "project",
    "target_id": "<target_id>",
    "role": "knowledge",
    "mode": "retrieval"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org-123",
    "resource_id": "ckr_12345",
    "target_type": "workflow-node",
    "target_id": "wnd_890",
    "role": "knowledge",
    "mode": "both",
    "tags": [
      "triage",
      "production"
    ]
  }
}

更新现有知识资源绑定。

PATCH /cognitive-infrastructure/cognitive-assets/knowledge-resource-binding/

更新现有认知知识资源绑定的数据。

认证: Bearer 令牌

请求体

要更新的知识资源绑定属性。

id string

绑定的唯一标识符。

organization_id string 必填

拥有该绑定的租户。

resource_id string 必填

所引用的认知知识资源的标识符。

target_type string 必填

该资源所绑定的实体类型。

可选值 projectworkflowworkflow-nodeagent-profileappconversationreportanomaly
target_id string 必填

目标实体的标识符。

role string 必填

资源在目标上下文中的语义用途。

可选值 knowledgepolicyinstructionsdatasettemplatereference
mode string 必填

Sommatic AI 在运行时使用该资源的方式。

可选值 retrievalcontextbothinstructionroutingvalidation
tags array<string>

在绑定层级应用的上下文标签,可选。

metadata object

绑定的附加上下文。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X PATCH https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/knowledge-resource-binding/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": "<organization_id>",
    "resource_id": "<resource_id>",
    "target_type": "project",
    "target_id": "<target_id>",
    "role": "knowledge",
    "mode": "retrieval"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org-123",
    "resource_id": "ckr_12345",
    "target_type": "workflow-node",
    "target_id": "wnd_890",
    "role": "knowledge",
    "mode": "both",
    "tags": [
      "triage",
      "production"
    ]
  }
}

按 id 删除知识资源绑定。

DELETE /cognitive-infrastructure/cognitive-assets/knowledge-resource-binding/

根据所提供的 ID 删除知识资源绑定。

认证: Bearer 令牌

请求体

要删除的绑定 ID

id string

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X DELETE https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/knowledge-resource-binding/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "<id>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Successfully deleted",
  "result": null
}

按查询选择器获取知识资源绑定。

GET /cognitive-infrastructure/cognitive-assets/knowledge-resource-binding/{queryselector}

返回与路由中指定的查询选择器和搜索条件匹配的知识资源绑定信息。

认证: Bearer 令牌

参数

queryselector string 路径 必填

用于筛选的字段

idorganization-idresource-idtarget-idall

search string 查询

用于搜索实体的关键字。

target_type string 查询

可选的目标类型参数,用于筛选绑定。

include_status string 查询

可选的状态参数,用于包含指定状态的条目。

exclude_status string 查询

可选的状态参数,用于排除指定状态的条目。

page integer 查询

页码,从 1 开始(默认 1)。

pageSize integer 查询

每页记录数(默认 25)。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X GET https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/knowledge-resource-binding/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org-123",
    "resource_id": "ckr_12345",
    "target_type": "workflow-node",
    "target_id": "wnd_890",
    "role": "knowledge",
    "mode": "both",
    "tags": [
      "triage",
      "production"
    ]
  }
}

创建知识资源。

POST /cognitive-infrastructure/cognitive-assets/knowledge-resource/

创建并返回新的认知知识资源。

认证: Bearer 令牌

请求体

要创建的知识资源对象。

id string

认知知识资源的唯一标识符。

organization_id string 必填

拥有该资源的组织 ID(租户)。

project_id string

拥有该资源的项目 ID(租户作用域),可选。

name string 必填

资源的可读名称。

slug string 必填

稳定的语义键,用于在整个平台中引用该资源。

description string

资源用途与预期用法的说明,可选。

resource_type string 必填

认知资源的语义类型。

可选值 textdocumentlisttaxonomypromptpolicymanualdatasetreference
status string

资源的生命周期状态。

可选值 draftactivearchiveddeleted
version string

资源的语义版本或内部版本。

language string

资源内容的主要语言。

tags array<string>

用于筛选、导航和治理的标签,可选。

content CognitiveKnowledgeResourceContent 必填

认知知识资源的规范内容载荷。支持自由文本、结构化 JSON 数据、文件引用和提示词块。

format string

内容的主要表示格式。

可选值 plain-textmarkdownjsonfile-referenceprompt-blocksurl
text string

文本类资源使用的原始文本或 Markdown 文本内容。

structured_data object

结构化 JSON 载荷,用于列表、分类体系、规则或轻量数据集。

file_ref CognitiveKnowledgeResourceFileReference

认知知识资源的文件引用元数据。

file_name string

原始文件名或显示文件名。

mime_type string

所链接文件的 MIME 类型。

storage_key string

内部存储键或 blob 标识符。

document_uri string

指向已存储文件的 URI 或规范指针。

checksum string

用于校验文件完整性的校验和,可选。

size_bytes number

文件大小(字节)。

prompt_blocks object

当 resource_type 为 prompt 时的结构化提示词分段。

system string
instructions string
examples array<object>
url string

内容以链接形式表示时,指向外部或内部的 URL。

source CognitiveKnowledgeResourceSource

可选的基础设施引用,表明资源实际存储的位置或同步来源。它不会取代语义资源模型。

datasource_id string

内容由外部数据源提供时的数据源标识符,可选。

external_id string

资源在外部源系统中的标识符。

sync_mode string

资源与其物理来源之间的维护方式。

可选值 manualsyncedimported
governance CognitiveKnowledgeResourceGovernance

认知知识资源的治理与生命周期元数据。

owner_user_id string

资源的负责用户。

owner_team_id string

资源的负责团队。

visibility_scope string

资源的可见范围。

可选值 privateteamorganization
review_status string

资源的评审状态。

可选值 draftreviewedapprovedrejected
is_authoritative boolean

表示该资源是否应被视为权威来源。

effective_from string

有效期开始时间戳,可选。

effective_to string

有效期结束时间戳,可选。

expires_at string

过期时间戳,可选。

capabilities CognitiveKnowledgeResourceCapabilities

声明资源在运行时中的使用方式。

allowed_usage_modes array<string>

允许使用该资源的模式。

is_searchable boolean

表示该资源是否已建立搜索索引。

is_bindable boolean

表示该资源能否绑定到目标实体。

is_executable_reference boolean

表示该资源引用是否可执行。

is_version_locked boolean

表示该资源是否锁定到特定版本。

git_binding object

该资源同步来源 Git 仓库的关联信息(参见 docs/concepts/git_sync.md):{ repository_id, repository, branch, environment, package_path, resource_key, file_path, last_synced_commit, last_synced_at, deployed_commit, deployed_at, deployed_version, unlinked, unlinked_at }。unlinked = true 表示当前安装不再从 Git 同步该资源。

metadata object

用于 UI、索引或运维提示的附加任意元数据。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X POST https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/knowledge-resource/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": "<organization_id>",
    "name": "<name>",
    "slug": "<slug>",
    "resource_type": "text",
    "content": {
      "format": "markdown",
      "text": "## Escalation Manual\n1. Validate tenant.\n2. Identify affected workflow.\n3. Route to the correct operational queue.\n"
    }
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org-123",
    "name": "Claims Triage Knowledge Pack",
    "slug": "claims-triage-knowledge-pack",
    "description": "Centralized cognitive resource containing categories, policy notes and routing hints for intake triage.",
    "resource_type": "taxonomy",
    "status": "active",
    "version": "1.0.0",
    "language": "en",
    "tags": [
      "triage",
      "claims",
      "routing"
    ],
    "content": {
      "format": "json",
      "structured_data": {
        "categories": [
          {
            "name": "billing",
            "subcategories": [
              "refund",
              "dispute"
            ]
          },
          {
            "name": "technical",
            "subcategories": [
              "bug",
              "outage"
            ]
          }
        ],
        "routing_hints": {
          "billing": "finance.queue",
          "technical": "ops.queue"
        }
      }
    },
    "governance": {
      "visibility_scope": "organization",
      "review_status": "approved",
      "is_authoritative": true
    }
  }
}

更新现有知识资源。

PATCH /cognitive-infrastructure/cognitive-assets/knowledge-resource/

更新现有认知知识资源的数据。

认证: Bearer 令牌

请求体

要更新的知识资源属性。

id string

认知知识资源的唯一标识符。

organization_id string 必填

拥有该资源的组织 ID(租户)。

project_id string

拥有该资源的项目 ID(租户作用域),可选。

name string 必填

资源的可读名称。

slug string 必填

稳定的语义键,用于在整个平台中引用该资源。

description string

资源用途与预期用法的说明,可选。

resource_type string 必填

认知资源的语义类型。

可选值 textdocumentlisttaxonomypromptpolicymanualdatasetreference
status string

资源的生命周期状态。

可选值 draftactivearchiveddeleted
version string

资源的语义版本或内部版本。

language string

资源内容的主要语言。

tags array<string>

用于筛选、导航和治理的标签,可选。

content CognitiveKnowledgeResourceContent 必填

认知知识资源的规范内容载荷。支持自由文本、结构化 JSON 数据、文件引用和提示词块。

format string

内容的主要表示格式。

可选值 plain-textmarkdownjsonfile-referenceprompt-blocksurl
text string

文本类资源使用的原始文本或 Markdown 文本内容。

structured_data object

结构化 JSON 载荷,用于列表、分类体系、规则或轻量数据集。

file_ref CognitiveKnowledgeResourceFileReference

认知知识资源的文件引用元数据。

file_name string

原始文件名或显示文件名。

mime_type string

所链接文件的 MIME 类型。

storage_key string

内部存储键或 blob 标识符。

document_uri string

指向已存储文件的 URI 或规范指针。

checksum string

用于校验文件完整性的校验和,可选。

size_bytes number

文件大小(字节)。

prompt_blocks object

当 resource_type 为 prompt 时的结构化提示词分段。

system string
instructions string
examples array<object>
url string

内容以链接形式表示时,指向外部或内部的 URL。

source CognitiveKnowledgeResourceSource

可选的基础设施引用,表明资源实际存储的位置或同步来源。它不会取代语义资源模型。

datasource_id string

内容由外部数据源提供时的数据源标识符,可选。

external_id string

资源在外部源系统中的标识符。

sync_mode string

资源与其物理来源之间的维护方式。

可选值 manualsyncedimported
governance CognitiveKnowledgeResourceGovernance

认知知识资源的治理与生命周期元数据。

owner_user_id string

资源的负责用户。

owner_team_id string

资源的负责团队。

visibility_scope string

资源的可见范围。

可选值 privateteamorganization
review_status string

资源的评审状态。

可选值 draftreviewedapprovedrejected
is_authoritative boolean

表示该资源是否应被视为权威来源。

effective_from string

有效期开始时间戳,可选。

effective_to string

有效期结束时间戳,可选。

expires_at string

过期时间戳,可选。

capabilities CognitiveKnowledgeResourceCapabilities

声明资源在运行时中的使用方式。

allowed_usage_modes array<string>

允许使用该资源的模式。

is_searchable boolean

表示该资源是否已建立搜索索引。

is_bindable boolean

表示该资源能否绑定到目标实体。

is_executable_reference boolean

表示该资源引用是否可执行。

is_version_locked boolean

表示该资源是否锁定到特定版本。

git_binding object

该资源同步来源 Git 仓库的关联信息(参见 docs/concepts/git_sync.md):{ repository_id, repository, branch, environment, package_path, resource_key, file_path, last_synced_commit, last_synced_at, deployed_commit, deployed_at, deployed_version, unlinked, unlinked_at }。unlinked = true 表示当前安装不再从 Git 同步该资源。

metadata object

用于 UI、索引或运维提示的附加任意元数据。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X PATCH https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/knowledge-resource/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": "<organization_id>",
    "name": "<name>",
    "slug": "<slug>",
    "resource_type": "text",
    "content": {
      "format": "markdown",
      "text": "## Escalation Manual\n1. Validate tenant.\n2. Identify affected workflow.\n3. Route to the correct operational queue.\n"
    }
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org-123",
    "name": "Claims Triage Knowledge Pack",
    "slug": "claims-triage-knowledge-pack",
    "description": "Centralized cognitive resource containing categories, policy notes and routing hints for intake triage.",
    "resource_type": "taxonomy",
    "status": "active",
    "version": "1.0.0",
    "language": "en",
    "tags": [
      "triage",
      "claims",
      "routing"
    ],
    "content": {
      "format": "json",
      "structured_data": {
        "categories": [
          {
            "name": "billing",
            "subcategories": [
              "refund",
              "dispute"
            ]
          },
          {
            "name": "technical",
            "subcategories": [
              "bug",
              "outage"
            ]
          }
        ],
        "routing_hints": {
          "billing": "finance.queue",
          "technical": "ops.queue"
        }
      }
    },
    "governance": {
      "visibility_scope": "organization",
      "review_status": "approved",
      "is_authoritative": true
    }
  }
}

按 id 删除知识资源。

DELETE /cognitive-infrastructure/cognitive-assets/knowledge-resource/

根据所提供的 ID 删除知识资源。

认证: Bearer 令牌

请求体

要删除的资源 ID

id string

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X DELETE https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/knowledge-resource/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "<id>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Successfully deleted",
  "result": null
}

将知识资源发布为新的不可变版本。

POST /cognitive-infrastructure/cognitive-assets/knowledge-resource/{id}/publish

将当前内容的快照保存为下一个版本(查询选择器 versions 可列出所有版本),并将资源标记为活跃。由编辑器的 Publish 操作和 Git 同步调用。

认证: Bearer 令牌

参数

id string 路径 必填

请求体

description string
git object

从 Git 发布时的来源:{ repository, branch, commit, path, key }。

响应

  • 200 已创建的版本快照。
curl -X POST https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/knowledge-resource/<id>/publish \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "<description>",
    "git": {}
  }'
响应 200
{
  "organization_id": "org-62ea3930c4b08f6",
  "resource_id": "knowledge-resource-9c7ffffc0a24291",
  "version": "3",
  "name": "Taxonomía Jurídica",
  "content": {
    "format": "json",
    "structured_data": {}
  },
  "git": {
    "repository": "acme/support-solutions",
    "branch": "main",
    "commit": "4f2a…",
    "path": "juridica/knowledge/taxonomia-juridica.json",
    "key": "juridica.taxonomia-juridica"
  }
}

按查询选择器获取知识资源。

GET /cognitive-infrastructure/cognitive-assets/knowledge-resource/{queryselector}

返回与路由中指定的查询选择器和搜索条件匹配的知识资源信息。

认证: Bearer 令牌

参数

queryselector string 路径 必填

用于筛选的字段

idorganization-idslugall

search string 查询

用于搜索实体的关键字。

include_status string 查询

可选的状态参数,用于包含指定状态的条目。

exclude_status string 查询

可选的状态参数,用于排除指定状态的条目。

page integer 查询

页码,从 1 开始(默认 1)。

pageSize integer 查询

每页记录数(默认 25)。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X GET https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/knowledge-resource/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org-123",
    "name": "Claims Triage Knowledge Pack",
    "slug": "claims-triage-knowledge-pack",
    "description": "Centralized cognitive resource containing categories, policy notes and routing hints for intake triage.",
    "resource_type": "taxonomy",
    "status": "active",
    "version": "1.0.0",
    "language": "en",
    "tags": [
      "triage",
      "claims",
      "routing"
    ],
    "content": {
      "format": "json",
      "structured_data": {
        "categories": [
          {
            "name": "billing",
            "subcategories": [
              "refund",
              "dispute"
            ]
          },
          {
            "name": "technical",
            "subcategories": [
              "bug",
              "outage"
            ]
          }
        ],
        "routing_hints": {
          "billing": "finance.queue",
          "technical": "ops.queue"
        }
      }
    },
    "governance": {
      "visibility_scope": "organization",
      "review_status": "approved",
      "is_authoritative": true
    }
  }
}

创建 LLM 提供商。

POST /cognitive-infrastructure/cognitive-assets/llm-provider/

返回根据所提供数据创建的 LLM 提供商。

认证: Bearer 令牌

请求体

要创建的 LLM 提供商对象。

organization_id string

拥有该流程定义的组织(租户)标识符。

project_id string

可选,拥有该 LLM 提供方配置的项目 ID(租户作用域)。

slug string 必填

唯一标识该提供方配置的稳定语义键(例如 llm.openai.gpt4_1、llm.azure.gpt4o、llm.claude3_sonnet)。

name string 必填

在编辑器和文档中使用的提供方配置可读名称。

description string

可选,说明该提供方用途、模型特性或使用场景的描述。

transport_kind string

调用 LLM 所用的传输方式:http-api、grpc、internal-router、local-process。

provider_type object

用于解析调用适配器的提供方类型标识符(例如 openai-chat、azure-openai-chat、anthropic-messages、mistral-chat)。

name string
title string
endpoint string

可选,用于 HTTP/GRPC 方式调用 LLM 的 ConnectorModel 连接字符串或标识符。

api_key string

可选,当该提供方映射到连接器端点时使用的 EndpointTemplateModel 键。

deployment_name string

部署名称是在云服务提供商上部署的特定模型版本及配置的唯一标识符。

api_version string

提供方要求的 API 版本(例如 Azure OpenAI 的 2024-06-01)。

default_parameters object

可选的静态默认参数,例如 max_tokens、temperature 或 top_p,在调用 LLM 且未显式覆盖时生效。

input_token_limit integer

该提供方允许的提示词最大 token 数。

output_token_limit integer

该提供方可返回的最大 token 数。

pricing object

可选的结构化定价信息,用于成本监控和优化。

input_cost_per_million number

每 100 万输入 token 的费用。

output_cost_per_million number

每 100 万输出 token 的费用。

currency string

货币代码(例如 USD)。

rate_limits object

可选的每分钟请求数或每分钟 token 数限制,用于请求限流。

rpm integer
tpm integer
safety_settings object

可选的提供方级安全配置:内容过滤器、策略、屏蔽列表或审核模式。

mode string

安全模式(例如 strict、balanced、minimal)。

categories_blocked array<string>

被屏蔽的内容类别列表。

routing_rules array<object>

可选的规则集,定义认知引擎何时自动选择该提供方。

is_system boolean

为 true 表示该提供方配置由平台管理。

is_default boolean

为 true 表示该提供方决定系统的默认 LLM。

is_enabled boolean

为 true 表示该提供方当前可被选择或调用。

is_deprecated boolean

为 true 表示新的流程或智能体不应再使用该提供方。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X POST https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/llm-provider/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234",
    "slug": "llm.openai.gpt4_1",
    "name": "OpenAI GPT-4.1 Standard",
    "description": "Standard OpenAI GPT-4.1 deployment used for reasoning-heavy tasks and agent planning.",
    "transport_kind": "http-api",
    "provider_type": {
      "name": "openai-chat",
      "title": "OpenAI Chat"
    },
    "endpoint": "https://api.openai.com/v1/chat/completions",
    "api_key": "chatCompletions",
    "api_version": "2024-06-01",
    "default_parameters": {
      "max_tokens": 2048,
      "temperature": 0.2,
      "top_p": 1
    },
    "input_token_limit": 128000,
    "output_token_limit": 4096,
    "pricing": {
      "input_cost_per_million": 5,
      "output_cost_per_million": 15,
      "currency": "USD"
    },
    "rate_limits": {
      "rpm": 200,
      "tpm": 200000
    },
    "safety_settings": {
      "mode": "balanced",
      "categories_blocked": [
        "violence",
        "hate"
      ]
    },
    "routing_rules": [
      {
        "condition": "task.type == 'planning'",
        "weight": 1
      }
    ],
    "is_system": false
  }
}

更新现有 LLM 提供商。

PATCH /cognitive-infrastructure/cognitive-assets/llm-provider/

使用所提供的数据更新现有 LLM 提供商。

认证: Bearer 令牌

请求体

要更新的 LLM 提供商对象。

organization_id string

拥有该流程定义的组织(租户)标识符。

project_id string

可选,拥有该 LLM 提供方配置的项目 ID(租户作用域)。

slug string 必填

唯一标识该提供方配置的稳定语义键(例如 llm.openai.gpt4_1、llm.azure.gpt4o、llm.claude3_sonnet)。

name string 必填

在编辑器和文档中使用的提供方配置可读名称。

description string

可选,说明该提供方用途、模型特性或使用场景的描述。

transport_kind string

调用 LLM 所用的传输方式:http-api、grpc、internal-router、local-process。

provider_type object

用于解析调用适配器的提供方类型标识符(例如 openai-chat、azure-openai-chat、anthropic-messages、mistral-chat)。

name string
title string
endpoint string

可选,用于 HTTP/GRPC 方式调用 LLM 的 ConnectorModel 连接字符串或标识符。

api_key string

可选,当该提供方映射到连接器端点时使用的 EndpointTemplateModel 键。

deployment_name string

部署名称是在云服务提供商上部署的特定模型版本及配置的唯一标识符。

api_version string

提供方要求的 API 版本(例如 Azure OpenAI 的 2024-06-01)。

default_parameters object

可选的静态默认参数,例如 max_tokens、temperature 或 top_p,在调用 LLM 且未显式覆盖时生效。

input_token_limit integer

该提供方允许的提示词最大 token 数。

output_token_limit integer

该提供方可返回的最大 token 数。

pricing object

可选的结构化定价信息,用于成本监控和优化。

input_cost_per_million number

每 100 万输入 token 的费用。

output_cost_per_million number

每 100 万输出 token 的费用。

currency string

货币代码(例如 USD)。

rate_limits object

可选的每分钟请求数或每分钟 token 数限制,用于请求限流。

rpm integer
tpm integer
safety_settings object

可选的提供方级安全配置:内容过滤器、策略、屏蔽列表或审核模式。

mode string

安全模式(例如 strict、balanced、minimal)。

categories_blocked array<string>

被屏蔽的内容类别列表。

routing_rules array<object>

可选的规则集,定义认知引擎何时自动选择该提供方。

is_system boolean

为 true 表示该提供方配置由平台管理。

is_default boolean

为 true 表示该提供方决定系统的默认 LLM。

is_enabled boolean

为 true 表示该提供方当前可被选择或调用。

is_deprecated boolean

为 true 表示新的流程或智能体不应再使用该提供方。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X PATCH https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/llm-provider/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234",
    "slug": "llm.openai.gpt4_1",
    "name": "OpenAI GPT-4.1 Standard",
    "description": "Standard OpenAI GPT-4.1 deployment used for reasoning-heavy tasks and agent planning.",
    "transport_kind": "http-api",
    "provider_type": {
      "name": "openai-chat",
      "title": "OpenAI Chat"
    },
    "endpoint": "https://api.openai.com/v1/chat/completions",
    "api_key": "chatCompletions",
    "api_version": "2024-06-01",
    "default_parameters": {
      "max_tokens": 2048,
      "temperature": 0.2,
      "top_p": 1
    },
    "input_token_limit": 128000,
    "output_token_limit": 4096,
    "pricing": {
      "input_cost_per_million": 5,
      "output_cost_per_million": 15,
      "currency": "USD"
    },
    "rate_limits": {
      "rpm": 200,
      "tpm": 200000
    },
    "safety_settings": {
      "mode": "balanced",
      "categories_blocked": [
        "violence",
        "hate"
      ]
    },
    "routing_rules": [
      {
        "condition": "task.type == 'planning'",
        "weight": 1
      }
    ],
    "is_system": false
  }
}

按 id 删除 LLM 提供商。

DELETE /cognitive-infrastructure/cognitive-assets/llm-provider/

根据所提供的 ID 删除 LLM 提供商。

认证: Bearer 令牌

请求体

要删除的 LLM 提供商 ID

id string

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X DELETE https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/llm-provider/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "<id>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "LLM Provider successfully deleted",
  "result": null
}

按查询选择器获取 LLM 提供商。

GET /cognitive-infrastructure/cognitive-assets/llm-provider/{queryselector}

返回与路由中指定的查询选择器和搜索条件匹配的 LLM 提供商信息。

认证: Bearer 令牌

参数

queryselector enum 路径 必填

此查询可用的筛选条件

idorganization-idall

search string 查询

用于搜索实体的关键字。

include_status string 查询

可选的状态参数,用于包含指定状态的 LLM 提供商。

exclude_status string 查询

可选的状态参数,用于排除指定状态的 LLM 提供商。

page integer 查询

页码,从 1 开始(默认 1)。

pageSize integer 查询

每页记录数(默认 25)。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X GET https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/llm-provider/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234",
    "slug": "llm.openai.gpt4_1",
    "name": "OpenAI GPT-4.1 Standard",
    "description": "Standard OpenAI GPT-4.1 deployment used for reasoning-heavy tasks and agent planning.",
    "transport_kind": "http-api",
    "provider_type": {
      "name": "openai-chat",
      "title": "OpenAI Chat"
    },
    "endpoint": "https://api.openai.com/v1/chat/completions",
    "api_key": "chatCompletions",
    "api_version": "2024-06-01",
    "default_parameters": {
      "max_tokens": 2048,
      "temperature": 0.2,
      "top_p": 1
    },
    "input_token_limit": 128000,
    "output_token_limit": 4096,
    "pricing": {
      "input_cost_per_million": 5,
      "output_cost_per_million": 15,
      "currency": "USD"
    },
    "rate_limits": {
      "rpm": 200,
      "tpm": 200000
    },
    "safety_settings": {
      "mode": "balanced",
      "categories_blocked": [
        "violence",
        "hate"
      ]
    },
    "routing_rules": [
      {
        "condition": "task.type == 'planning'",
        "weight": 1
      }
    ],
    "is_system": false
  }
}

调用 LLM 提供商配置。

POST /cognitive-infrastructure/cognitive-assets/llm-provider/invoke

使用已配置的 LLM 提供商(按 ID)执行对话补全或类似操作。

认证: Bearer 令牌

请求体

调用参数,包括 model_id 和 input。

model_id string 必填

大模型提供方配置的 ID。

operation string

操作类型(chat、embedding),默认为 chat。

input object 必填

输入载荷(消息等)。

响应

  • 200 成功。
curl -X POST https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/llm-provider/invoke \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model_id": "<model_id>",
    "input": {}
  }'
响应 200
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {}
}

创建提示词模板。

POST /cognitive-infrastructure/cognitive-assets/prompt-template/

返回根据所提供数据创建的提示词模板。

认证: Bearer 令牌

请求体

要创建的提示词模板对象。

organization_id string

拥有该提示词模板的组织(租户)标识符。

slug string 必填

唯一标识该提示词模板的稳定语义键(例如 prompt.email_classification.v1)。

name string 必填

在编辑器和文档中使用的模板可读名称。

description string

可选,说明该提示词模板用途、范围和预期用法的描述。

llm_provider_id string

可选,引用 LlmProviderModel.id,指明该模板主要面向的提供方。

language string

可选,模板内容的主要语言(例如 "en"、"es"、"pt-BR")。

format string

渲染后提示词的格式,例如 "plain-text"、"markdown" 或 "json-instructions"。

system_instructions string

系统级指令,定义助手的角色设定、约束和全局行为。

template_body string

提示词模板主体,包含按所选语法编写的变量占位符(例如 {{variable_name}})。

variables array<CognitivePromptTemplateVariable>

渲染时可注入该模板的带类型输入变量列表。

name string 必填

在模板主体中引用的变量名(例如 "customer_name"、"email_body")。

type string 必填

注入模板的值在运行时的预期类型。

可选值 stringnumberbooleanarrayobject
description string

该变量含义的可读说明。

required boolean

渲染模板时是否必须提供该变量。

default_value any

可选,未显式提供该变量时使用的默认值。

allowed_values array<string>

可选,变量受约束时允许取值的枚举。

output_fields array<CognitivePromptTemplateOutputField>

需要结构化输出时,提示词预期生成的带类型输出字段列表。

name string 必填

结构化输出中的字段名(例如 "category"、"summary"、"sentiment")。

type string 必填

渲染输出中该字段值的预期类型。

可选值 stringnumberbooleanarrayobject
description string

该字段含义的可读说明。

required boolean

模型是否应始终输出该字段。

style_guidelines array<string>

可选,渲染和使用该模板时需遵循的风格或语气准则列表。

examples array<CognitivePromptTemplateExample>

示例,将一组变量输入与预期的模型输出配对。

inputs object

渲染该示例所用的变量名到值的映射。

expected_output string

给定输入时期望的模型响应。

notes string

可选,关于该示例边界情况、注意事项或设计理由的说明。

tags array<string>

可选的自由格式标签列表,用于目录搜索、发现和治理。

is_system boolean

表示该模板是否为平台管理的系统级资产,而非用户创建。

is_deprecated boolean

表示该模板是否已弃用,不应在新流程中使用。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X POST https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/prompt-template/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "123e4567-e89b-12d3",
    "slug": "prompt.email_classification.v1",
    "name": "Email Classification Prompt v1",
    "description": "Classify incoming support emails into billing, technical or complaint categories and extract key fields for routing and analytics.\n",
    "llm_provider_id": "llm-provider-XXXXXXXXXXXXXXX",
    "language": "en",
    "format": "markdown",
    "system_instructions": "You are a classification assistant for an enterprise support team.\nYour job is to read incoming emails and assign them to the correct category.\n",
    "template_body": "Read the following email and respond in JSON only.\n\n### Email subject\n{{subject}}\n\n### Email body\n{{body}}\n\nClassify the email into one of: \"billing\", \"technical\", \"complaint\".\n",
    "variables": [
      {
        "name": "subject",
        "type": "string",
        "description": "Subject line of the incoming email.",
        "required": true,
        "default_value": null,
        "allowed_values": []
      },
      {
        "name": "body",
        "type": "string",
        "description": "Full body content of the incoming email.",
        "required": true,
        "default_value": null,
        "allowed_values": []
      }
    ],
    "output_fields": [
      {
        "name": "category",
        "type": "string",
        "description": "One of \"billing\", \"technical\", \"complaint\".",
        "required": true
      },
      {
        "name": "summary",
        "type": "string",
        "description": "Short natural-language summary of the email content.",
        "required": true
      },
      {
        "name": "sentiment",
        "type": "string",
        "description": "One of \"positive\", \"neutral\", \"negative\".",
        "required": true
      }
    ],
    "style_guidelines": [
      "Be concise and use neutral language.",
      "Never include explanatory text outside the JSON object."
    ],
    "examples": [
      {
        "inputs": {
          "subject": "Issue with my last invoice",
          "body": "Hi, I think I was overcharged on my last invoice."
        },
        "expected_output": "{\n  \"category\": \"billing\",\n  \"summary\": \"Customer suspects being overcharged on the latest invoice.\",\n  \"sentiment\": \"neutral\"\n}\n",
        "notes": "Canonical billing-complaint case used as smoke test."
      }
    ],
    "tags": [
      "classification",
      "support",
      "email"
    ],
    "is_system": false
  }
}

更新现有提示词模板。

PATCH /cognitive-infrastructure/cognitive-assets/prompt-template/

使用所提供的数据更新现有提示词模板。

认证: Bearer 令牌

请求体

要创建的提示词模板对象。

organization_id string

拥有该提示词模板的组织(租户)标识符。

slug string 必填

唯一标识该提示词模板的稳定语义键(例如 prompt.email_classification.v1)。

name string 必填

在编辑器和文档中使用的模板可读名称。

description string

可选,说明该提示词模板用途、范围和预期用法的描述。

llm_provider_id string

可选,引用 LlmProviderModel.id,指明该模板主要面向的提供方。

language string

可选,模板内容的主要语言(例如 "en"、"es"、"pt-BR")。

format string

渲染后提示词的格式,例如 "plain-text"、"markdown" 或 "json-instructions"。

system_instructions string

系统级指令,定义助手的角色设定、约束和全局行为。

template_body string

提示词模板主体,包含按所选语法编写的变量占位符(例如 {{variable_name}})。

variables array<CognitivePromptTemplateVariable>

渲染时可注入该模板的带类型输入变量列表。

name string 必填

在模板主体中引用的变量名(例如 "customer_name"、"email_body")。

type string 必填

注入模板的值在运行时的预期类型。

可选值 stringnumberbooleanarrayobject
description string

该变量含义的可读说明。

required boolean

渲染模板时是否必须提供该变量。

default_value any

可选,未显式提供该变量时使用的默认值。

allowed_values array<string>

可选,变量受约束时允许取值的枚举。

output_fields array<CognitivePromptTemplateOutputField>

需要结构化输出时,提示词预期生成的带类型输出字段列表。

name string 必填

结构化输出中的字段名(例如 "category"、"summary"、"sentiment")。

type string 必填

渲染输出中该字段值的预期类型。

可选值 stringnumberbooleanarrayobject
description string

该字段含义的可读说明。

required boolean

模型是否应始终输出该字段。

style_guidelines array<string>

可选,渲染和使用该模板时需遵循的风格或语气准则列表。

examples array<CognitivePromptTemplateExample>

示例,将一组变量输入与预期的模型输出配对。

inputs object

渲染该示例所用的变量名到值的映射。

expected_output string

给定输入时期望的模型响应。

notes string

可选,关于该示例边界情况、注意事项或设计理由的说明。

tags array<string>

可选的自由格式标签列表,用于目录搜索、发现和治理。

is_system boolean

表示该模板是否为平台管理的系统级资产,而非用户创建。

is_deprecated boolean

表示该模板是否已弃用,不应在新流程中使用。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X PATCH https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/prompt-template/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "123e4567-e89b-12d3",
    "slug": "prompt.email_classification.v1",
    "name": "Email Classification Prompt v1",
    "description": "Classify incoming support emails into billing, technical or complaint categories and extract key fields for routing and analytics.\n",
    "llm_provider_id": "llm-provider-XXXXXXXXXXXXXXX",
    "language": "en",
    "format": "markdown",
    "system_instructions": "You are a classification assistant for an enterprise support team.\nYour job is to read incoming emails and assign them to the correct category.\n",
    "template_body": "Read the following email and respond in JSON only.\n\n### Email subject\n{{subject}}\n\n### Email body\n{{body}}\n\nClassify the email into one of: \"billing\", \"technical\", \"complaint\".\n",
    "variables": [
      {
        "name": "subject",
        "type": "string",
        "description": "Subject line of the incoming email.",
        "required": true,
        "default_value": null,
        "allowed_values": []
      },
      {
        "name": "body",
        "type": "string",
        "description": "Full body content of the incoming email.",
        "required": true,
        "default_value": null,
        "allowed_values": []
      }
    ],
    "output_fields": [
      {
        "name": "category",
        "type": "string",
        "description": "One of \"billing\", \"technical\", \"complaint\".",
        "required": true
      },
      {
        "name": "summary",
        "type": "string",
        "description": "Short natural-language summary of the email content.",
        "required": true
      },
      {
        "name": "sentiment",
        "type": "string",
        "description": "One of \"positive\", \"neutral\", \"negative\".",
        "required": true
      }
    ],
    "style_guidelines": [
      "Be concise and use neutral language.",
      "Never include explanatory text outside the JSON object."
    ],
    "examples": [
      {
        "inputs": {
          "subject": "Issue with my last invoice",
          "body": "Hi, I think I was overcharged on my last invoice."
        },
        "expected_output": "{\n  \"category\": \"billing\",\n  \"summary\": \"Customer suspects being overcharged on the latest invoice.\",\n  \"sentiment\": \"neutral\"\n}\n",
        "notes": "Canonical billing-complaint case used as smoke test."
      }
    ],
    "tags": [
      "classification",
      "support",
      "email"
    ],
    "is_system": false
  }
}

按 id 删除提示词模板。

DELETE /cognitive-infrastructure/cognitive-assets/prompt-template/

根据所提供的 ID 删除提示词模板。

认证: Bearer 令牌

请求体

要删除的提示词模板 ID

id string

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X DELETE https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/prompt-template/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "<id>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Prompt template successfully deleted",
  "result": null
}

按查询选择器获取提示词模板。

GET /cognitive-infrastructure/cognitive-assets/prompt-template/{queryselector}

返回与路由中指定的查询选择器和搜索条件匹配的提示词模板信息。

认证: Bearer 令牌

参数

queryselector enum 路径 必填

此查询可用的筛选条件

idorganization-idall

search string 查询

用于搜索实体的关键字。

include_status string 查询

可选的状态参数,用于包含指定状态的模板。

exclude_status string 查询

可选的状态参数,用于排除指定状态的模板。

page integer 查询

页码,从 1 开始(默认 1)。

pageSize integer 查询

每页记录数(默认 25)。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X GET https://api.sommatic.ai/cognitive-infrastructure/cognitive-assets/prompt-template/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "123e4567-e89b-12d3",
    "slug": "prompt.email_classification.v1",
    "name": "Email Classification Prompt v1",
    "description": "Classify incoming support emails into billing, technical or complaint categories and extract key fields for routing and analytics.\n",
    "llm_provider_id": "llm-provider-XXXXXXXXXXXXXXX",
    "language": "en",
    "format": "markdown",
    "system_instructions": "You are a classification assistant for an enterprise support team.\nYour job is to read incoming emails and assign them to the correct category.\n",
    "template_body": "Read the following email and respond in JSON only.\n\n### Email subject\n{{subject}}\n\n### Email body\n{{body}}\n\nClassify the email into one of: \"billing\", \"technical\", \"complaint\".\n",
    "variables": [
      {
        "name": "subject",
        "type": "string",
        "description": "Subject line of the incoming email.",
        "required": true,
        "default_value": null,
        "allowed_values": []
      },
      {
        "name": "body",
        "type": "string",
        "description": "Full body content of the incoming email.",
        "required": true,
        "default_value": null,
        "allowed_values": []
      }
    ],
    "output_fields": [
      {
        "name": "category",
        "type": "string",
        "description": "One of \"billing\", \"technical\", \"complaint\".",
        "required": true
      },
      {
        "name": "summary",
        "type": "string",
        "description": "Short natural-language summary of the email content.",
        "required": true
      },
      {
        "name": "sentiment",
        "type": "string",
        "description": "One of \"positive\", \"neutral\", \"negative\".",
        "required": true
      }
    ],
    "style_guidelines": [
      "Be concise and use neutral language.",
      "Never include explanatory text outside the JSON object."
    ],
    "examples": [
      {
        "inputs": {
          "subject": "Issue with my last invoice",
          "body": "Hi, I think I was overcharged on my last invoice."
        },
        "expected_output": "{\n  \"category\": \"billing\",\n  \"summary\": \"Customer suspects being overcharged on the latest invoice.\",\n  \"sentiment\": \"neutral\"\n}\n",
        "notes": "Canonical billing-complaint case used as smoke test."
      }
    ],
    "tags": [
      "classification",
      "support",
      "email"
    ],
    "is_system": false
  }
}

创建数据源。

POST /cognitive-infrastructure/connectors/external-datasource/

返回根据所提供数据创建的数据源。

认证: Bearer 令牌

请求体

要创建的 Datasource 对象。

organization_id string 必填

该触发器关联的 OrganizationModel 标识符。

project_id string

拥有此数据源的项目 ID(租户作用域),可选。

slug string 必填

唯一标识此数据源的稳定语义键(例如 ds.crm、ds.postgres.orders、ds.vector.support)。

name string 必填

数据源的可读名称,用于编辑器和文档。

description string

可选描述,说明此数据源所代表的数据集或系统。

datasource_kind string 必填

数据源类型:"postgres"、"mysql"、"sqlserver"、"mongodb"、"s3"、"gcs"、"snowflake"、"bigquery"、"elasticsearch"、"vector-db"、"custom"。

connector_slug string

负责底层通信的 ConnectorModel 引用,可选(HTTP、驱动 API、RPC 代理、云 SDK)。

default_collection string

此数据源交互的默认数据集、表、集合或存储桶。

collections array<object>

此数据源公开的逻辑数据集或集合列表,可选,每项可附带 schema 提示。

collection_key string
description string
schema object
indexing object

此数据源的索引配置,视 datasource_kind 而定,包括主键、向量索引或搜索索引配置。

primary_key string
vector_index object
search_index object
query_capabilities object

此数据源支持的能力,例如 select、insert、update、delete、vector-search、hybrid-search、aggregation、blob-read、blob-write。

select boolean
insert boolean
update boolean
delete boolean
vector_search boolean
hybrid_search boolean
blob_read boolean
blob_write boolean
auth_context_required boolean

为 true 表示此数据源在执行查询前需要解析身份上下文(租户/用户)。

allowed_agent_profile_ids array<string>

允许对此数据源执行查询的 AgentProfileModel 标识符列表,可选。

allowed_operator_slugs array<string>

允许引用此数据源的算子类型列表,可选(例如 datasource.query、ai.rag.retrieve)。

is_system boolean

为 true 表示此数据源由平台内部管理。

is_enabled boolean

为 true 表示此数据源当前可用。

is_deprecated boolean

为 true 表示此数据源不应再用于新的流程或设计。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X POST https://api.sommatic.ai/cognitive-infrastructure/connectors/external-datasource/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": "<organization_id>",
    "slug": "<slug>",
    "name": "<name>",
    "datasource_kind": "<datasource_kind>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org.1234567890",
    "slug": "ds.vector.support",
    "name": "Support Knowledge Base (Vector DB)",
    "description": "Vector database containing embeddings of support documents for semantic RAG retrieval.",
    "datasource_kind": "vector-db",
    "connector_slug": "connector:pinecone",
    "default_collection": "kb_support",
    "collections": [
      {
        "collection_key": "kb_support",
        "description": "Embedded support articles and troubleshooting guides.",
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "embedding": {
              "type": "array"
            },
            "metadata": {
              "type": "object"
            }
          }
        }
      }
    ],
    "indexing": {
      "vector_index": {
        "dimensions": 1536,
        "distance_metric": "cosine"
      }
    },
    "query_capabilities": {
      "select": false,
      "insert": true,
      "update": false,
      "delete": false,
      "vector_search": true,
      "hybrid_search": true,
      "blob_read": false,
      "blob_write": false
    },
    "auth_context_required": true,
    "allowed_agent_profile_ids": [
      "agent_support_router"
    ],
    "allowed_operator_slugs": [
      "ai.rag.retrieve",
      "datasource.query"
    ],
    "is_system": false
  }
}

更新现有数据源。

PATCH /cognitive-infrastructure/connectors/external-datasource/

使用所提供的数据更新现有数据源。

认证: Bearer 令牌

请求体

要创建的 Datasource 对象。

organization_id string 必填

该触发器关联的 OrganizationModel 标识符。

project_id string

拥有此数据源的项目 ID(租户作用域),可选。

slug string 必填

唯一标识此数据源的稳定语义键(例如 ds.crm、ds.postgres.orders、ds.vector.support)。

name string 必填

数据源的可读名称,用于编辑器和文档。

description string

可选描述,说明此数据源所代表的数据集或系统。

datasource_kind string 必填

数据源类型:"postgres"、"mysql"、"sqlserver"、"mongodb"、"s3"、"gcs"、"snowflake"、"bigquery"、"elasticsearch"、"vector-db"、"custom"。

connector_slug string

负责底层通信的 ConnectorModel 引用,可选(HTTP、驱动 API、RPC 代理、云 SDK)。

default_collection string

此数据源交互的默认数据集、表、集合或存储桶。

collections array<object>

此数据源公开的逻辑数据集或集合列表,可选,每项可附带 schema 提示。

collection_key string
description string
schema object
indexing object

此数据源的索引配置,视 datasource_kind 而定,包括主键、向量索引或搜索索引配置。

primary_key string
vector_index object
search_index object
query_capabilities object

此数据源支持的能力,例如 select、insert、update、delete、vector-search、hybrid-search、aggregation、blob-read、blob-write。

select boolean
insert boolean
update boolean
delete boolean
vector_search boolean
hybrid_search boolean
blob_read boolean
blob_write boolean
auth_context_required boolean

为 true 表示此数据源在执行查询前需要解析身份上下文(租户/用户)。

allowed_agent_profile_ids array<string>

允许对此数据源执行查询的 AgentProfileModel 标识符列表,可选。

allowed_operator_slugs array<string>

允许引用此数据源的算子类型列表,可选(例如 datasource.query、ai.rag.retrieve)。

is_system boolean

为 true 表示此数据源由平台内部管理。

is_enabled boolean

为 true 表示此数据源当前可用。

is_deprecated boolean

为 true 表示此数据源不应再用于新的流程或设计。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X PATCH https://api.sommatic.ai/cognitive-infrastructure/connectors/external-datasource/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": "<organization_id>",
    "slug": "<slug>",
    "name": "<name>",
    "datasource_kind": "<datasource_kind>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org.1234567890",
    "slug": "ds.vector.support",
    "name": "Support Knowledge Base (Vector DB)",
    "description": "Vector database containing embeddings of support documents for semantic RAG retrieval.",
    "datasource_kind": "vector-db",
    "connector_slug": "connector:pinecone",
    "default_collection": "kb_support",
    "collections": [
      {
        "collection_key": "kb_support",
        "description": "Embedded support articles and troubleshooting guides.",
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "embedding": {
              "type": "array"
            },
            "metadata": {
              "type": "object"
            }
          }
        }
      }
    ],
    "indexing": {
      "vector_index": {
        "dimensions": 1536,
        "distance_metric": "cosine"
      }
    },
    "query_capabilities": {
      "select": false,
      "insert": true,
      "update": false,
      "delete": false,
      "vector_search": true,
      "hybrid_search": true,
      "blob_read": false,
      "blob_write": false
    },
    "auth_context_required": true,
    "allowed_agent_profile_ids": [
      "agent_support_router"
    ],
    "allowed_operator_slugs": [
      "ai.rag.retrieve",
      "datasource.query"
    ],
    "is_system": false
  }
}

按 id 删除数据源。

DELETE /cognitive-infrastructure/connectors/external-datasource/

根据所提供的 ID 删除数据源。

认证: Bearer 令牌

请求体

要删除的数据源 ID

id string

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X DELETE https://api.sommatic.ai/cognitive-infrastructure/connectors/external-datasource/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "<id>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Datasource successfully deleted",
  "result": null
}

按查询选择器获取数据源。

GET /cognitive-infrastructure/connectors/external-datasource/{queryselector}

返回与路由中指定的查询选择器和搜索条件匹配的数据源信息。

认证: Bearer 令牌

参数

queryselector enum 路径 必填

此查询可用的筛选条件

idorganization-idall

search string 查询

用于搜索实体的关键字。

include_status string 查询

可选的状态参数,用于包含指定状态的数据源。

exclude_status string 查询

可选的状态参数,用于排除指定状态的数据源。

page integer 查询

页码,从 1 开始(默认 1)。

pageSize integer 查询

每页记录数(默认 25)。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X GET https://api.sommatic.ai/cognitive-infrastructure/connectors/external-datasource/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org.1234567890",
    "slug": "ds.vector.support",
    "name": "Support Knowledge Base (Vector DB)",
    "description": "Vector database containing embeddings of support documents for semantic RAG retrieval.",
    "datasource_kind": "vector-db",
    "connector_slug": "connector:pinecone",
    "default_collection": "kb_support",
    "collections": [
      {
        "collection_key": "kb_support",
        "description": "Embedded support articles and troubleshooting guides.",
        "schema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "embedding": {
              "type": "array"
            },
            "metadata": {
              "type": "object"
            }
          }
        }
      }
    ],
    "indexing": {
      "vector_index": {
        "dimensions": 1536,
        "distance_metric": "cosine"
      }
    },
    "query_capabilities": {
      "select": false,
      "insert": true,
      "update": false,
      "delete": false,
      "vector_search": true,
      "hybrid_search": true,
      "blob_read": false,
      "blob_write": false
    },
    "auth_context_required": true,
    "allowed_agent_profile_ids": [
      "agent_support_router"
    ],
    "allowed_operator_slugs": [
      "ai.rag.retrieve",
      "datasource.query"
    ],
    "is_system": false
  }
}

创建记忆存储。

POST /cognitive-infrastructure/connectors/memory-store/

返回根据所提供数据创建的记忆存储。

认证: Bearer 令牌

请求体

要创建的记忆存储对象。

organization_id string

拥有此记忆存储的组织(租户)的标识符。

project_id string

拥有此记忆存储的项目 ID(租户作用域),可选。

slug string 必填

唯一标识此记忆存储的稳定语义键(例如 mem.support_conversation、mem.global_facts、mem.vector_personalization)。

name string 必填

记忆存储的可读名称,显示在编辑器和文档中。

description string

可选描述,说明存储的记忆类型及适用场景。

memory_kind string 必填

记忆后端类型:"kv-store"、"vector-memory"、"session-store"、"document-memory"、"hybrid"。

connector_slug string

负责底层访问的 ConnectorModel 引用,可选(Redis、DynamoDB、向量数据库、会话服务、自定义后端)。

backing_datasource_key string

当此记忆存储基于结构化数据源或向量数据源实现时的 DatasourceModel 键,可选。

default_namespace string

未显式提供命名空间时使用的默认命名空间、存储桶或逻辑集合。

partitioning object

定义记忆条目如何按租户、用户、流程或智能体进行分区与隔离。

strategy string

分区策略:"by-tenant"、"by-subject"、"by-tenant-and-subject"、"by-flow"、"global"、"custom"。

keys array<string>

从身份或上下文派生的逻辑分区键列表,可选(例如 ["tenant_id", "subject_id", "flow_key"])。

schema_hints object

可选的结构提示,描述此处所存记忆条目的典型形态,例如对话消息、事实、嵌入向量或会话快照。

entry_kind string

条目的高层类型:"message"、"fact"、"embedding"、"session"、"mixed"。

fields object

类 JSON Schema 结构,描述所存记录的通用字段,可选。

retention_policy object

记忆条目的保留与压缩策略,控制信息保存多久以及如何清理过旧或超量的数据。

policy_type string

保留模式:"ttl"、"sliding-window"、"max-entries-per-partition"、"manual"。

ttl_ms integer

policy_type 为 "ttl" 或 "sliding-window" 时,条目的默认存活时间(毫秒)。

max_entries_per_partition integer

每个分区允许的最大记忆条目数,超出后较早的条目将被压缩或删除。

default_ttl_ms integer

写入时未覆盖的情况下条目的默认 TTL(毫秒),可选。可独立于 retention_policy 使用,实现简单的过期行为。

query_capabilities object

此记忆存储支持的能力:读取、写入、向量搜索、列出最近条目、截断会话等。

read_by_key boolean
upsert boolean
delete boolean
list_recent boolean
truncate_partition boolean
vector_search boolean
auth_context_required boolean

为 true 表示此记忆存储在执行读写操作前需要解析身份上下文(租户/用户)。

allowed_agent_profile_ids array<string>

允许使用此记忆存储的 AgentProfileModel 标识符列表,可选。

allowed_operator_slugs array<string>

允许引用此记忆存储的算子类型列表,可选(例如 ai.chat、ai.agent、ai.rag.retrieve)。

is_system boolean

为 true 表示此记忆存储由平台内部管理。

is_enabled boolean

为 true 表示此记忆存储当前可用。

is_deprecated boolean

为 true 表示此记忆存储不应再用于新的流程或智能体。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X POST https://api.sommatic.ai/cognitive-infrastructure/connectors/memory-store/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>",
    "memory_kind": "<memory_kind>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org-123e4567e89d12d3",
    "slug": "mem.support_conversation",
    "name": "Support Conversations Memory",
    "description": "Long-lived conversational memory for support agents, storing chat history and key facts per customer across multiple tickets and flows.\n",
    "memory_kind": "hybrid",
    "connector_slug": "connector:redis_cluster",
    "backing_datasource_key": null,
    "default_namespace": "support_conversations",
    "partitioning": {
      "strategy": "by-tenant-and-subject",
      "keys": [
        "tenant_id",
        "subject_id"
      ]
    },
    "schema_hints": {
      "entry_kind": "message",
      "fields": {
        "type": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        }
      }
    },
    "retention_policy": {
      "policy_type": "sliding-window",
      "ttl_ms": 2592000000,
      "max_entries_per_partition": 500
    },
    "default_ttl_ms": 2592000000,
    "query_capabilities": {
      "read_by_key": true,
      "upsert": true,
      "delete": true,
      "list_recent": true,
      "truncate_partition": true,
      "vector_search": false
    },
    "auth_context_required": true,
    "allowed_agent_profile_ids": [
      "agent_support_router",
      "agent_support_assistant"
    ],
    "allowed_operator_slugs": [
      "ai.chat",
      "ai.agent"
    ],
    "is_system": false
  }
}

更新现有记忆存储。

PATCH /cognitive-infrastructure/connectors/memory-store/

使用所提供的数据更新现有记忆存储。

认证: Bearer 令牌

请求体

要创建的记忆存储对象。

organization_id string

拥有此记忆存储的组织(租户)的标识符。

project_id string

拥有此记忆存储的项目 ID(租户作用域),可选。

slug string 必填

唯一标识此记忆存储的稳定语义键(例如 mem.support_conversation、mem.global_facts、mem.vector_personalization)。

name string 必填

记忆存储的可读名称,显示在编辑器和文档中。

description string

可选描述,说明存储的记忆类型及适用场景。

memory_kind string 必填

记忆后端类型:"kv-store"、"vector-memory"、"session-store"、"document-memory"、"hybrid"。

connector_slug string

负责底层访问的 ConnectorModel 引用,可选(Redis、DynamoDB、向量数据库、会话服务、自定义后端)。

backing_datasource_key string

当此记忆存储基于结构化数据源或向量数据源实现时的 DatasourceModel 键,可选。

default_namespace string

未显式提供命名空间时使用的默认命名空间、存储桶或逻辑集合。

partitioning object

定义记忆条目如何按租户、用户、流程或智能体进行分区与隔离。

strategy string

分区策略:"by-tenant"、"by-subject"、"by-tenant-and-subject"、"by-flow"、"global"、"custom"。

keys array<string>

从身份或上下文派生的逻辑分区键列表,可选(例如 ["tenant_id", "subject_id", "flow_key"])。

schema_hints object

可选的结构提示,描述此处所存记忆条目的典型形态,例如对话消息、事实、嵌入向量或会话快照。

entry_kind string

条目的高层类型:"message"、"fact"、"embedding"、"session"、"mixed"。

fields object

类 JSON Schema 结构,描述所存记录的通用字段,可选。

retention_policy object

记忆条目的保留与压缩策略,控制信息保存多久以及如何清理过旧或超量的数据。

policy_type string

保留模式:"ttl"、"sliding-window"、"max-entries-per-partition"、"manual"。

ttl_ms integer

policy_type 为 "ttl" 或 "sliding-window" 时,条目的默认存活时间(毫秒)。

max_entries_per_partition integer

每个分区允许的最大记忆条目数,超出后较早的条目将被压缩或删除。

default_ttl_ms integer

写入时未覆盖的情况下条目的默认 TTL(毫秒),可选。可独立于 retention_policy 使用,实现简单的过期行为。

query_capabilities object

此记忆存储支持的能力:读取、写入、向量搜索、列出最近条目、截断会话等。

read_by_key boolean
upsert boolean
delete boolean
list_recent boolean
truncate_partition boolean
vector_search boolean
auth_context_required boolean

为 true 表示此记忆存储在执行读写操作前需要解析身份上下文(租户/用户)。

allowed_agent_profile_ids array<string>

允许使用此记忆存储的 AgentProfileModel 标识符列表,可选。

allowed_operator_slugs array<string>

允许引用此记忆存储的算子类型列表,可选(例如 ai.chat、ai.agent、ai.rag.retrieve)。

is_system boolean

为 true 表示此记忆存储由平台内部管理。

is_enabled boolean

为 true 表示此记忆存储当前可用。

is_deprecated boolean

为 true 表示此记忆存储不应再用于新的流程或智能体。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X PATCH https://api.sommatic.ai/cognitive-infrastructure/connectors/memory-store/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "name": "<name>",
    "memory_kind": "<memory_kind>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org-123e4567e89d12d3",
    "slug": "mem.support_conversation",
    "name": "Support Conversations Memory",
    "description": "Long-lived conversational memory for support agents, storing chat history and key facts per customer across multiple tickets and flows.\n",
    "memory_kind": "hybrid",
    "connector_slug": "connector:redis_cluster",
    "backing_datasource_key": null,
    "default_namespace": "support_conversations",
    "partitioning": {
      "strategy": "by-tenant-and-subject",
      "keys": [
        "tenant_id",
        "subject_id"
      ]
    },
    "schema_hints": {
      "entry_kind": "message",
      "fields": {
        "type": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        }
      }
    },
    "retention_policy": {
      "policy_type": "sliding-window",
      "ttl_ms": 2592000000,
      "max_entries_per_partition": 500
    },
    "default_ttl_ms": 2592000000,
    "query_capabilities": {
      "read_by_key": true,
      "upsert": true,
      "delete": true,
      "list_recent": true,
      "truncate_partition": true,
      "vector_search": false
    },
    "auth_context_required": true,
    "allowed_agent_profile_ids": [
      "agent_support_router",
      "agent_support_assistant"
    ],
    "allowed_operator_slugs": [
      "ai.chat",
      "ai.agent"
    ],
    "is_system": false
  }
}

按 id 删除记忆存储。

DELETE /cognitive-infrastructure/connectors/memory-store/

根据所提供的 ID 删除记忆存储。

认证: Bearer 令牌

请求体

要删除的记忆存储 ID

id string

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X DELETE https://api.sommatic.ai/cognitive-infrastructure/connectors/memory-store/ \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "<id>"
  }'
响应
{
  "status": 200,
  "success": true,
  "message": "Memory store successfully deleted",
  "result": null
}

按查询选择器获取记忆存储。

GET /cognitive-infrastructure/connectors/memory-store/{queryselector}

返回与路由中指定的查询选择器和搜索条件匹配的记忆存储信息。

认证: Bearer 令牌

参数

queryselector enum 路径 必填

此查询可用的筛选条件

idorganization-idall

search string 查询

用于搜索实体的关键字。

include_status string 查询

可选的状态参数,用于包含指定状态的模板。

exclude_status string 查询

可选的状态参数,用于排除指定状态的模板。

page integer 查询

页码,从 1 开始(默认 1)。

pageSize integer 查询

每页记录数(默认 25)。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X GET https://api.sommatic.ai/cognitive-infrastructure/connectors/memory-store/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org-123e4567e89d12d3",
    "slug": "mem.support_conversation",
    "name": "Support Conversations Memory",
    "description": "Long-lived conversational memory for support agents, storing chat history and key facts per customer across multiple tickets and flows.\n",
    "memory_kind": "hybrid",
    "connector_slug": "connector:redis_cluster",
    "backing_datasource_key": null,
    "default_namespace": "support_conversations",
    "partitioning": {
      "strategy": "by-tenant-and-subject",
      "keys": [
        "tenant_id",
        "subject_id"
      ]
    },
    "schema_hints": {
      "entry_kind": "message",
      "fields": {
        "type": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        }
      }
    },
    "retention_policy": {
      "policy_type": "sliding-window",
      "ttl_ms": 2592000000,
      "max_entries_per_partition": 500
    },
    "default_ttl_ms": 2592000000,
    "query_capabilities": {
      "read_by_key": true,
      "upsert": true,
      "delete": true,
      "list_recent": true,
      "truncate_partition": true,
      "vector_search": false
    },
    "auth_context_required": true,
    "allowed_agent_profile_ids": [
      "agent_support_router",
      "agent_support_assistant"
    ],
    "allowed_operator_slugs": [
      "ai.chat",
      "ai.agent"
    ],
    "is_system": false
  }
}

安装智能体工具

为你的编程智能体接入 Sommatic AI 官方文档:技能包、文档 MCP 服务器与 Markdown 页面,无需再抓取网页。

仅安装技能包,不会自动更新;需要时重新运行即可。

npx skills add https://docs.sommatic.ai
智能体如何读取本文档