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

执行 Beta

运行工作流、通过 SSE 跟踪进度,并查询实例、运行结果与节点执行记录。

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

执行完整工作流

POST /workflow-orchestration/data-plane/execution-engine/execution/workflow

从草稿 FlowDefinition 或已发布的 FlowVersion 解析流程图,创建 FlowInstance,将执行委托给编排器,并持久化各步骤结果。测试草稿时提供 flow_definition_id,生产环境提供 flow_version_id。

认证: Bearer 令牌

请求体

organization_id string 必填
flow_definition_id string

草稿流程定义 ID(用于测试)。

flow_version_id string

已发布的流程版本 ID(用于生产)。

input object

工作流的输入数据。

响应

  • 200 工作流执行结果
curl -X POST https://api.sommatic.ai/workflow-orchestration/data-plane/execution-engine/execution/workflow \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": "<organization_id>"
  }'
响应 200
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "<organization_id>"
  }
}

按查询选择器获取流程实例结果。

GET /workflow-orchestration/data-plane/execution-engine/flow-instance-result/{queryselector}

返回与路由中指定的查询选择器和搜索条件匹配的流程实例结果信息。

认证: Bearer 令牌

参数

queryselector enum 路径 必填

此查询可用的筛选条件

idorganization-idall

search string 查询

用于搜索实体的关键字。

include_status string 查询

可选的状态参数,用于包含指定状态的流程实例结果。

exclude_status string 查询

可选的状态参数,用于排除指定状态的流程实例结果。

page integer 查询

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

pageSize integer 查询

每页记录数(默认 25)。

hydrate boolean 查询

为“true”时,返回文档中的每个 `$payloadRef` 描述符都会在服务端解析,并替换为原先外置的内容,使调用方获得与 claim-check 优化之前相同的内联载荷。适用于需要在一次响应中获取完整内容的程序化调用方(Command Center 上下文、集成)。UI 读取时请保持关闭——Run Detail 界面会按 chip 懒加载外置内容。临时的 `_truncated` 标记无法还原(其内容从未被存储)。

响应

  • 200 成功。
  • 500 执行此操作时出错。
curl -X GET https://api.sommatic.ai/workflow-orchestration/data-plane/execution-engine/flow-instance-result/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_blackwood_stone_2319",
    "flow_instance_id": "inst_91827",
    "flow_version_id": "flow-def-email-routing:v1.3.0",
    "flow_slug": "flow.email_classify_and_route",
    "status": {
      "id": 5,
      "name": "completed",
      "title": "Completed",
      "color": null
    },
    "started_at": 1735692000000,
    "completed_at": 1735692002450,
    "duration_ms": 2450,
    "correlation_id": "corr_f0c9e3b1",
    "trigger_id": "trig_email_ingress",
    "outcome_label": "success_billing_ticket_created",
    "outcome_category": "success",
    "final_output_envelope": {
      "payload": {
        "ticket_id": "TCK-392818",
        "category": "billing",
        "customer_id": "customer-123",
        "status": "created"
      }
    },
    "error_summary": null,
    "metrics": {
      "node_count_total": 4,
      "node_count_succeeded": 4,
      "node_count_failed": 0,
      "node_count_retried": 1,
      "retry_count_total": 1,
      "max_concurrent_nodes": 2
    }
  }
}

按查询选择器获取节点执行记录。

GET /workflow-orchestration/data-plane/execution-engine/node-execution/{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/workflow-orchestration/data-plane/execution-engine/node-execution/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_1234",
    "flow_instance_id": "inst_91827",
    "node_id": "classify_email",
    "attempt_number": 2,
    "status": "success",
    "started_at": 1735692000000,
    "ended_at": 1735692001423,
    "input_envelope": {
      "node_id": "trigger_email",
      "payload": {
        "subject": "Invoice overdue",
        "body": "I have not received payment confirmation..."
      }
    },
    "output_envelope": {
      "node_id": "classify_email",
      "payload": {
        "category": "billing",
        "confidence": 0.87
      }
    },
    "selected_port": "out",
    "execution_result": {
      "ai_decision": {
        "label": "billing",
        "confidence": 0.87
      }
    },
    "error_details": null,
    "metrics": {
      "latency_ms": 423,
      "token_usage": {
        "prompt_tokens": 1123,
        "completion_tokens": 64
      }
    },
    "worker_id": "worker-west-02"
  }
}

按查询选择器获取流程实例。

GET /workflow-orchestration/data-plane/instance-runtime/flow-instance/{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/workflow-orchestration/data-plane/instance-runtime/flow-instance/id \
  -H "Authorization: Bearer $SOMMATIC_TOKEN"
响应
{
  "status": 200,
  "success": true,
  "message": "Operation completed successfully",
  "result": {
    "organization_id": "org_blackwood",
    "flow_version_id": "flow-def-email-routing:v1.3.0",
    "flow_slug": "flow.email_classify_and_route",
    "status": "running",
    "started_at": 1735689000000,
    "completed_at": null,
    "active_node_id": "classify_email",
    "queued_node_ids": [
      "create_ticket"
    ],
    "variables": {
      "email_subject": "Payment not received",
      "email_body": "Hello, I have not received my invoice for December...",
      "classification": {
        "category": "billing",
        "confidence": 0.92
      }
    },
    "last_envelope": {
      "node_id": "classify_email",
      "payload": {
        "category": "billing",
        "confidence": 0.92
      }
    },
    "pending_async_operations": [
      {
        "operation_key": "tool.openai_async_chat",
        "status": "waiting-callback"
      }
    ],
    "linked_timer_ids": [
      "timer_8ab233"
    ],
    "execution_history_ids": [
      "exec_123",
      "exec_124"
    ],
    "resume_strategy": "continue-node"
  }
}

工作流执行事件的实时 SSE 流

GET /workflow-orchestration/execution/stream

建立 Server-Sent Events 连接,实时接收指定工作流和用户的执行进度。

认证: Bearer 令牌

参数

flow_definition_id string 查询 必填

要监听执行事件的工作流 ID。

user_identity string 查询 必填

监听事件的用户身份。

响应

  • 200 SSE 流已成功建立。
curl -X GET https://api.sommatic.ai/workflow-orchestration/execution/stream?flow_definition_id=<flow_definition_id>&user_identity=<user_identity> \
  -H "Authorization: Bearer $SOMMATIC_TOKEN" \
  -N

安装智能体工具

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

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

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