Skip to main content
The n8n API integration enables n8n workflows to invoke PraisonAI agents via HTTP endpoints, allowing bidirectional automation between the platforms. The user triggers an n8n workflow; HTTP nodes call PraisonAI agents and return structured responses.

How It Works

Quick Start

1

Start PraisonAI API Server

2

Configure n8n HTTP Request Node

3

Test the Integration


API Endpoints

POST /api/v1/agents//invoke

Invoke a specific PraisonAI agent with input data. URL Parameters: Request Body:
Required Fields: Optional Fields: Response:
Error Response:

GET /api/v1/agents

List all available agents. Response:

GET /api/v1/health

Check API server health status. Response:

n8n HTTP Request Configuration

Basic Configuration

Advanced Configuration

Use this pattern when you want to dynamically select which agent to call based on input data.
Configure timeouts and retry logic for resilient workflows.
Control how n8n handles the API response data.

Authentication

Token-Based Authentication

Set up authentication for secure API access:

API Key Management

Implement token rotation for enhanced security:
Use different tokens for different environments:

Workflow Examples

Sequential Agent Workflow

Create a research → write → publish workflow:
  1. Webhook Trigger: Receives initial request
  2. Researcher HTTP Node: Calls /agents/researcher/invoke
  3. Writer HTTP Node: Calls /agents/writer/invoke with research data
  4. Publisher HTTP Node: Calls /agents/publisher/invoke with content
  5. Response Node: Returns final result

Conditional Routing Workflow

Route content to different agents based on type:
Implement fallback logic for failed agent calls:

Best Practices

Implement robust error handling in n8n workflows:
Validate data before sending to agents:
Optimize API calls for better performance:
  • Batch Requests: Group multiple agent calls when possible
  • Parallel Execution: Use fan-out patterns for independent calls
  • Caching: Store frequently used results in Set nodes
  • Connection Pooling: Configure HTTP node connection limits
  • Timeouts: Set appropriate timeouts based on agent complexity
Secure your API integration:
  • Authentication: Always use CALL_SERVER_TOKEN in production
  • HTTPS: Use encrypted connections for remote APIs
  • Input Sanitization: Validate and sanitize user inputs
  • Rate Limiting: Implement rate limiting on the PraisonAI server
  • Logging: Enable request logging for audit trails

Troubleshooting

Common Issues

Debugging Steps

  1. Check Server Status: Verify PraisonAI API is running
  2. Test Endpoints: Use curl to test API endpoints directly
  3. Validate Credentials: Confirm authentication tokens are correct
  4. Review Logs: Check both n8n and PraisonAI logs for errors
  5. Network Connectivity: Ensure n8n can reach PraisonAI server

n8n Integration Overview

Complete guide to n8n integration architecture and setup

n8n Tools Reference

PraisonAI tools for executing n8n workflows from agents

Visual Workflow Editor

Export and edit PraisonAI workflows in n8n’s visual interface

CLI n8n Commands

Command-line tools for n8n workflow management