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

1

Add an AI Agent node

Search for AI Agent in the n8n node panel and add it to your workflow.

2

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.

3

Configure credentials

Select your Formfex API credential on the Formfex tool node.

4

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.

ParameterTypeRequiredDescription
titlestringYesForm title (max 200 characters)
descriptionstringNoOptional form description (max 500 characters)
languageenumNoen, tr, es, it, de, nl. Default: en

Returns: Form ID and edit URL.


get_responses

Retrieves submitted responses from a form.

ParameterTypeRequiredDescription
form_idstring (UUID)YesThe form to retrieve responses from
limitnumberNoMax responses to return (1–100). Default: 20
sincestringNoISO 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).

ParameterTypeRequiredDescription
promptstringYesDescribe the form to generate (max 400 characters)
languageenumNoLanguage 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.

ParameterTypeRequiredDescription
form_idstring (UUID)YesThe form to analyze
questionstringYesYour question about the form data (max 500 characters)
session_idstring (UUID)NoSession 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.

ParameterTypeRequiredDescription
form_idstring (UUID)YesThe form to analyze
callback_urlstring (HTTPS)YesURL 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

ToolMinimum PlanCredits
create_formStarter0
get_responsesStarter0
generate_form_with_aiStarter1 per generation
analyze_form_dataPro1 per message
dispatch_smart_analyticsPro2+ 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.