AI Agent Tool
Use Formfex as a LangChain-compatible tool inside n8n AI Agent workflows
Overview
The Formfex node supports n8n's AI Agent Tool Mode, allowing an AI agent to autonomously interact with your Formfex account. The agent can create forms, read responses, generate forms with AI, and analyze data — all through natural conversation.
This is powered by n8n's LangChain integration. The Formfex node exposes 5 tools that the AI agent can invoke based on user requests.
Setup
Add an AI Agent node
Search for AI Agent in the n8n node panel and add it to your workflow.
Connect Formfex as a tool
Add the Formfex node and connect it to the AI Agent's Tools input. In the Formfex node settings, enable Use as Tool.
Configure credentials
Select your Formfex API credential on the Formfex tool node.
Add an AI model
Connect an AI model (e.g. OpenAI GPT-4, Anthropic Claude) to the AI Agent's Model input.
Available Tools
When connected to an AI Agent, the Formfex node exposes these 5 tools:
create_form
Creates a new blank form in Formfex.
| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Form title (max 200 characters) |
description | string | No | Optional form description (max 500 characters) |
language | enum | No | en, tr, es, it, de, nl. Default: en |
Returns: Form ID and edit URL.
get_responses
Retrieves submitted responses from a form.
| Parameter | Type | Required | Description |
|---|---|---|---|
form_id | string (UUID) | Yes | The form to retrieve responses from |
limit | number | No | Max responses to return (1–100). Default: 20 |
since | string | No | ISO 8601 timestamp — only return responses after this time |
Returns: Formatted text summary of responses suitable for AI analysis.
generate_form_with_ai
Generates a complete form using AI from a natural language prompt. Handles the async job lifecycle automatically (dispatch + polling).
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Describe the form to generate (max 400 characters) |
language | enum | No | Language for generated labels. Default: en |
Returns: Form ID and edit URL after generation completes.
analyze_form_data
Conversational Q&A about form response data. Supports multi-turn conversations.
| Parameter | Type | Required | Description |
|---|---|---|---|
form_id | string (UUID) | Yes | The form to analyze |
question | string | Yes | Your question about the form data (max 500 characters) |
session_id | string (UUID) | No | Session ID from a previous call to continue the conversation |
Returns: AI-generated answer, session ID for follow-ups, and credits used.
Session management
The tool always returns a sessionId. The AI agent should pass this back in subsequent calls to maintain conversation context and avoid creating unnecessary server-side sessions.
dispatch_smart_analytics
Dispatches a comprehensive AI analytics report. Results are delivered asynchronously via callback.
| Parameter | Type | Required | Description |
|---|---|---|---|
form_id | string (UUID) | Yes | The form to analyze |
callback_url | string (HTTPS) | Yes | URL where the report will be delivered |
Returns: Job ID and report ID. Results are sent to the callback URL when ready.
Example Conversation
User: "Create a customer satisfaction survey in English"
Agent: [calls create_form] → "Done! Form created with ID abc123."
User: "Actually, generate it with AI instead — include ratings and feedback fields"
Agent: [calls generate_form_with_ai] → "Form generated! It has 8 fields including
a 5-star rating and open feedback. Edit: https://app.formfex.com/forms/xyz789"
User: "How many responses did my Employee Feedback form get last week?"
Agent: [calls get_responses with since filter] → "Your form received 47 responses
in the last 7 days."
User: "What's the average satisfaction score?"
Agent: [calls analyze_form_data] → "The average satisfaction score across 47
responses is 4.2 out of 5. The most common rating is 5 (38% of responses)."
User: "Show me the trend over time"
Agent: [calls analyze_form_data with session_id] → "Satisfaction has been stable
around 4.1-4.3 over the past month, with a slight uptick this week."
Plan Requirements
| Tool | Minimum Plan | Credits |
|---|---|---|
create_form | Starter | 0 |
get_responses | Starter | 0 |
generate_form_with_ai | Starter | 1 per generation |
analyze_form_data | Pro | 1 per message |
dispatch_smart_analytics | Pro | 2+ per report |
Security
All tool parameters are validated to prevent prompt injection attacks:
- Form IDs are validated as UUIDs — rejects path traversal attempts
- URLs must use HTTPS — prevents HTTP downgrade and internal network access
- IDs are URL-encoded before being placed in API paths — defense-in-depth
- Callback URLs are never echoed back — prevents URL poisoning in the AI context
Prompt injection awareness
In Agent Tool Mode, the LLM populates tool arguments — not the human user. Malicious form response data could attempt to manipulate the agent's behavior. All parameters are validated server-side, and the backend enforces scope restrictions regardless of what the agent sends.