跳到主要内容

监控端点

/monitor 端点主要服务于 SkillFlaw 的内部功能,尤其是:

  • Playground 中的流程运行
  • 聊天消息历史存储
  • 流程日志与事务记录

如果你只是把 SkillFlaw 当成应用运行时来集成,通常不需要直接调用这些端点。

Vertex Builds

/monitor/builds 这一组端点专门服务于 Playground 的构建记录查看。

当你在 Playground 中运行流程时,SkillFlaw 会调用 /build/$FLOW_ID/flow 来获取流程数据、构图并执行。 在组件逐个运行的过程中,会生成 Vertex build 记录,你可以通过 /monitor/builds 读取它们。

获取 Vertex 构建记录


_10
curl -X GET \
_10
"http://$SKILLFLAW_SERVER_ADDRESS/api/v1/monitor/builds?flow_id=$FLOW_ID" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $SKILLFLAW_API_KEY"

返回结果会按组件 ID 聚合,包含:

  • data.results
  • outputs
  • logs
  • artifacts
  • duration
  • used_frozen_result

以及与该次构建相关的元数据。

删除 Vertex 构建记录


_10
curl -X DELETE \
_10
"http://$SKILLFLAW_SERVER_ADDRESS/api/v1/monitor/builds?flow_id=$FLOW_ID" \
_10
-H "accept: */*" \
_10
-H "x-api-key: $SKILLFLAW_API_KEY"

消息端点

/monitor/messages 用于在 SkillFlaw 配置的数据库里存取消息表记录。 它们通常会在以下场景中被隐式调用:

  • 运行会产生日志 / 聊天历史的流程
  • Playground 中查看和修改 memory

获取消息


_10
curl -X GET \
_10
"http://$SKILLFLAW_SERVER_ADDRESS/api/v1/monitor/messages" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $SKILLFLAW_API_KEY"

可选筛选参数包括:

  • flow_id
  • session_id
  • sender
  • sender_name
  • order_by

删除消息

按消息 ID 批量删除:


_10
curl -v -X DELETE \
_10
"http://$SKILLFLAW_SERVER_ADDRESS/api/v1/monitor/messages" \
_10
-H "accept: */*" \
_10
-H "Content-Type: application/json" \
_10
-H "x-api-key: $SKILLFLAW_API_KEY" \
_10
-d '["MESSAGE_ID_1", "MESSAGE_ID_2"]'

更新消息


_10
curl -X PUT \
_10
"http://$SKILLFLAW_SERVER_ADDRESS/api/v1/monitor/messages/3ab66cc6-c048-48f8-ab07-570f5af7b160" \
_10
-H "accept: application/json" \
_10
-H "Content-Type: application/json" \
_10
-H "x-api-key: $SKILLFLAW_API_KEY" \
_10
-d '{
_10
"text": "testing 1234"
_10
}'

更新会话 ID


_10
curl -X PATCH \
_10
"http://$SKILLFLAW_SERVER_ADDRESS/api/v1/monitor/messages/session/01ce083d-748b-4b8d-97b6-33adbb6a528a?new_session_id=different_session_id" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $SKILLFLAW_API_KEY"

按会话删除消息


_10
curl -X DELETE \
_10
"http://$SKILLFLAW_SERVER_ADDRESS/api/v1/monitor/messages/session/different_session_id_2" \
_10
-H "accept: */*" \
_10
-H "x-api-key: $SKILLFLAW_API_KEY"

获取事务记录

事务记录描述的是一个流程中组件之间的交互过程;这些信息同样可以在流程日志中看到。


_10
curl -X GET \
_10
"http://$SKILLFLAW_SERVER_ADDRESS/api/v1/monitor/transactions?flow_id=$FLOW_ID&page=1&size=50" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $SKILLFLAW_API_KEY"

另请参阅