PipesGuides
Using AI nodes
Add AI classification, extraction, generation, and autonomous agents to your workflows
Pipes includes four AI node types that bring intelligence directly into your workflows. No external AI orchestration tools needed.
AI node types
| Node | Purpose | Output |
|---|---|---|
| Classify | Categorize input into labels | Label + confidence score |
| Extract | Pull structured data from text | Typed JSON object |
| Generate | Produce text content | String output |
| Agent | Autonomous reasoning with tools | Structured result |
Classify: route by intent
Automatically categorize messages and route them to the right handler:
const workflow = await npayload.pipes.create({
name: 'support-router',
trigger: { type: 'event', channel: 'support-tickets' },
});
// Classify the incoming ticket
workflow.addNode({
id: 'classify-ticket',
type: 'classify',
input: '{{ payload.message }}',
labels: ['billing', 'technical', 'account', 'feature-request', 'urgent'],
outputField: 'category',
});
// Route based on classification
workflow.addNode({
id: 'route',
type: 'switch',
field: '{{ nodes["classify-ticket"].output.category }}',
cases: {
'urgent': 'escalate',
'billing': 'billing-team',
'technical': 'tech-support',
'account': 'account-team',
'feature-request': 'product-backlog',
},
});Extract: pull structured data
Extract structured information from unstructured input:
workflow.addNode({
id: 'extract-order',
type: 'extract',
input: '{{ payload.emailBody }}',
schema: {
customerName: { type: 'string', description: 'Full name of the customer' },
orderNumber: { type: 'string', description: 'Order or reference number' },
issue: { type: 'string', description: 'Brief description of the issue' },
sentiment: { type: 'string', enum: ['positive', 'neutral', 'negative'] },
},
});
// Use extracted data in subsequent nodes
workflow.addNode({
id: 'lookup-order',
type: 'http',
url: 'https://api.store.com/orders/{{ nodes["extract-order"].output.orderNumber }}',
});Generate: create content
Generate text responses, summaries, or content:
workflow.addNode({
id: 'draft-response',
type: 'generate',
prompt: `
Draft a professional customer support reply.
Customer: {{ nodes["extract-order"].output.customerName }}
Issue: {{ nodes["extract-order"].output.issue }}
Order status: {{ nodes["lookup-order"].output.status }}
Be empathetic and provide a clear resolution.
`,
maxTokens: 500,
});
// Send the generated response
workflow.addNode({
id: 'send-reply',
type: 'http',
connector: 'my-sendgrid',
operation: 'sendEmail',
params: {
to: '{{ payload.customerEmail }}',
subject: 'Re: {{ payload.subject }}',
body: '{{ nodes["draft-response"].output }}',
},
});Agent: autonomous reasoning
Deploy an autonomous agent that reasons, uses tools, and decides what to do:
workflow.addNode({
id: 'support-agent',
type: 'agent',
model: 'claude-sonnet-4-20250514',
systemPrompt: `You are a customer support agent for an e-commerce platform.
You have access to tools to look up orders, check inventory, and issue refunds.
Always verify the order exists before taking any action.
Never issue refunds over $500 without escalating.`,
tools: ['lookup-order', 'check-inventory', 'issue-refund', 'create-ticket'],
input: {
message: '{{ payload.message }}',
customerEmail: '{{ payload.customerEmail }}',
context: '{{ nodes["extract-order"].output }}',
},
maxIterations: 10,
timeout: 30000, // 30 seconds
});Agent tools
Define tools the agent can use:
await npayload.pipes.tools.register({
workflow: workflow.id,
tools: [
{
name: 'lookup-order',
description: 'Look up an order by order number',
parameters: {
orderNumber: { type: 'string', required: true },
},
handler: {
type: 'http',
method: 'GET',
url: 'https://api.store.com/orders/{{ params.orderNumber }}',
},
},
{
name: 'issue-refund',
description: 'Issue a refund for an order',
parameters: {
orderNumber: { type: 'string', required: true },
amount: { type: 'number', required: true },
reason: { type: 'string', required: true },
},
handler: {
type: 'http',
method: 'POST',
url: 'https://api.store.com/refunds',
body: '{{ params }}',
},
},
],
});Chaining AI nodes
Combine multiple AI nodes for complex processing:
// Step 1: Extract entities from incoming data
workflow.addNode({
id: 'extract',
type: 'extract',
input: '{{ payload.content }}',
schema: {
entities: { type: 'array', items: { type: 'string' } },
topic: { type: 'string' },
language: { type: 'string' },
},
});
// Step 2: Classify the sentiment
workflow.addNode({
id: 'sentiment',
type: 'classify',
input: '{{ payload.content }}',
labels: ['positive', 'neutral', 'negative'],
});
// Step 3: Generate a summary combining both
workflow.addNode({
id: 'summarize',
type: 'generate',
prompt: `
Summarize this {{ nodes["extract"].output.topic }} content.
Entities mentioned: {{ nodes["extract"].output.entities.join(", ") }}
Overall sentiment: {{ nodes["sentiment"].output.category }}
Content: {{ payload.content }}
`,
});Next steps
- AI pipeline pattern for end-to-end AI processing workflows
- Node types for all available nodes
- Execution model for retry and failure handling
Was this page helpful?