AILabStore
All guides

Building

Build AI agents with n8n

Deploy managed n8n, connect it to AILabStore, and build a tool-using agent that triages support emails and posts summaries to Slack.

8 min read · Updated November 1, 2026

n8n is a visual workflow automation platform with built-in AI Agent nodes. Combined with AILabStore, every workflow can use any model from any provider through one credential. In this guide you deploy n8n as a managed tool, connect it to AILabStore and build a practical support-triage agent.

n8n is included in the Builder and Enterprise packages.

1. Deploy n8n

  1. Open Portal → Managed tools and choose Request deployment next to n8n.
  2. Tell us your preferred region (close to the services you integrate with) and any sizing needs. The default size suits most teams.
  3. We provision the instance and email you its URL when it is ready.
  4. Open the instance URL and create the owner account.

Your instance runs on its own subdomain with TLS, daily backups and automatic updates. To restart or resize it, or to get logs, contact [email protected].

2. Connect n8n to AILabStore

n8n's OpenAI credential accepts a custom base URL, which is all AILabStore needs.

  1. In n8n, go to Credentials → Add credential → OpenAI.
  2. Set API Key to your AILabStore key. We recommend creating a dedicated key named n8n in Portal → API keys.
  3. Set Base URL to https://api.ailabstore.cc/v1.
  4. Save. n8n tests the connection by listing models.

Any node that uses this credential can now select models such as anthropic/claude-sonnet-5.5, openai/gpt-5-mini or google/gemini-2.5-flash. If a model does not appear in the drop-down, choose By ID and type the id.

3. The workflow we are building

A support inbox receives emails. For each new email, the agent should:

  1. Classify it as billing, technical, sales or other.
  2. Look up the customer's plan from your CRM.
  3. Draft a reply.
  4. Post a summary with the draft to the right Slack channel.

4. Build the workflow

Trigger

Add an Email Trigger (IMAP) node, or a Gmail Trigger if you use Google Workspace. Configure it to poll the support inbox every minute.

AI Agent node

Add an AI Agent node after the trigger.

  • Chat Model: attach an OpenAI Chat Model sub-node using your AILabStore credential, with model anthropic/claude-sonnet-5.5.
  • Memory: not needed for single-email processing.
  • Prompt (user message): map the email fields.
From: {{ $json.from }}
Subject: {{ $json.subject }}

{{ $json.text }}
  • System message:
You are a support triage assistant for a SaaS company.
1. Classify the email as one of: billing, technical, sales, other.
2. Use the lookup_customer tool with the sender's email to find their plan.
3. Draft a friendly, specific reply under 150 words. Never promise refunds or dates.
Return JSON: {"category": "...", "plan": "...", "summary": "...", "draft": "..."}

Give the agent a tool

Agents become useful when they can act. Attach an HTTP Request Tool sub-node to the agent:

  • Name: lookup_customer
  • Description: Look up a customer's plan and account status by email address.
  • Method: GET
  • URL: https://crm.example.com/api/customers?email={email}
  • Authentication: your CRM credential

The model decides when to call the tool and fills in the email parameter itself.

Parse and route

Add a Code node to parse the agent's JSON output:

const raw = $input.first().json.output;
const data = JSON.parse(raw.slice(raw.indexOf("{"), raw.lastIndexOf("}") + 1));
return [{ json: data }];

Then add a Switch node on {{ $json.category }} with outputs for billing, technical, sales and other.

Post to Slack

On each output, add a Slack node that sends a message to the matching channel:

*New {{ $json.category }} email* ({{ $json.plan }} plan)
{{ $json.summary }}

*Suggested reply:*
{{ $json.draft }}

Activate the workflow. New emails are now triaged within a minute.

5. Call AILabStore directly from n8n

For tasks that do not need an agent, the HTTP Request node can call the API directly, which gives you full control over parameters:

  • Method: POST
  • URL: https://api.ailabstore.cc/v1/chat/completions
  • Headers: Authorization: Bearer {{ $env.AILABSTORE_API_KEY }}
  • Body (JSON):
{
  "model": "anthropic/claude-haiku-5.5",
  "temperature": 0,
  "messages": [
    { "role": "system", "content": "Extract the order number from the text. Reply with the number only." },
    { "role": "user", "content": "{{ $json.text }}" }
  ]
}

Ask [email protected] to set AILABSTORE_API_KEY as an environment variable on your instance so the key never appears in workflow JSON.

Choosing models in n8n

  • Use a fast, low-cost model (anthropic/claude-haiku-5.5, google/gemini-2.5-flash-lite) for classification and extraction steps that run on every item.
  • Use a stronger model (anthropic/claude-sonnet-5.5, openai/gpt-5) for the agent that plans and calls tools.
  • Use Perplexity Sonar when a step needs current information from the web.

Because all models share one credential, you can change a node's model at any time and compare results in the execution log.

Production tips

  • Error workflows: set an error workflow under workflow settings that alerts you in Slack when an execution fails.
  • Rate limits: use the Loop Over Items node with a small batch size and a Wait node when processing large backlogs.
  • Human in the loop: route drafts to Slack for approval with buttons instead of sending replies automatically.
  • Cost visibility: create a separate API key per workflow group so Portal → Usage shows exactly what each automation costs.

Next steps