Palantir Action 与 Automate 配置参考

Palantir Action 与 Automate 配置参考

Palantir Foundry 中 Action Type 和 Automate 规则的 JSON 配置骨架。这些 schema 通常在 Ontology Manager 或 Developer Console 中编辑/导出,是理解平台内部数据模型的直接参考。每个字段均附中文注释。

前置阅读:本文是以下两篇的配套参考,建议先读完再对照使用。

格式说明:下文 JSON 为平台内部概念骨架(教学表示),用于理解各字段的语义和关系。Palantir 官方 UI/Developer Console 中的实际入口以界面为准,不同版本字段名可能略有差异。


一、Action Type JSON 配置骨架

{ "apiName": "assign-alert-to-group", "displayName": "Assign Alert to Group", "description": "将告警分派给指定处理组并设置优先级", // ── 参数定义 ── "parameters": { "alert": { "type": "objectType:Alert", "required": true, "description": "待分派的告警对象" }, "group": { "type": "objectType:Group", "required": true, "description": "目标处理组" }, "priority": { "type": "string", "required": false, "defaultValue": "HIGH", "allowedValues": ["LOW","MEDIUM","HIGH","CRITICAL"] } }, // ── 前置校验(提交前必须满足的条件) ── "submissionCriteria": [ { "type": "objectPropertyCondition", "objectParameterId": "alert", "propertyApiName": "status", "operator": "EQUALS", "value": "OPEN", "errorMessage": "只能分派状态为 OPEN 的告警" }, { "type": "linkExistsCondition", "objectParameterId": "alert", "linkTypeApiName": "Alert.belongsTo.Factory", "targetObjectParameterId": null, "errorMessage": "告警必须关联到一个工厂" } ], // ── 权限控制 ── "permissions": { "defaultRole": "DENY", "roleGrants": [ { "roleId": "alert-manager", "operations": ["EXECUTE"], "markings": [] }, { "roleId": "sre-reader", "operations": ["VIEW"] } ], "requireMarkingAccess": true }, // ── 编辑操作(实际写回 Ontology) ── "edits": [ { "type": "modifyObject", "objectParameterId": "alert", "properties": { "priority": "$parameter.priority", "status": "ACK" } }, { "type": "createLink", "objectParameterId": "alert", "linkTypeApiName": "Alert.assignedTo.Group", "targetObjectParameterId": "group" } ], // ── 提交后的副作用 ── "sideEffects": { "notifications": [ { "type": "foundryNotification", "recipients": { "linkedObjects": { "objectParameterId": "group", "linkTypeApiName": "Group.hasMembers.Person" } }, "title": "新告警分派通知", "body": "告警 ${alert.id} 已分派至 ${group.name},优先级:${priority}" } ], "webhooks": [ { "url": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx", "method": "POST", "headers": {"Content-Type": "application/json"}, "bodyTemplate": { "msgtype": "text", "text": { "content": "【告警分派】${alert.id} → ${group.name}" } } } ] }, // ── 幂等策略 ── "idempotencyBehavior": { "strategy": "UPSERT", "dedupKeys": ["alert.apiName"] }, // ── 审计 ── "auditConfig": { "recordExecutions": true, "includeInputParameters": true, "provenanceSource": "ACTION" } }

关键字段说明

字段 可选值 / 说明
parameters.*.type objectType:<TypeName> 引用 Ontology 对象;原始类型如 string、float、enum
submissionCriteria[*].type objectPropertyCondition(属性条件)/ linkExistsCondition(Link 存在性)/ 自定义 Function
permissions.defaultRole DENY(默认拒绝)/ ALLOW(默认放行)
edits[*].type modifyObject / createLink / deleteLink
idempotencyBehavior.strategy UPSERT(存在则更新)/ NO_OP(重复无操作)/ ALWAYS_CREATE
auditConfig.provenanceSource ACTION / AIP_AGENT / AUTOMATE

二、Automate 规则 JSON 配置骨架

{ "apiName": "auto-assign-high-temp-alerts", "displayName": "高温告警自动分派", "description": "当检测到温度超过 80°C 的新告警时,自动计算优先级并分派给对应处理组", // ── 触发条件 ── "trigger": { "type": "objectChange", "objectTypeApiName": "Alert", "eventTypes": ["CREATE"], "filter": { "type": "and", "conditions": [ { "type": "propertyCondition", "propertyApiName": "status", "operator": "EQUALS", "value": "OPEN" }, { "type": "propertyCondition", "propertyApiName": "temperature", "operator": "GREATER_THAN", "value": 80 } ] } }, // ── 执行效果(按顺序或并行) ── "effects": [ { "type": "function", "functionRid": "ri.function.main.function.abc123", "inputMapping": { "alert": "$trigger.object", "factoryLookup": { "type": "lookup", "objectTypeApiName": "Factory", "query": { "propertyApiName": "factoryId", "value": "$trigger.object.factoryId" } } }, "outputVariableName": "calculationResult", "retryConfig": { "maxAttempts": 3, "backoffMultiplier": 2.0, "initialDelayMs": 1000 }, "fallback": { "type": "action", "actionApiName": "assign-alert-to-group", "inputMapping": { "alert": "$trigger.object", "group": "default-unassigned-group", "priority": "LOW" } } }, { "type": "action", "actionApiName": "assign-alert-to-group", "inputMapping": { "alert": "$trigger.object", "group": "$effect[0].output.group", "priority": "$effect[0].output.priority" }, "executionMode": "SEQUENTIAL", "waitForCompletion": true }, { "type": "notification", "recipients": { "staticUsers": ["user:ops-lead@company.com"], "dynamicGroups": { "objectParameterId": "$effect[1].output.group", "linkTypeApiName": "Group.hasManagers.Person" } }, "title": "告警自动分派完成", "body": "告警 ${$trigger.object.id} 已自动分派至 ${$effect[0].output.group.name}", "attachments": [ { "type": "pdfReport", "templateRid": "ri.report-template.main.xyz456" } ] } ], // ── 执行模式 ── "executionConfig": { "mode": "PER_OBJECT", "batchSize": 50, "maxConcurrentExecutions": 10 }, // ── 日志与监控 ── "logging": { "level": "INFO", "capturePayloads": true, "alertsOnFailure": true, "failureThreshold": 5 }, // ── 启用/禁用 ── "enabled": true, "schedule": { "type": "continuous" } }

关键字段说明

字段 可选值 / 说明
trigger.type objectChange(对象变更)/ schedule(定时)/ webhook(外部回调)
trigger.eventTypes CREATE / UPDATE / DELETE,可组合数组
effects[*].type function / action / notification / webhook
effects[*].inputMapping 支持 $trigger.object、$effect[N].output.* 变量引用
executionConfig.mode PER_OBJECT(每个对象独立执行)/ BATCH(批量合并执行)
schedule.type continuous(持续监听)/ cron(如 "0 9 * * 1-5" 每周一~五 09:00)

三、AIP Agent Tool 配置片段

在 AIP Agent 的 Tool 定义中,Action 被暴露为可调用工具:

{ "tools": [ { "type": "ontologicalAction", "actionApiName": "assign-alert-to-group", "displayName": "分派告警", "description": "将告警分派给处理组,仅限状态为 OPEN 的告警", "governance": { "autoApproveConditions": [ { "condition": "priority != CRITICAL && status == OPEN", "reason": "非紧急告警可自动分派" } ], "humanInTheLoopConditions": [ { "condition": "priority == CRITICAL", "reason": "紧急告警需人工确认处理组" } ], "denyConditions": [ { "condition": "status != OPEN", "reason": "已处理的告警不可重新分派" } ] }, "inputBinding": { "alert": { "source": "conversationEntity", "entityType": "Alert" }, "group": { "source": "llmReasoning", "fallbackQuery": "查询当前值班组" }, "priority": { "source": "functionCall", "functionRid": "ri.function.main.calculate-priority" } } } ] }

inputBinding 来源类型

source 说明
conversationEntity 从对话上下文中提取的 Ontology 实体
llmReasoning 由 LLM 推理得出,可设 fallbackQuery 兜底
functionCall 调用另一个 Function 计算后填入
staticValue 静态常量值

四、关键设计原则

从 JSON 结构可反推出以下平台设计原则:

层面 原则
参数类型 尽量用 objectType: 引用 Ontology 对象,而非原始字符串,保证语义一致性
Submission Criteria 写在 Action 里而非 Automate 里,确保人/Agent/Automate 任何调用方都遵守相同规则
权限 写在 Action 层,Automate 继承 Action 的权限,不额外定义
Side Effects 只放纯副作用(通知/Webhook),业务逻辑放 Function 或 Edits
Automate Function 只做计算(优先级、映射表),不做写操作;写操作统一交给 Action
幂等 优先用 UPSERT 策略,避免重复执行造成脏数据

五、常见错误与建议

  1. 不要把业务逻辑塞进 Side Effect Side Effect 只适合通知、Webhook 等纯副作用操作。业务判断应放在 Function 或 Action Edits 里。

  2. Automate filter 不要写太复杂 复杂条件拆成 Function 去算,filter 只保留最基础的属性判断,保持规则可读性和执行效率。

  3. Human-in-the-loop 不要全量加 只在确实需要人工判断的地方加(如 CRITICAL 级别、涉及合同或大额资金),否则 Agent 自动化价值大打折扣。

  4. 上线前禁用再验证 开发时先把 enabled 设为 false,手动触发验证逻辑后再上线。

  5. 审计配置不要省 auditConfig.recordExecutions: true 是企业级落地的底线,缺了这条全链路无法追溯。


需要针对某个具体场景(如供应链缺料调拨、风控案件分派)展开完整配置示例,或深入了解 Function-backed Action 的写法,可以随时提问。

阅读 — · 全站 —
🎸 我的歌单 0 首