Skip to main content
n8n integration enables bidirectional workflow automation, connecting PraisonAI agents to n8n’s 400+ integrations including Slack, Gmail, Notion, databases, and APIs.

Quick Start

1

Install n8n Tools

pip install "praisonai-tools[n8n]"
2

Set Up n8n Instance

# Start n8n locally
docker run -it --rm --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n

# Set environment variables
export N8N_URL="http://localhost:5678"
export N8N_API_KEY="your-api-key"  # Optional for local
3

Use in Agent

from praisonaiagents import Agent
from praisonai_tools.n8n import n8n_workflow

agent = Agent(
    name="automation-agent",
    instructions="Execute n8n workflows for automation tasks",
    tools=[n8n_workflow]
)

agent.start("Send a Slack message to #general saying Hello!")

How It Works

ComponentPurposeDirection
PraisonAI → n8nAgents execute workflows via toolsAgent calls n8n
n8n → PraisonAIWorkflows invoke agents via APIn8n calls Agent
Visual EditorPreview YAML workflows in n8n UIExport/Import

Integration Directions

Agents → n8n Workflows

Agents execute n8n workflows to access 400+ integrations

n8n → Agent API

n8n workflows invoke PraisonAI agents via HTTP endpoints

Visual Workflow Editor

Export PraisonAI YAML workflows to n8n for visual editing

CLI Export Tools

Command-line tools for n8n workflow export and management

Common Patterns

from praisonaiagents import Agent
from praisonai_tools.n8n import n8n_workflow

notification_agent = Agent(
    name="notifier",
    instructions="Send notifications via various channels",
    tools=[n8n_workflow]
)

# Slack notification
notification_agent.start("Send deployment status to #deployments channel")

# Email notification  
notification_agent.start("Email the marketing team about campaign results")

Available Integrations

n8n provides 400+ integrations across multiple categories:
  • Chat: Slack, Discord, Microsoft Teams, Telegram, WhatsApp
  • Email: Gmail, Outlook, SendGrid, Mailchimp
  • Video: Zoom, Google Meet, Microsoft Teams
  • Documents: Notion, Google Docs, Microsoft Office, Confluence
  • Spreadsheets: Google Sheets, Excel, Airtable
  • Task Management: Trello, Jira, Linear, Asana, Monday.com
  • SQL Databases: PostgreSQL, MySQL, SQL Server, Oracle
  • NoSQL: MongoDB, Redis, Elasticsearch, DynamoDB
  • Cloud Storage: Google Drive, Dropbox, AWS S3, Azure Blob
  • REST APIs: HTTP Request node, GraphQL
  • Webhooks: Trigger and receive webhooks
  • Git: GitHub, GitLab, Bitbucket integration

Best Practices

Always handle workflow errors gracefully in your agent instructions:
agent = Agent(
    name="robust-agent",
    instructions="""
    When executing n8n workflows:
    1. Check the result for errors
    2. Retry with different parameters if needed
    3. Provide clear feedback to the user
    4. Log important details for debugging
    """,
    tools=[n8n_workflow]
)
Use environment variables for configuration:
# Production setup
export N8N_URL="https://n8n.yourcompany.com"
export N8N_API_KEY="your-production-api-key"

# Development setup  
export N8N_URL="http://localhost:5678"
# API key optional for local development
Create focused, single-purpose workflows in n8n:
  • Good: slack-notify, email-send, database-insert
  • Avoid: do-everything-workflow
This makes workflows more reliable and easier to debug.
Never expose sensitive data in workflow inputs:
# Good - use environment variables in n8n
result = n8n_workflow(
    workflow_id="secure-api-call",
    input_data={"endpoint": "https://api.example.com/data"}
)

# Avoid - don't pass API keys directly
# input_data={"api_key": "secret-key"}  # DON'T DO THIS

n8n Tools Reference

Complete API reference for n8n workflow tools

n8n API Integration

HTTP endpoints for n8n to invoke PraisonAI agents

Visual Workflow Editor

Export and edit PraisonAI workflows in n8n UI

CLI n8n Commands

Command-line tools for n8n workflow management