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.
Tools
| Tool (MCP) | CLI | Read-only | Purpose |
|---|
| | Yes | List AI agents for a pipe ( = pipe UUID, not numeric ). |
| | 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. ). |
validate_ai_agent_behaviors
| pipefy agent validate-behaviors
| Yes | Pre-flight check before create/update. |
The read tools (
,
,
validate_ai_agent_behaviors
) and the write tools (
/
/
/
) are all remote-safe: available under the hosted (
) surface.
Execution logs live in
skills/observability/ (
,
).
Creation workflow (discover → validate → create → verify)
Never guess event IDs, phase IDs, action types, or field IDs.
1 — Get pipe metadata
- → use as in all AI-agent tools.
- / → needed for actions.
- Fields via
get_start_form_fields(pipe_id)
and/or get_phase_fields(phase_id)
→ needed for actions.
2 — Check existing agents
to avoid duplicates. To modify an existing agent, use
(not create). For full config, use
.
3 — Discover valid trigger events
get_automation_events(pipe_id)
. Common events:
| Event ( value) | required | Example |
|---|
| card_created | None | |
| card_moved | {"to_phase_id":"<phase_id>"}
| Fires only when card enters that phase. |
| field_updated | {"triggerFieldIds":["<field_id>", ...]}
| 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.
4 — Discover valid action types
get_automation_actions(pipe_id)
. The 6 known
values and their required
:
| Action ( value) | required |
|---|
| update_card | + (each entry needs + ) |
| move_card | |
| create_card | + |
| create_connected_card | + (requires pipe relation) |
| create_table_record | + (table field IDs; no ) |
| send_email_template | ; optional allowTemplateModifications
(bool) |
values for card actions accept slug or numeric
; for
they are
table field IDs (validate with
/
, not the pipe).
5 — Build the behavior dict
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 .
- Maximum 5 behaviors per agent.
- The MCP tool auto-injects and placeholders — do NOT generate these yourself.
- is required on every entry (omitting it fails model validation). Values: (AI writes the value into an output field), (use the literal ), ( is a template copying another field).
- Input field references ( in the behavior , auto-populated into on create/update) are needed only when the AI must read card field values, not for every (e.g. instruction-only, OCR/attachment, or knowledge-base context). When card inputs are needed and omitted, arrives empty at trigger time and the model may hallucinate. A wrong numeric input id is accepted silently (validate and create/update) and becomes a dead ; a wrong slug never resolves and is dropped by the digits-only extractor (unresolved token). Either way stays empty (same hallucination); confirm the id with / . Dotted connected-pipe refs (
%{field:<parent>.<child>}
) are not forwarded at runtime; to read a connected card field, use a field on the current pipe.
- For : set when not moving the card.
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.
| Role | Example value |
|---|
| Pipe (numeric repo id) | |
| Field | |
| Destination phase () | |
| Target pipe () | |
Metadata examples
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 }
5b — Optional: capabilities and LLM provider
Inside
actionParams.aiBehaviorParams
a behavior may also carry:
-
— advanced tools the behavior can use. Each entry is exactly
{ "capabilityType": "<type>", "enabled": true|false }
(both keys required, no extra keys — bare strings or
are rejected).
| Product name | |
|---|
| IDP / Intelligent Document Processing | |
| Calculations & Analysis | |
| Web Search | |
| Web Scraping | |
| Max effort | |
is 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.
-
/
— pick the behavior's LLM provider. Set
at most one (a behavior resolves to a single active provider). Discover valid IDs with
(CLI:
): each provider carries
— use
for a custom (
) provider and
for a Pipefy-managed (
) one.
shows what a behavior falls back to when neither is set. IDs are also visible in the organization's AI settings in the Pipefy UI.
Bring your own model (custom provider). To back a behavior with your own vendor credentials, create a custom provider first, then use its
as
:
validate_llm_provider_access
(confirm read access — writes need the stronger
org permission and an eligible plan, so a write may still be denied) →
with the configuration in a
local JSON file (
; never inline — secrets are never logged or returned; the file's
key selects the vendor). Manage it with
(send the
full configuration; leave the
placeholders from
in place to keep existing secrets, or put a new value to rotate one),
set_llm_provider_active_status
, and
(check
get_llm_provider_dependencies
first). Set the organization default with
(exactly one of
/
) or clear it with
reset_default_llm_provider
. CLI:
pipefy ai-provider create
/
/
/
/
/
.
-
— knowledge base sources the behavior can draw on. Each ID is a knowledge base item ID from
(CLI:
). Agents also carry an agent-level
; the two are unioned. See
Knowledge bases below for the create → attach flow.
json
{
"instruction": "Extract totals from the attached invoice.",
"capabilitiesAttributes": [{ "capabilityType": "advanced_ocr", "enabled": true }],
"actionsAttributes": [ /* ... */ ]
}
6 — Validate (recommended for complex behaviors)
validate_ai_agent_behaviors(pipe_id, behaviors)
checks:
- Output field IDs (
fieldsAttributes[].fieldId
) exist in the pipe
- Phase IDs exist
- Pipe relations exist for
- Action types are valid (the 6 in ; are table field IDs, so they are not checked against the pipe and surface a warning to verify with ; metadata runs no pipe field-ID checks)
- Behavior structure passes Pydantic validation (including canonical shape and at most one of / )
fieldsAttributes[].fieldId
values (outputs) are checked against start-form and phase fields, accepting both slug and numeric . Instruction tokens (inputs) are not existence-checked: a missing id/slug still yields . Slug → numeric rewrite happens only on create/update, not here.
- Pass (agent-level) to also check knowledge base membership: it is unioned with each behavior's and checked against the pipe's knowledge bases. Unknown IDs are warnings only ( stays true); if the knowledge base list cannot be read, a single warning is added and the check is skipped.
strict_unknown_action_types
(default
): an
outside the known 6 is reported in
(blocking). Set
to demote unknown action types to
only, so
stays true. CLI:
(default) /
on
,
, and
.
7 — Create the agent
with
,
,
, and
. One-call creation is preferred — avoids partial agent shells. Agents are
active by default.
The
CLI /
require
(numeric pipe id) and run
validate_ai_agent_behaviors
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
validate_ai_agent_behaviors
yourself (step 6) before
/
. CLI flags:
,
,
,
(JSON array),
(JSON array);
instead takes
(repeatable).
On create/update, slug
values are resolved to numeric
,
is rewritten to
, and
is auto-populated when applicable.
8 — Handle responses
- Success with → done.
- Partial failure (UUID returned, behaviors rejected) → call with the full required payload: , (same pipe UUID used on create), , , and complete (full-replace, not patch). Do NOT create a second agent.
- Failure without UUID → validation or API error. Trust the hint text in the enriched error.
9 — Verify
to confirm behaviors match expectations.
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
.
| Tool (MCP) | CLI | Read-only | Purpose |
|---|
| | Yes | List every item on a pipe (plain texts, documents, data lookups); each has an for and a (knowledge_base_plain_texts
, , or ). |
get_ai_knowledge_base_plain_text
| | Yes | Fetch one plain text with its content. |
create_ai_knowledge_base_plain_text
| pipefy kb plain-text create
| No | Create a plain text (, 1-3500, 1-900 — all required). |
update_ai_knowledge_base_plain_text
| pipefy kb plain-text update
| No | Partial update; pass at least one of name/content/description. |
delete_ai_knowledge_base_plain_text
| pipefy kb plain-text delete
| No | (Two-step destructive) MCP needs ; CLI needs . |
get_ai_knowledge_base_document
| | Yes | Fetch one document's metadata ( is the stored URL, not text). |
create_ai_knowledge_base_document
| pipefy kb document create
| No | Upload a local PDF in one shot (/, , 1-900). + 20 MiB cap client-side; indexing is async. |
update_ai_knowledge_base_document
| pipefy kb document update
| No | Metadata-only update (name/description); no file replacement. |
delete_ai_knowledge_base_document
| pipefy kb document delete
| No | (Two-step destructive) MCP needs ; CLI needs . |
get_ai_knowledge_base_data_lookup
| pipefy kb data-lookup get
| Yes | Fetch one data lookup; the payload never includes — keep the definition client-side. |
create_ai_knowledge_base_data_lookup
| pipefy kb data-lookup create
| No | Create a data lookup (, 1-900, numeric pipe ID, 1-30, — all required). |
update_ai_knowledge_base_data_lookup
| pipefy kb data-lookup update
| No | Full replacement: resend // every call; omitted clears it; only name/description are partial. |
delete_ai_knowledge_base_data_lookup
| pipefy kb data-lookup delete
| No | (Two-step destructive) MCP needs ; CLI needs . |
validate_knowledge_base_access
| pipefy kb validate-access
| Yes | Probe read access before writes. |
Flow: validate-access → create plain text → attach
- Probe access —
validate_knowledge_base_access(pipe_uuid)
(CLI: pipefy kb validate-access
). A green result proves read access only (), never the entitlement writes need. The CLI create/update commands gate on this automatically; MCP callers should probe first (create/update do not auto-probe).
- Create the source —
create_ai_knowledge_base_plain_text(pipe_uuid, name, content, description)
. Limits fail fast client-side: 1-3500 chars, 1-900 chars (both required). Keep the returned .
- Attach — add that to a behavior's (or the agent-level ) when calling / . Validate first with
validate_ai_agent_behaviors(pipe_id, behaviors, data_source_ids=[...])
— unknown IDs surface as warnings.
For a
PDF document instead of plain text, use
create_ai_knowledge_base_document(pipe_uuid, name, description, file_path)
(CLI:
pipefy kb document create --file …
) 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.
Data lookups: create with an AI-filled condition → attach → update (full replacement)
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 —
create_ai_knowledge_base_data_lookup(pipe_uuid, name, description, source_repo_id, output_fields, conditions)
(CLI:
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).
takes 1-30 field IDs (field slugs plus static fields like
,
,
). Each condition needs
+
(opaque backend string, e.g.
,
) and is either
static (string
required) or
AI-filled — the AI asks the user for the value at runtime:
json
[{"field": "customer_email", "operator": "eq", "usingFillWithAi": true,
"inputName": "Customer email", "inputType": "text",
"inputDescription": "The customer's email address"}]
-
Attach — keep the returned
and add it to
, exactly as for the other kinds.
Also keep the definition you sent: reads never return
, so your copy is the only complete record of the lookup.
-
Update replaces everything —
update_ai_knowledge_base_data_lookup
requires
,
, and
on every call (the complete condition set, not a delta), and omitting
clears it. Only
/
keep their stored values when omitted.
Token normalization & slug resolution
Instructions accept five token aliases — all normalize to canonical
:
| 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. |
is rewritten to
when an action in the behavior supplies
. If the Pipefy UI shows plain text instead of chips in token slots, the payload probably still has non-canonical tokens.
Template params / placeholders
Per behavior you can pass
(or
) with
values and use
in any string (instruction, metadata IDs, etc.). Optionally set
instead of
aiBehaviorParams.instruction
— the tool interpolates and writes the final instruction before the API call. These keys are stripped before validation.
json
{
"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" }
}
and
merge (placeholders wins on conflict).
Naming differences (UI vs API)
| Pipefy UI | API / Tool field |
|---|
| Description (agent creation step 1) | (agent-level) |
| Instruction / Prompt (per behavior) | actionParams.aiBehaviorParams.instruction
|
| Pipe UUID | (from , NOT the numeric ) |
Success criteria
- returns the agent with .
validate_ai_agent_behaviors
reports no errors before creation.
- Agent appears in the Pipefy UI under the pipe's AI settings.
Failure modes
- is full-replace, not patch. Fetch existing behaviors with first, merge, then update — otherwise existing behaviors are silently dropped.
- 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.
- Partial-failure recovery. If returns a UUID but reports failure, call
update_ai_agent(uuid, repo_uuid, name, instruction, behaviors)
— all five are required. Reuse the create ; send the full behaviors list. Do NOT create a second agent.
- Cross-pipe . Behaviors with or cross-pipe require the service account to be a member of both source and destination pipes. When it is not, the API returns a bare . Recovery: + on the destination pipe.
- Phase transition rule on . Destination must be reachable from the source phase (
cards_can_be_moved_to_phases
). Both validate_ai_agent_behaviors
and / enrich this error with and a hint that transition rules are editable in the Pipefy UI only.
- Maximum 5 behaviors per agent. Adding a 6th rejects the whole save.
- Ghost agents. An agent listed by may return "Agent not found" on — a Pipefy backend artifact, persists across sessions, do not retry.
- GraphQL error hints. When a dedicated read tool returns permission-denied or not-found, the may cite concrete tools (e.g.
"Use 'get_ai_agents' to list agents..."
). Trust the hint; don't improvise alternative flows.
- Validation rejections. Common issues: invalid , prompt too long, missing required action config. Read the field per behavior.
- first call returns preview. Expected — show preview to user, then call with .
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 .
docs/mcp/tools/identifiers.md#ai-agents-and-knowledge-bases
— canonical map of which tool/argument expects slug vs vs uuid vs numeric id (AI agents scope by = pipe UUID).