pipefy-ai-agents
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAI Agents
AI Agents
Conversational AI agents attached to pipes. Each agent has an agent-level instruction and 1–5 behaviors, each with its own trigger event, prompt, and actions. 7 MCP tools.
For traditional automations and AI automations (prompt-driven), see skills/automations/pipefy-automations/SKILL.md.
关联到管道的对话式AI Agent。每个Agent包含一个Agent级指令和1-5种行为,每种行为都有自己的触发事件、提示词和操作。7种MCP工具。
如需了解传统自动化和AI自动化(提示词驱动),请查看skills/automations/pipefy-automations/SKILL.md。
Tools
工具
| Tool (MCP) | CLI | Read-only | Purpose |
|---|---|---|---|
| | Yes | List AI agents for a pipe ( |
| | Yes | Full agent config including behaviors. |
| | No | Create a new conversational agent. |
| | No | Full-replace (not patch). Always send complete |
| | No | (Two-step destructive) |
| | No | Enable/disable the agent (e.g. |
| | Yes | Pre-flight check before create/update. |
The read tools (, , ) and the write tools (///) are all remote-safe: available under the hosted () surface.
get_ai_agentsget_ai_agentvalidate_ai_agent_behaviorscreateupdatedeletetoggleprofile=remoteExecution logs live in skills/observability/ (, ).
get_ai_agent_logsget_ai_agent_log_details| 工具(MCP) | CLI 命令 | 只读 | 用途 |
|---|---|---|---|
| | 是 | 列出指定管道的AI Agent( |
| | 是 | 获取包含行为的完整Agent配置。 |
| | 否 | 创建新的对话式Agent。 |
| | 否 | 全量替换(非增量更新)。发送请求时必须包含完整的 |
| | 否 | (两步式破坏性操作) |
| | 否 | 启用/禁用Agent(例如使用 |
| | 是 | 创建/更新前的预飞检查。 |
只读工具(、、)和写入工具(///)均支持远程调用:可在托管环境()下使用。
get_ai_agentsget_ai_agentvalidate_ai_agent_behaviorscreateupdatedeletetoggleprofile=remote执行日志可在skills/observability/中查看(、)。
get_ai_agent_logsget_ai_agent_log_detailsCreation workflow (discover → validate → create → verify)
创建流程(发现 → 验证 → 创建 → 确认)
Never guess event IDs, phase IDs, action types, or field IDs.
切勿猜测事件ID、阶段ID、操作类型或字段ID。
1 — Get pipe metadata
1 — 获取管道元数据
Call and extract:
get_pipe(pipe_id)- → use as
uuidin all AI-agent tools.repo_uuid - /
phases[].id→ needed forphases[].nameactions.move_card - Fields via and/or
get_start_form_fields(pipe_id)→ needed forget_phase_fields(phase_id)actions.update_card
调用并提取:
get_pipe(pipe_id)- → 在所有AI Agent工具中用作
uuid。repo_uuid - /
phases[].id→ 执行phases[].name操作时需要。move_card - 通过和/或
get_start_form_fields(pipe_id)获取字段 → 执行get_phase_fields(phase_id)操作时需要。update_card
2 — Check existing agents
2 — 检查现有Agent
get_ai_agents(repo_uuid)update_ai_agentget_ai_agent(uuid)调用避免重复创建。如需修改现有Agent,请使用(而非创建新Agent)。如需获取完整配置,请使用。
get_ai_agents(repo_uuid)update_ai_agentget_ai_agent(uuid)3 — Discover valid trigger events
3 — 发现有效的触发事件
get_automation_events(pipe_id)Event ( | | Example |
|---|---|---|
| card_created | None | |
| card_moved | | Fires only when card enters that phase. |
| field_updated | | Fires only when those fields change. |
| manually_triggered | None | User clicks button on card. |
For and , you MUST include . Omitting it makes the behavior fire on every occurrence.
card_movedfield_updatedevent_params调用。常见事件:
get_automation_events(pipe_id)事件( | 是否需要 | 示例 |
|---|---|---|
| card_created | 否 | |
| card_moved | 是 | |
| field_updated | 是 | |
| manually_triggered | 否 | 用户点击卡片上的按钮时触发。 |
对于和,必须包含。省略该参数会导致行为在每次事件发生时都触发。
card_movedfield_updatedevent_params4 — Discover valid action types
4 — 发现有效的操作类型
get_automation_actions(pipe_id)actionTypemetadataAction ( | |
|---|---|
| update_card | |
| move_card | |
| create_card | |
| create_connected_card | |
| create_table_record | |
| send_email_template | |
fieldIdinternal_idcreate_table_recordget_tableget_table_record调用。已知的6种值及其所需的:
get_automation_actions(pipe_id)actionTypemetadata操作( | 是否需要 |
|---|---|
| update_card | 是 |
| move_card | 是 |
| create_card | 是 |
| create_connected_card | 是 |
| create_table_record | 是 |
| send_email_template | 是 |
卡片操作的值接受字段别名(slug)或数字;的为表格字段ID(需通过 / 验证,而非管道)。
fieldIdinternal_idcreate_table_recordfieldIdget_tableget_table_record5 — Build the behavior dict
5 — 构建行为字典
json
{
"name": "<descriptive name>",
"event_id": "<from step 3>",
"event_params": {},
"actionParams": {
"aiBehaviorParams": {
"instruction": "<prompt for the AI when this event fires>",
"actionsAttributes": [
{ "name": "<action label>", "actionType": "<from step 4>", "metadata": { } }
]
}
}
}- Each behavior MUST have at least one action in .
actionsAttributes - Maximum 5 behaviors per agent.
- The MCP tool auto-injects and
referenceIdplaceholders — do NOT generate these yourself.%{action:<uuid>} - is required on every
inputModeentry (omitting it fails model validation). Values:fieldsAttributes(AI writes the value into an output field),fill_with_ai(use the literalfixed_value),value(copy_fromis avaluetemplate copying another field).%{…} - Input field references (in the behavior
%{field:<internal_id>}, auto-populated intoinstructionon create/update) are needed only when the AI must read card field values, not for everyreferencedFieldIds(e.g. instruction-only, OCR/attachment, or knowledge-base context). When card inputs are needed and omitted,fill_with_aiarrives empty at trigger time and the model may hallucinate. A wrong numeric input id is accepted silently (validate and create/update) and becomes a deadcard.fields; a wrong slug never resolves and is dropped by the digits-only extractor (unresolved token). Either wayreferencedFieldIdstays empty (same hallucination); confirm the id withcard.fields/get_start_form_fields. Dotted connected-pipe refs (get_phase_fields) are not forwarded at runtime; to read a connected card field, use a field on the current pipe.%{field:<parent>.<child>} - For : set
update_cardwhen not moving the card.destinationPhaseId: ""
json
{
"name": "<描述性名称>",
"event_id": "<来自步骤3>",
"event_params": {},
"actionParams": {
"aiBehaviorParams": {
"instruction": "<事件触发时给AI的提示词>",
"actionsAttributes": [
{ "name": "<操作标签>", "actionType": "<来自步骤4>", "metadata": { } }
]
}
}
}- 每个行为的中必须至少包含一个操作。
actionsAttributes - 每个Agent最多包含5种行为。
- MCP工具会自动注入和
referenceId占位符 — 请勿自行生成。%{action:<uuid>} - 每个条目必须包含
fieldsAttributes(省略会导致模型验证失败)。可选值:inputMode(AI将值写入输出字段)、fill_with_ai(使用字面fixed_value)、value(copy_from为value模板,复制另一个字段的值)。%{…} - 仅当AI需要读取卡片字段值时,才需要在行为中添加输入字段引用(
instruction,创建/更新时会自动填充到%{field:<internal_id>}),并非所有referencedFieldIds场景都需要(例如仅提示词、OCR/附件或知识库上下文场景)。若需要卡片输入但未添加引用,触发时fill_with_ai会为空,模型可能产生幻觉。错误的数字输入ID会被静默接受(验证和创建/更新时),成为无效的card.fields;错误的字段别名无法解析,会被数字提取器丢弃(未解析令牌)。两种情况都会导致referencedFieldId为空(同样产生幻觉);请通过card.fields/get_start_form_fields确认ID。带点的关联管道引用(get_phase_fields)在运行时不会被转发;如需读取关联卡片字段,请使用当前管道的字段。%{field:<parent>.<child>} - 对于:不移动卡片时,请设置
update_card。destinationPhaseId: ""
Example identifiers (fictional)
示例标识符(虚构)
Use real values from / for your org. Placeholders below match unit-test fixtures in this repo. The syntax matters (, , , ) — the example digits do not; substitute each pipe's numeric and phase id.
get_pipeget_start_form_fieldspipeIdfieldId%{field:<internal_id>}inputModeinternal_id| Role | Example value |
|---|---|
| Pipe (numeric repo id) | |
Field | |
Destination phase ( | |
Target pipe ( | |
请使用您组织中 / 返回的真实值。以下占位符与本仓库中的单元测试 fixture 匹配。语法至关重要(、、、)— 示例数字无关紧要;请替换为每个管道的数字和阶段ID。
get_pipeget_start_form_fieldspipeIdfieldId%{field:<internal_id>}inputModeinternal_id| 角色 | 示例值 |
|---|---|
| 管道(数字仓库ID) | |
字段 | |
目标阶段( | |
目标管道( | |
Metadata examples
Metadata示例
json
// update_card — output field fill_with_ai; input fields referenced in instruction
{ "pipeId": "987654321", "destinationPhaseId": "", "fieldsAttributes": [{ "fieldId": "900000101", "inputMode": "fill_with_ai", "value": "" }] }
// companion instruction (aiBehaviorParams.instruction), not metadata:
// "Read %{field:900000102} (title) and %{field:900000103} (description), then fill the category."
// move_card
{ "destinationPhaseId": "900000201", "pipeId": "", "fieldsAttributes": [] }
// create_card
{ "pipeId": "900000301", "fieldsAttributes": [{ "fieldId": "title", "inputMode": "fill_with_ai", "value": "" }] }
// create_table_record (fieldsAttributes are TABLE field IDs; no pipeId)
{ "tableId": "<table_id>", "fieldsAttributes": [{ "fieldId": "<table_field_id>", "inputMode": "fill_with_ai", "value": "" }] }
// send_email_template
{ "emailTemplateId": "<template_id>", "allowTemplateModifications": false }json
// update_card — 输出字段使用fill_with_ai;提示词中引用输入字段
{ "pipeId": "987654321", "destinationPhaseId": "", "fieldsAttributes": [{ "fieldId": "900000101", "inputMode": "fill_with_ai", "value": "" }] }
// 对应的提示词(aiBehaviorParams.instruction),非metadata:
// "读取%{field:900000102}(标题)和%{field:900000103}(描述),然后填写分类。"
// move_card
{ "destinationPhaseId": "900000201", "pipeId": "", "fieldsAttributes": [] }
// create_card
{ "pipeId": "900000301", "fieldsAttributes": [{ "fieldId": "title", "inputMode": "fill_with_ai", "value": "" }] }
// create_table_record(fieldsAttributes为表格字段ID;无需pipeId)
{ "tableId": "<table_id>", "fieldsAttributes": [{ "fieldId": "<table_field_id>", "inputMode": "fill_with_ai", "value": "" }] }
// send_email_template
{ "emailTemplateId": "<template_id>", "allowTemplateModifications": false }5b — Optional: capabilities and LLM provider
5b — 可选:功能与LLM提供商
Inside a behavior may also carry:
actionParams.aiBehaviorParams-
— advanced tools the behavior can use. Each entry is exactly
capabilitiesAttributes(both keys required, no extra keys — bare strings or{ "capabilityType": "<type>", "enabled": true|false }are rejected).{ "type": ... }Product name capabilityTypeIDP / Intelligent Document Processing advanced_ocrCalculations & Analysis math_operationsWeb Search web_searchWeb Scraping web_scrapingMax effort max_effortis not checked against a fixed set — any value passes through and the API validates the enum on write, so new capabilities work without a toolkit update. Validation checks shape only, not entitlement — a capability may still require organization-level enablement to have any effect, so a green pre-flight does not guarantee the capability is active for the org.capabilityType -
/
providerId— pick the behavior's LLM provider. Set at most one (a behavior resolves to a single active provider). Discover valid IDs withsystemProviderId(CLI:get_llm_providers): each provider carriespipefy ai-provider list— usetypefor a custom (providerId) provider andbyomfor a Pipefy-managed (systemProviderId) one.systemshows what a behavior falls back to when neither is set. IDs are also visible in the organization's AI settings in the Pipefy UI.get_default_llm_providerBring your own model (custom provider). To back a behavior with your own vendor credentials, create a custom provider first, then use itsasid:providerId(confirm read access — writes need the strongervalidate_llm_provider_accessorg permission and an eligible plan, so a write may still be denied) →manage_ai_providerswith the configuration in a local JSON file (create_llm_provider; never inline — secrets are never logged or returned; the file'sconfiguration_file_pathkey selects the vendor). Manage it withprovider(send the full configuration; leave theupdate_llm_providerplaceholders from__REDACTED__in place to keep existing secrets, or put a new value to rotate one),get_llm_providers, andset_llm_provider_active_status(checkdelete_llm_providerfirst). Set the organization default withget_llm_provider_dependencies(exactly one ofset_default_llm_provider/provider_id) or clear it withsystem_provider_id. CLI:reset_default_llm_provider/pipefy ai-provider create/update/delete/set-active-status/default set.default reset -
— knowledge base sources the behavior can draw on. Each ID is a knowledge base item ID from
dataSourceIds(CLI:get_ai_knowledge_bases). Agents also carry an agent-levelpipefy kb list; the two are unioned. See Knowledge bases below for the create → attach flow.data_source_ids
json
{
"instruction": "Extract totals from the attached invoice.",
"capabilitiesAttributes": [{ "capabilityType": "advanced_ocr", "enabled": true }],
"actionsAttributes": [ /* ... */ ]
}在中,行为还可包含:
actionParams.aiBehaviorParams-
— 行为可使用的高级工具。每个条目必须严格为
capabilitiesAttributes(必须包含两个键,无额外键 — 纯字符串或{ "capabilityType": "<type>", "enabled": true|false }会被拒绝)。{ "type": ... }产品名称 capabilityTypeIDP / 智能文档处理 advanced_ocr计算与分析 math_operations网页搜索 web_search网页抓取 web_scraping最大算力 max_effort不会与固定集合校验 — 任何值都会被传递,API会在写入时验证枚举值,因此新功能无需更新工具包即可使用。验证仅检查格式,而非权限 — 功能可能仍需组织级启用才能生效,因此预飞检查通过不代表该功能在组织中已激活。capabilityType -
/
providerId— 选择行为的LLM提供商。最多设置其中一个(一个行为只能对应一个活跃提供商)。通过systemProviderId(CLI:get_llm_providers)获取有效ID:每个提供商包含pipefy ai-provider list— 自定义(type)提供商使用byom,Pipefy托管(providerId)提供商使用system。systemProviderId可查看未设置时行为默认使用的提供商。ID也可在Pipefy UI的组织AI设置中查看。get_default_llm_provider自带模型(自定义提供商)。如需使用自有供应商凭证支持行为,请先创建自定义提供商,然后将其用作id:调用providerId(确认读取权限 — 写入需要更强的validate_llm_provider_access组织权限和符合要求的套餐,因此写入仍可能被拒绝)→ 使用本地JSON文件(manage_ai_providers;请勿内联配置 — 密钥不会被记录或返回;文件中的configuration_file_path键选择供应商)调用provider。通过create_llm_provider(发送完整配置;保留update_llm_provider返回的get_llm_providers占位符以保留现有密钥,或输入新值进行轮换)、__REDACTED__和set_llm_provider_active_status(先调用delete_llm_provider)进行管理。通过get_llm_provider_dependencies(set_default_llm_provider/provider_id二选一)设置组织默认提供商,或通过system_provider_id清除默认设置。CLI命令:reset_default_llm_provider/pipefy ai-provider create/update/delete/set-active-status/default set。default reset -
— 行为可调用的知识库来源。每个ID来自
dataSourceIds(CLI:get_ai_knowledge_bases)返回的知识库条目ID。Agent也包含Agent级的pipefy kb list;两者会合并。请查看下方的知识库了解创建 → 关联流程。data_source_ids
json
{
"instruction": "从附件发票中提取总金额。",
"capabilitiesAttributes": [{ "capabilityType": "advanced_ocr", "enabled": true }],
"actionsAttributes": [ /* ... */ ]
}6 — Validate (recommended for complex behaviors)
6 — 验证(复杂行为推荐执行)
validate_ai_agent_behaviors(pipe_id, behaviors)- Output field IDs () exist in the pipe
fieldsAttributes[].fieldId - Phase IDs exist
- Pipe relations exist for
create_connected_card - Action types are valid (the 6 in ;
KNOWN_AI_ACTION_TYPEScreate_table_recordare table field IDs, so they are not checked against the pipe and surface a warning to verify withfieldsAttributes;get_tablemetadata runs no pipe field-ID checks)send_email_template - Behavior structure passes Pydantic validation (including canonical shape and at most one of
capabilitiesAttributes/providerId)systemProviderId - values (outputs) are checked against start-form and phase fields, accepting both slug
fieldsAttributes[].fieldIdand numericid. Instructioninternal_idtokens (inputs) are not existence-checked: a missing id/slug still yields%{field:...}. Slug → numeric rewrite happens only on create/update, not here.valid: true - Pass (agent-level) to also check knowledge base membership: it is unioned with each behavior's
data_source_idsand checked against the pipe's knowledge bases. Unknown IDs are warnings only (dataSourceIdsstays true); if the knowledge base list cannot be read, a single warning is added and the check is skipped.valid
strict_unknown_action_typestrueactionTypeproblemsfalsewarningsvalid--strict--no-strictagent validate-behaviorsagent createagent updatevalidate_ai_agent_behaviors(pipe_id, behaviors)- 输出字段ID()是否存在于管道中
fieldsAttributes[].fieldId - 阶段ID是否存在
- 所需的管道关联关系是否存在
create_connected_card - 操作类型是否有效(中的6种;
KNOWN_AI_ACTION_TYPES的create_table_record为表格字段ID,因此不会与管道校验,会显示警告提示通过fieldsAttributes验证;get_table的metadata不会进行管道字段ID校验)send_email_template - 行为结构是否通过Pydantic验证(包括规范的格式,以及最多设置一个
capabilitiesAttributes/providerId)systemProviderId - 值(输出字段)会与启动表单和阶段字段校验,接受字段别名
fieldsAttributes[].fieldId和数字id。提示词中的internal_id令牌(输入字段)不会进行存在性校验:缺失的ID/别名仍会返回%{field:...}。字段别名→数字ID的转换仅在创建/更新时进行,不在此步骤。valid: true - 传入(Agent级)还会检查知识库成员资格:会与每个行为的
data_source_ids合并,并与管道的知识库进行校验。未知ID仅会触发警告(dataSourceIds仍为true);若无法读取知识库列表,会添加一个警告并跳过此检查。valid
strict_unknown_action_typestrueactionTypeproblemsfalsevalidagent validate-behaviorsagent createagent update--strict--no-strict7 — Create the agent
7 — 创建Agent
create_ai_agentnamerepo_uuidinstructionbehaviorsThe CLI / require (numeric pipe id) and run automatically as a pre-flight, blocking the write when are found and surfacing under a key. The MCP tools do not auto-preflight, so call yourself (step 6) before / . CLI flags: , , , (JSON array), (JSON array); instead takes (repeatable).
agent createagent update--pipevalidate_ai_agent_behaviorsproblemswarningspreflightvalidate_ai_agent_behaviorscreate_ai_agentupdate_ai_agent--repo-uuid--name--instruction--behaviors--data-sourcesagent validate-behaviors--data-source-idOn create/update, slug values are resolved to numeric , is rewritten to , and is auto-populated when applicable.
fieldIdinternal_id%{field:<slug>}%{field:<internal_id>}referencedFieldIds调用并传入、、和。推荐一次性创建 — 避免生成不完整的Agent外壳。Agent默认处于活跃状态。
create_ai_agentnamerepo_uuidinstructionbehaviorsCLI的 / 命令需要(数字管道ID),并会自动运行作为预飞检查,当发现时会阻止写入,并在键下显示。MCP工具不会自动执行预飞检查,因此请在调用 / 前自行执行步骤6的验证。CLI参数:、、、(JSON数组)、(JSON数组);则使用(可重复使用)。
agent createagent update--pipevalidate_ai_agent_behaviorsproblemspreflightwarningscreate_ai_agentupdate_ai_agent--repo-uuid--name--instruction--behaviors--data-sourcesagent validate-behaviors--data-source-id创建/更新时,字段别名会被解析为数字,会被重写为,会在适用时自动填充。
fieldIdinternal_id%{field:<slug>}%{field:<internal_id>}referencedFieldIds8 — Handle responses
8 — 处理响应
- Success with → done.
agent_uuid - Partial failure (UUID returned, behaviors rejected) → call with the full required payload:
update_ai_agent,uuid(same pipe UUID used on create),repo_uuid,name, and completeinstruction(full-replace, not patch). Do NOT create a second agent.behaviors - Failure without UUID → validation or API error. Trust the hint text in the enriched error.
- 成功返回→ 操作完成。
agent_uuid - 部分失败(返回UUID,但行为被拒绝) → 调用并传入完整必填参数:
update_ai_agent、uuid(与创建时使用的管道UUID相同)、repo_uuid、name和完整的instruction(全量替换,非增量更新)。请勿创建第二个Agent。behaviors - 失败未返回UUID → 验证或API错误。请参考错误信息中的提示文本。
9 — Verify
9 — 确认
get_ai_agent(uuid)调用确认行为符合预期。
get_ai_agent(uuid)Knowledge bases (data sources)
知识库(数据源)
Knowledge bases are pipe-scoped data sources an agent draws on. Attach one by putting its ID in a behavior's (or the agent-level ). All knowledge base operations are scoped by the pipe UUID (), not the numeric pipe ID — returns the .
dataSourceIdsdata_source_idspipe_uuidget_pipeuuid| Tool (MCP) | CLI | Read-only | Purpose |
|---|---|---|---|
| | Yes | List every item on a pipe (plain texts, documents, data lookups); each has an |
| | Yes | Fetch one plain text with its content. |
| | No | Create a plain text ( |
| | No | Partial update; pass at least one of name/content/description. |
| | No | (Two-step destructive) MCP needs |
| | Yes | Fetch one document's metadata ( |
| | No | Upload a local PDF in one shot ( |
| | No | Metadata-only update (name/description); no file replacement. |
| | No | (Two-step destructive) MCP needs |
| | Yes | Fetch one data lookup; the payload never includes |
| | No | Create a data lookup ( |
| | No | Full replacement: resend |
| | No | (Two-step destructive) MCP needs |
| | Yes | Probe read access before writes. |
知识库是Agent可调用的管道级数据源。将知识库ID添加到行为的(或Agent级的)即可关联。所有知识库操作均以管道UUID()为范围,而非数字管道ID — 会返回。
dataSourceIdsdata_source_idspipe_uuidget_pipeuuid| 工具(MCP) | CLI 命令 | 只读 | 用途 |
|---|---|---|---|
| | 是 | 列出管道中的所有条目(纯文本、文档、数据查询);每个条目包含用于 |
| | 是 | 获取单个纯文本条目及其内容。 |
| | 否 | 创建纯文本条目( |
| | 否 | 增量更新;至少传入name/content/description中的一项。 |
| | 否 | (两步式破坏性操作) MCP需要 |
| | 是 | 获取单个文档的元数据( |
| | 否 | 一次性上传本地PDF文件( |
| | 否 | 仅更新元数据(名称/描述);不支持替换文件。 |
| | 否 | (两步式破坏性操作) MCP需要 |
| | 是 | 获取单个数据查询条目;返回的 payload 从不包含 |
| | 否 | 创建数据查询条目( |
| | 否 | 全量替换:每次调用必须重新传入 |
| | 否 | (两步式破坏性操作) MCP需要 |
| | 是 | 在写入前探测访问权限。 |
Flow: validate-access → create plain text → attach
流程:验证权限 → 创建纯文本 → 关联
- Probe access — (CLI:
validate_knowledge_base_access(pipe_uuid)). A green result proves read access only (pipefy kb validate-access), never theread_ai_agentsentitlement writes need. The CLI create/update commands gate on this automatically; MCP callers should probe first (create/update do not auto-probe).manage_ai_agents - Create the source — . Limits fail fast client-side:
create_ai_knowledge_base_plain_text(pipe_uuid, name, content, description)1-3500 chars,content1-900 chars (both required). Keep the returneddescription.id - Attach — add that to a behavior's
id(or the agent-leveldataSourceIds) when callingdata_source_ids/create_ai_agent. Validate first withupdate_ai_agent— unknown IDs surface as warnings.validate_ai_agent_behaviors(pipe_id, behaviors, data_source_ids=[...])
For a PDF document instead of plain text, use (CLI: ) at step 2. It uploads the local PDF in one shot; and the 20 MiB cap are enforced client-side, and indexing is asynchronous (the document may not be searchable immediately). The rest of the flow is identical — keep the returned and attach it.
create_ai_knowledge_base_document(pipe_uuid, name, description, file_path)pipefy kb document create --file ….pdfid- 探测权限 — 调用(CLI:
validate_knowledge_base_access(pipe_uuid))。验证通过仅证明具备读取权限(pipefy kb validate-access),不代表具备写入所需的read_ai_agents权限。CLI的创建/更新命令会自动进行此检查;MCP调用者应提前探测(创建/更新不会自动探测)。manage_ai_agents - 创建数据源 — 调用。客户端会快速校验限制:
create_ai_knowledge_base_plain_text(pipe_uuid, name, content, description)长度1-3500字符,content长度1-900字符(均为必填项)。保存返回的description。id - 关联 — 在调用/
create_ai_agent时,将该update_ai_agent添加到行为的id(或Agent级的dataSourceIds)。建议先通过data_source_ids验证 — 未知ID会显示警告。validate_ai_agent_behaviors(pipe_id, behaviors, data_source_ids=[...])
若要使用PDF文档而非纯文本,请在步骤2调用(CLI:)。该命令会一次性上传本地PDF文件;客户端会强制校验格式和20 MiB大小限制,索引为异步操作(文档可能无法立即被搜索)。其余流程完全相同 — 保存返回的并关联即可。
create_ai_knowledge_base_document(pipe_uuid, name, description, file_path)pipefy kb document create --file ….pdfidData lookups: create with an AI-filled condition → attach → update (full replacement)
数据查询:创建带AI填充条件的查询 → 关联 → 更新(全量替换)
A data lookup lets the agent search cards in a source pipe by conditions and return selected field values. Same flow as above at step 2, with three rules of its own:
-
Create —(CLI:
create_ai_knowledge_base_data_lookup(pipe_uuid, name, description, source_repo_id, output_fields, conditions)).pipefy kb data-lookup create --source-repo-id … --output-fields '[…]' --conditions '[…]'is the numeric ID of the source pipe (a UUID is accepted by the API but the lookup then breaks when the agent runs it).source_repo_idtakes 1-30 field IDs (field slugs plus static fields likeoutput_fields,id,title). Each condition needscreated_at+field(opaque backend string, e.g.operator,"eq") and is either static (string"contains"required) or AI-filled — the AI asks the user for the value at runtime:valuejson[{"field": "customer_email", "operator": "eq", "usingFillWithAi": true, "inputName": "Customer email", "inputType": "text", "inputDescription": "The customer's email address"}] -
Attach — keep the returnedand add it to
id, exactly as for the other kinds. Also keep the definition you sent: reads never returndataSourceIds, so your copy is the only complete record of the lookup.conditions -
Update replaces everything —requires
update_ai_knowledge_base_data_lookup,source_repo_id, andoutput_fieldson every call (the complete condition set, not a delta), and omittingconditionsclears it. Onlysearch_query/namekeep their stored values when omitted.description
数据查询允许Agent按条件搜索源管道中的卡片并返回指定字段的值。步骤2的流程与上述相同,但需遵循以下三条规则:
-
创建 — 调用(CLI:
create_ai_knowledge_base_data_lookup(pipe_uuid, name, description, source_repo_id, output_fields, conditions))。pipefy kb data-lookup create --source-repo-id … --output-fields '[…]' --conditions '[…]'为源管道的数字ID(API接受UUID,但Agent运行时查询会失败)。source_repo_id接受1-30个字段ID(字段别名以及output_fields、id、title等静态字段)。每个条件需要created_at+field(后端内部字符串,例如operator、"eq"),且为静态(需要字符串"contains")或AI填充 — AI会在运行时向用户请求值:valuejson[{"field": "customer_email", "operator": "eq", "usingFillWithAi": true, "inputName": "客户邮箱", "inputType": "text", "inputDescription": "客户的邮箱地址"}] -
关联 — 保存返回的并添加到
id,与其他类型的数据源完全相同。同时保存您发送的定义:读取操作从不返回dataSourceIds,因此您的副本是查询的唯一完整记录。conditions -
更新会替换所有内容 —每次调用都需要传入
update_ai_knowledge_base_data_lookup、source_repo_id和output_fields(完整的条件集合,而非增量);省略conditions会清除该值;仅search_query/name在省略时会保留存储的值。description
Token normalization & slug resolution
令牌规范化与字段别名解析
Instructions accept five token aliases — all normalize to canonical :
%{field:<internal_id>}| Form | Behavior |
|---|---|
| Canonical short form. |
| Bare; auto-prefixed with |
| Bare-with-prefix; auto- |
| Bare slug; resolved to numeric when behavior action carries |
| Canonical full form. |
%{field:<slug>}%{field:<internal_id>}pipeId提示词支持五种令牌别名 — 均会规范化为标准格式:
%{field:<internal_id>}| 格式 | 行为 |
|---|---|
| 标准短格式。 |
| 无前缀;会自动添加 |
| 带前缀但无 |
| 字段别名;当行为操作包含 |
| 标准完整格式。 |
当行为操作提供时,会被重写为。若Pipefy UI在令牌插槽中显示纯文本而非芯片,可能是payload中仍包含非标准令牌。
pipeId%{field:<slug>}%{field:<internal_id>}Template params / placeholders
模板参数 / 占位符
Per behavior you can pass (or ) with values and use in any string (instruction, metadata IDs, etc.). Optionally set instead of — the tool interpolates and writes the final instruction before the API call. These keys are stripped before validation.
template_paramsplaceholdersstr → str{{name}}instruction_templateaiBehaviorParams.instructionjson
{
"name": "Classify card",
"event_id": "card_created",
"instruction_template": "Read {{field_ref}} and classify the card.",
"template_params": { "field_ref": "%{field:900000101}" },
"actionParams": {
"aiBehaviorParams": {
"actionsAttributes": [
{
"name": "Fill classification",
"actionType": "update_card",
"metadata": { "pipeId": "{{pipe}}", "fieldsAttributes": [{ "fieldId": "{{class_field}}", "inputMode": "fill_with_ai", "value": "" }] }
}
]
}
},
"placeholders": { "pipe": "987654321", "class_field": "900000101" }
}template_paramsplaceholders您可为每个行为传递(或),包含的键值对,并在任意字符串(提示词、metadata ID等)中使用。也可选择设置替代 — 工具会在API调用前插值并写入最终提示词。这些键在验证前会被移除。
template_paramsplaceholdersstr → str{{name}}instruction_templateaiBehaviorParams.instructionjson
{
"name": "卡片分类",
"event_id": "card_created",
"instruction_template": "读取{{field_ref}}并对卡片进行分类。",
"template_params": { "field_ref": "%{field:900000101}" },
"actionParams": {
"aiBehaviorParams": {
"actionsAttributes": [
{
"name": "填充分类",
"actionType": "update_card",
"metadata": { "pipeId": "{{pipe}}", "fieldsAttributes": [{ "fieldId": "{{class_field}}", "inputMode": "fill_with_ai", "value": "" }] }
}
]
}
},
"placeholders": { "pipe": "987654321", "class_field": "900000101" }
}template_paramsplaceholdersplaceholdersNaming differences (UI vs API)
命名差异(UI vs API)
| Pipefy UI | API / Tool field |
|---|---|
| Description (agent creation step 1) | |
| Instruction / Prompt (per behavior) | |
| Pipe UUID | |
| Pipefy UI | API / 工具字段 |
|---|---|
| 描述(Agent创建步骤1) | |
| 指令 / 提示词(每个行为) | |
| 管道UUID | |
Success criteria
成功标准
- returns the agent with
get_ai_agent.status: active - reports no errors before creation.
validate_ai_agent_behaviors - Agent appears in the Pipefy UI under the pipe's AI settings.
- 返回的Agent状态为
get_ai_agent。status: active - 创建前未报告错误。
validate_ai_agent_behaviors - Agent出现在Pipefy UI的管道AI设置中。
Failure modes
失败场景
- is full-replace, not patch. Fetch existing behaviors with
update_ai_agentfirst, merge, then update — otherwise existing behaviors are silently dropped.get_ai_agent - Behavior save is all-or-nothing (). One invalid behavior rejects the entire list. The MCP tool auto-validates the payload on failure; if structurally correct, the error indicates a pipe-level restriction (not your payload). Inform the user this pipe does not support AI agent behaviors and suggest alternatives.
RECORD_NOT_SAVED - Partial-failure recovery. If returns a UUID but reports failure, call
create_ai_agent— all five are required. Reuse the createupdate_ai_agent(uuid, repo_uuid, name, instruction, behaviors); send the full behaviors list. Do NOT create a second agent.repo_uuid - Cross-pipe . Behaviors with
PERMISSION_DENIEDor cross-pipecreate_connected_cardrequire the service account to be a member of both source and destination pipes. When it is not, the API returns a barecreate_card. Recovery:PERMISSION_DENIED+get_pipe_memberson the destination pipe.invite_members - Phase transition rule on . Destination must be reachable from the source phase (
move_card). Bothcards_can_be_moved_to_phasesandvalidate_ai_agent_behaviors/create_ai_agentenrich this error withupdate_ai_agentand a hint that transition rules are editable in the Pipefy UI only.valid_destinations - Maximum 5 behaviors per agent. Adding a 6th rejects the whole save.
- Ghost agents. An agent listed by may return "Agent not found" on
get_ai_agents— a Pipefy backend artifact, persists across sessions, do not retry.get_ai_agent - GraphQL error hints. When a dedicated read tool returns permission-denied or not-found, the may cite concrete tools (e.g.
error.message). Trust the hint; don't improvise alternative flows."Use 'get_ai_agents' to list agents..." - Validation rejections. Common issues: invalid , prompt too long, missing required action config. Read the
trigger_eventfield per behavior.errors - first call returns preview. Expected — show preview to user, then call with
delete_ai_agent.confirm=true
- 是全量替换,非增量更新。 请先通过
update_ai_agent获取现有行为,合并后再更新 — 否则现有行为会被静默删除。get_ai_agent - 行为保存是全有或全无()。 一个无效行为会导致整个列表被拒绝。MCP工具会在失败时自动验证payload;若结构正确,错误表明存在管道级限制(与您的payload无关)。请告知用户该管道不支持AI Agent行为并建议替代方案。
RECORD_NOT_SAVED - 部分失败恢复。 若返回UUID但报告失败,请调用
create_ai_agent— 必须包含全部五个参数。复用创建时的update_ai_agent(uuid, repo_uuid, name, instruction, behaviors);发送完整的行为列表。请勿创建第二个Agent。repo_uuid - 跨管道。 包含
PERMISSION_DENIED或跨管道create_connected_card的行为要求服务账号同时是源管道和目标管道的成员。若不符合,API会返回create_card。恢复方法:调用PERMISSION_DENIED+ 在目标管道调用get_pipe_members。invite_members - 的阶段转换规则。 目标阶段必须可从源阶段到达(
move_card)。cards_can_be_moved_to_phases和validate_ai_agent_behaviors/create_ai_agent会在错误中添加update_ai_agent和提示,说明转换规则仅可在Pipefy UI中编辑。valid_destinations - 每个Agent最多5种行为。 添加第6种行为会导致整个保存操作被拒绝。
- 幽灵Agent。 列出的Agent在调用
get_ai_agents时可能返回"Agent not found" — 这是Pipefy后端的异常现象,会跨会话存在,请不要重试。get_ai_agent - GraphQL错误提示。 当专用读取工具返回权限拒绝或未找到时,可能会引用具体工具(例如
error.message)。请信任提示;不要尝试替代流程。"Use 'get_ai_agents' to list agents..." - 验证拒绝。 常见问题:无效的、提示词过长、缺少必填的操作配置。请查看每个行为的
trigger_event字段。errors - 首次调用返回预览。 这是预期行为 — 向用户展示预览,然后调用时传入
delete_ai_agent。confirm=true
See also
另请参阅
- skills/automations/pipefy-automations/SKILL.md — traditional automations and AI automations (different from AI agents).
- skills/observability/pipefy-observability/SKILL.md — agent execution logs and credit usage.
- skills/introspection/pipefy-introspection/SKILL.md — Recipe 2 inspects full behavior config via .
execute_graphql - — canonical map of which tool/argument expects slug vs
docs/mcp/tools/identifiers.md#ai-agents-and-knowledge-basesvs uuid vs numeric id (AI agents scope byinternal_id= pipe UUID).repo_uuid
- skills/automations/pipefy-automations/SKILL.md — 传统自动化和AI自动化(与AI Agent不同)。
- skills/observability/pipefy-observability/SKILL.md — Agent执行日志和额度使用情况。
- skills/introspection/pipefy-introspection/SKILL.md — 方案2通过检查完整行为配置。
execute_graphql - — 规范映射,说明哪些工具/参数需要字段别名、
docs/mcp/tools/identifiers.md#ai-agents-and-knowledge-bases、uuid或数字ID(AI Agent以internal_id= 管道UUID为范围)。repo_uuid