Skip to main content
Arcanflows

Agent Integration

Connect forms to AI agents for intelligent processing and conversational experiences.

Overview

Integrate AI agents with your forms to automatically process submissions, provide intelligent responses, and create conversational form experiences.

Integration Modes

Post-Submit Processing

Agent processes data after form submission:

User fills form → Submit → AI Agent processes → Response/Action

Conversational Form

Agent guides user through form completion via chat:

AI asks question → User responds → AI validates → Next question → Complete

AI-Assisted Form

Traditional form with AI helper sidebar:

Form fields displayed + AI chat assistant for help

Post-Submit Configuration

Basic Setup

json
{
  "agentIntegration": {
    "enabled": true,
    "mode": "post_submit",
    "agentId": "agent_abc123",
    "processFields": ["message", "feedback"]
  }
}

Message Template

json
{
  "agentIntegration": {
    "mode": "post_submit",
    "agentId": "support_classifier",
    "messageTemplate": "Classify this support request:\n\nName: {{name}}\nEmail: {{email}}\nSubject: {{subject}}\nMessage: {{message}}\n\nRespond with JSON containing: category, priority, suggested_response"
  }
}

Response Format

json
{
  "agentIntegration": {
    "responseFormat": {
      "type": "json",
      "schema": {
        "category": "string",
        "priority": "string",
        "sentiment": "string",
        "suggested_response": "string"
      }
    }
  }
}

Post-Processing Actions

json
{
  "agentIntegration": {
    "postProcess": {
      "updateSubmission": {
        "ai_category": "{{response.category}}",
        "ai_priority": "{{response.priority}}"
      },
      "sendNotification": {
        "condition": "{{response.priority}} === 'urgent'",
        "channel": "slack",
        "message": "Urgent submission from {{name}}: {{response.summary}}"
      },
      "triggerWorkflow": {
        "workflowId": "process_submission",
        "condition": "{{response.category}} === 'sales'"
      }
    }
  }
}

Conversational Forms

Configuration

json
{
  "agentIntegration": {
    "mode": "conversational",
    "agentId": "intake_agent",
    "conversation": {
      "greeting": "Hi! I'll help you get started. What's your name?",
      "style": "friendly",
      "validateResponses": true
    }
  }
}

Field Collection

json
{
  "conversation": {
    "fields": [
      {
        "name": "fullName",
        "prompt": "What's your name?",
        "validation": "required",
        "errorPrompt": "I didn't catch that. Could you tell me your name?"
      },
      {
        "name": "email",
        "prompt": "Great to meet you, {{fullName}}! What's your email?",
        "validation": "email",
        "errorPrompt": "That doesn't look like a valid email. Can you try again?"
      },
      {
        "name": "company",
        "prompt": "What company are you with?",
        "validation": "optional",
        "skipPrompt": "No problem, we can skip that."
      },
      {
        "name": "interest",
        "prompt": "What brings you here today?",
        "validation": "minLength:10",
        "followUp": true
      }
    ],
    "completion": {
      "message": "Thanks {{fullName}}! Someone from our team will reach out to {{email}} shortly.",
      "showSummary": true
    }
  }
}

Agent System Prompt

markdown
You are a friendly intake specialist collecting information from visitors.

Collect these fields through natural conversation:
- fullName (required)
- email (required, validate format)
- company (optional)
- interest (required, at least 10 characters)

Guidelines:
1. Be conversational, not robotic
2. Ask one question at a time
3. Acknowledge responses before asking next
4. Validate inputs and ask again if invalid
5. Allow users to skip optional fields

Use collect_field(name, value) to save each answer.

When complete, summarize what was collected and confirm.

AI-Assisted Form

Configuration

json
{
  "agentIntegration": {
    "mode": "assistant",
    "agentId": "form_helper",
    "assistant": {
      "position": "sidebar",
      "defaultOpen": false,
      "triggerButton": {
        "text": "Need help?",
        "icon": "chat"
      },
      "capabilities": [
        "answer_questions",
        "explain_fields",
        "suggest_values",
        "validate_input"
      ]
    }
  }
}

Field-Specific Help

json
{
  "fields": [
    {
      "type": "text",
      "name": "taxId",
      "label": "Tax ID",
      "agentHelp": {
        "enabled": true,
        "prompt": "Explain what a Tax ID is and where to find it"
      }
    }
  ]
}

Smart Suggestions

json
{
  "fields": [
    {
      "type": "dropdown",
      "name": "industry",
      "label": "Industry",
      "agentSuggest": {
        "enabled": true,
        "basedOn": ["companyName", "website"],
        "prompt": "Based on the company name and website, suggest the most likely industry"
      }
    }
  ]
}

Use Cases

Lead Qualification

json
{
  "agentIntegration": {
    "mode": "post_submit",
    "agentId": "lead_qualifier",
    "messageTemplate": "Score this lead based on our ICP:\n\nCompany: {{company}}\nRole: {{jobTitle}}\nSize: {{companySize}}\nBudget: {{budget}}\nTimeline: {{timeline}}",
    "responseFormat": {
      "type": "json",
      "schema": {
        "score": "number",
        "qualification": "enum:hot,warm,cold",
        "reasoning": "string",
        "nextSteps": "array"
      }
    },
    "postProcess": {
      "routeSubmission": {
        "rules": [
          { "if": "{{response.qualification}} === 'hot'", "to": "sales_urgent" },
          { "if": "{{response.qualification}} === 'warm'", "to": "sales_nurture" },
          { "default": true, "to": "marketing_drip" }
        ]
      }
    }
  }
}

Support Ticket Triage

json
{
  "agentIntegration": {
    "mode": "post_submit",
    "agentId": "support_triage",
    "messageTemplate": "Analyze this support request:\n\nSubject: {{subject}}\nDescription: {{description}}\nCategory (user selected): {{category}}",
    "responseFormat": {
      "type": "json",
      "schema": {
        "actualCategory": "string",
        "priority": "enum:low,medium,high,critical",
        "department": "string",
        "suggestedResponse": "string",
        "escalate": "boolean"
      }
    },
    "postProcess": {
      "createTicket": {
        "system": "zendesk",
        "mapping": {
          "subject": "{{subject}}",
          "priority": "{{response.priority}}",
          "group": "{{response.department}}"
        }
      },
      "autoResponse": {
        "condition": "{{response.suggestedResponse}} !== null",
        "email": "{{email}}",
        "subject": "Re: {{subject}}",
        "body": "{{response.suggestedResponse}}"
      }
    }
  }
}

Application Review

json
{
  "agentIntegration": {
    "mode": "post_submit",
    "agentId": "application_reviewer",
    "messageTemplate": "Review this job application:\n\nPosition: {{position}}\nExperience: {{yearsExperience}} years\nSkills: {{skills}}\nCover Letter: {{coverLetter}}\nResume Summary: {{resumeSummary}}",
    "responseFormat": {
      "type": "json",
      "schema": {
        "fitScore": "number",
        "strengths": "array",
        "concerns": "array",
        "interviewRecommendation": "boolean",
        "notes": "string"
      }
    }
  }
}

Response Handling

Display to User

json
{
  "agentIntegration": {
    "responseDisplay": {
      "showToUser": true,
      "field": "ai_response",
      "format": "message"
    }
  }
}

Store with Submission

json
{
  "agentIntegration": {
    "responseStorage": {
      "enabled": true,
      "field": "ai_analysis",
      "includeMetadata": true
    }
  }
}

Trigger Actions

json
{
  "agentIntegration": {
    "actions": [
      {
        "condition": "{{response.priority}} === 'critical'",
        "action": "notify",
        "config": {
          "channel": "slack",
          "message": "Critical submission requires attention"
        }
      },
      {
        "condition": "{{response.score}} >= 80",
        "action": "workflow",
        "config": {
          "workflowId": "high_value_lead"
        }
      }
    ]
  }
}

Widget Embedding

Conversational Widget

html
<script src="https://cdn.arcanflows.com/forms.js"></script>
<script>
  Arcanflows.conversationalForm({
    formId: 'intake_form',
    container: '#chat-container',
    agentId: 'intake_agent',
    theme: 'light'
  });
</script>

Assistant Widget

html
<script>
  Arcanflows.form({
    formId: 'contact_form',
    container: '#form-container',
    assistant: {
      enabled: true,
      position: 'right',
      agentId: 'form_helper'
    }
  });
</script>

Error Handling

json
{
  "agentIntegration": {
    "errorHandling": {
      "onTimeout": {
        "action": "submit_without_processing",
        "message": "We'll process your submission shortly."
      },
      "onError": {
        "action": "retry",
        "maxRetries": 2,
        "fallback": "submit_without_processing"
      }
    }
  }
}

Best Practices

  1. Clear purpose - Define what the agent should do
  2. Structured responses - Use JSON schemas
  3. Handle failures - Graceful error handling
  4. Test thoroughly - Various inputs and edge cases
  5. Monitor performance - Track success rates
  6. Secure data - Don't send sensitive fields unnecessarily