Building AI Employees: A Developer's Complete Guide
I’ve built AI automations that handle over $12,000 in monthly recurring tasks—customer onboarding, content creation, and support—without me writing a single line of code after the initial setup. The secret isn't a single magic tool, but a system of specialized AI employees working on a reliable automation backbone. This guide is the exact architecture and code I use.
What is an AI employee (and what it's not)
An AI employee is a persistent, automated agent with a defined role, access to specific tools and data, and the ability to execute multi-step workflows autonomously. It's not a one-off ChatGPT prompt. My billing specialist AI employee, for example, runs every Monday: it fetches last week's invoices from Paddle via API, analyzes them in a Claude-3.5-Sonnet context window, drafts a collections email for overdue clients using a structured template, and queues it in Resend—all without my intervention.
What it's not is a general intelligence. It won't "figure things out." You must define its world precisely. An AI employee for social media needs explicit guardrails: "Use brand voice document X," "Never comment on politics," "Post only to channels Y and Z." Its knowledge comes from your curated data in a Supabase table, not the open web. I treat them like junior remote workers: excellent at repetitive, rules-based tasks, but requiring clear SOPs. For a deeper look at the business impact, I detailed the specific roles I automated in /blog/how-i-replaced-6-employees-with-ai-automations.
Your first step is to audit your week for 15-minute repetitive tasks. Found one? That's a candidate. Document the exact inputs, decision logic, and outputs. That document becomes the AI employee's job description.
The 6 AI employee archetypes
Through building dozens of these, I've found they cluster into six repeatable archetypes. You can mix and match these to cover most business functions.
- The Researcher: Ingests data (RSS feeds, Google Alerts, Supabase rows) and produces summaries or reports. I use one to scan Hacker News daily for "n8n" or "low-code," summarize the top 5 threads, and add them to a Notion database.
- The Content Machine: Turns one piece of content into many. A single blog post becomes a Twitter thread, a LinkedIn article, and five newsletter snippets. We'll build this one in the next section.
- The Support Agent: Handles tier-1 support. Mine uses Claude API to answer questions based on a vectorized knowledge base (stored in Supabase with
pgvector), and only escalates if confidence is below 85%. - The Analyst: Processes structured data. It checks Paddle for new customers, ensures they're added to the correct email segment in Resend, and logs any anomalies to a Slack channel.
- The Coordinator: Manages workflows. It's the "manager" of other AI employees, kicking off processes. For example, when a new user is added to my app (via a Supabase trigger), this archetype triggers the onboarding email sequence and assigns a "welcome task" in my project management tool.
- The Quality Checker: Reviews the output of other automations. Another AI employee proofreads all scheduled tweets for tone and errors before they go live.
Start with one archetype that addresses your biggest time sink. The Content Machine is a powerful first project because its output is immediately valuable.
Architecture: Claude API + n8n + Supabase
This stack is my production backbone for AI employees automation. It's reliable, relatively inexpensive, and keeps me in control of my data.
- Claude API (Anthropic) is the "brain." I use
claude-3-5-sonnet-20241022for most tasks. It's consistently better at following complex instructions than GPT-4 for my use cases and is cheaper for long contexts. I pass it a strict system prompt defining the AI employee's role and inject relevant context from my database. - n8n is the "nervous system." This open-source workflow automation tool is where I orchestrate everything. Each AI employee is one or more n8n workflows. It handles API calls, logic (if/else branches), error handling, and scheduling. I host it on a $10 DigitalOcean droplet.
- Supabase is the "long-term memory." It's a Postgres database. Every AI employee's interactions, generated content, and user data live here. Crucially, I store vector embeddings (using the
pgvectorextension) for semantic search, which allows my Support Agent to find relevant past answers. It's also where I log all automation runs for auditing.
- An n8n schedule node triggers the workflow at 9 AM daily.
- A Supabase node fetches the task list (
SELECT * FROM content_queue WHERE status = 'pending'). - For each item, an HTTP Request node calls the Claude API with a prompt template that includes the row data.
- A code node validates the Claude response.
- Another Supabase node updates the record with the output and sets
status = 'completed'.
The entire system is event-driven and observable. My total monthly cost for running 5-6 core AI employees is under $150.
Building a Content Machine (code walkthrough)
Let's build a specific AI employee: the Content Machine archetype. This workflow takes a new blog post from our Supabase blog_posts table and generates a Twitter thread and a LinkedIn post from it.
Tools: n8n, Claude API, Supabase, Resend (for email logging).
Step 1: Trigger & Fetch.
We start with an n8n webhook that's called by a Supabase trigger whenever a new blog post is published. The webhook receives the post_id. The first real node is a Supabase node configured to execute a custom query:
SELECT id, title, body, excerpt, author FROM public.blog_posts WHERE id = {{ $json.body.record.id }};
Step 2: Call Claude for the Twitter Thread. We use an HTTP Request node to call the Claude Messages API. The key is the system prompt, which defines this AI employee's specialty:
{
"model": "claude-3-5-sonnet-20241022",
"max_tokens": 500,
"system": "You are a viral Twitter thread writer. Convert the provided blog post into a 5-tweet thread. Each tweet must be under 280 chars. Use hooks, numbered points, and emojis. Include 3 relevant hashtags at the end of the final tweet. Output ONLY the raw tweets, separated by '---' on a new line.",
"messages": [
{
"role": "user",
"content": "Title: {{ $json.title }}\nExcerpt: {{ $json.excerpt }}\n\nKey points from post: {{ $json.body }}"
}
]
}
Step 3: Parse & Store.
A Code node splits the Claude output on --- and creates an array of tweet objects. Then, a Supabase node inserts this array into a social_posts table, linked to the original blog post ID.
Step 4: Repeat for LinkedIn.
We duplicate the Claude call but with a different system prompt: "You are a B2B LinkedIn content writer..." This generates a longer-form post. We store that output in the same social_posts table with a platform: linkedin flag.
Step 5: Review & Schedule.
The final step isn't fully automatic. Another n8n workflow runs hourly, checks the social_posts table for status = 'pending_review', and sends me a digest email via Resend with the generated content. I click one button to approve and schedule it. This human-in-the-loop step is crucial for quality control.
Next Step: Run this once. Then, add a branch to automatically generate 5 email newsletter snippets from the same post using the prompts from /blog/50-ai-prompts-every-business-needs-2026. You've now built an AI employee that multiplies the impact of every piece of content you create.
Building a Sales Bot with lead scoring
For my sales bot, I needed it to do more than just chat—it needed to qualify. I built it using n8n to orchestrate a conversation with the Claude API, while scoring each interaction against rules in a Supabase table.
The core is a workflow triggered by a webhook (from a website chat widget). The first node hits my conversations table in Supabase to fetch the history. I then use a Function node to prep the prompt for Claude, which is specific:
const systemPrompt = `You are a sales assistant for Acme API. Your goal is to qualify leads. Ask about:
1. Their use case (integration, internal tool, research).
2. Their team size (dev team specifically).
3. Their timeline (POC, production, just exploring).
Keep responses under 3 sentences. Be helpful but directive.`;
The magic happens after Claude replies. Before sending the response back to the user, another Function node runs my lead-scoring logic. It checks the last exchange for keywords and assigns points:
let score = 0;
const text = items[0].json.last_message.toLowerCase();
if (text.includes('production') || text.includes('launch')) score += 3;
if (text.includes('team of') || text.includes('developers')) score += 2;
if (text.includes('integrate') || text.includes('api')) score += 2;
return [{ json: { lead_score_increment: score } }];
This lead_score_increment is sent to a Supabase node that updates the lead record: supabase.from('leads').update({ score: score + increment }).eq('id', leadId). If the total score crosses a threshold (e.g., 8), another workflow is triggered to send a Slack alert to the sales team with the full conversation. This creates a fully automated qualification funnel.
Building a Support Agent with knowledge base
A support agent can't hallucinate answers. I ground mine in a dedicated knowledge base stored as embeddings in Supabase. The setup has two parts: the ingestion workflow and the query workflow.
First, ingestion. I have an n8n workflow that triggers weekly. It fetches all updated Markdown files from my internal docs and GitHub repo. Each doc is split into chunks (using LangChain's text splitter via a custom code node), then each chunk is sent to the OpenAI embeddings API (text-embedding-3-small). The resulting vector and the source text are stored in a Supabase table (support_kb) using the vector extension.
- It takes the user's question and generates an embedding using the same OpenAI model.
- It queries Supabase for the 5 most relevant chunks using cosine similarity:
supabase.rpc('match_documents', { query_embedding: embedding, match_threshold: 0.7, match_count: 5 }). - It constructs a precise prompt for Claude:
You are a support agent. Answer the user's question strictly based on the provided context. If the answer is not in the context, say "I don't have enough information to answer that. Please email support@acme.com."
Context:
{{chunk_1}}
{{chunk_2}}
...
Question: {{user_question}}
This Retrieval-Augmented Generation (RAG) pattern is crucial. It keeps answers accurate and allows me to update the agent's knowledge just by updating the source docs. I also log every Q&A pair to a support_logs table to find gaps in the knowledge base.
Monitoring, costs, and when to escalate to humans
Deploying AI employees isn't a "set and forget" operation. You need to monitor three things: performance, cost, and sentiment.
For performance, I log every AI interaction to a logs table in Supabase, including timestamps, token counts, and the full prompt/response. A daily n8n workflow summarizes this: average response time, total requests, and common errors. I also sample 1% of conversations for manual review.
Costs are primarily API calls. Claude 3 Haiku costs ~$0.25 per 1M input tokens and $1.25 per 1M output tokens. My Content Machine uses about 500K tokens per week, costing ~$0.50. My Sales Bot uses about 200K tokens per week. I track this via the usage field in the Anthropic API response and log it. My total AI API spend is under $50/month for several agents.
Escalation is rule-based. In my Sales Bot, a lead score >8 triggers an escalation. In my Support Agent, any response containing "I don't have enough information" automatically creates a ticket in Linear (via n8n's Linear node) and emails the user. Additionally, I use a simple sentiment analysis (via a quick call to Claude with a "rate user frustration 1-5" prompt) on the conversation. A score of 4 or 5 also triggers a human handoff. The key is having clear, auditable rules, not just hoping the AI will ask for help.
Wrapping Up
Building AI employees means connecting best-in-class models (Claude) with workflow automation (n8n) and persistent state (Supabase). Start with a single, high-value archetype like the Content Machine, nail the RAG pattern for knowledge, and always implement logging and escalation gates from day one. The stack is simple, but the impact compounds quickly.
Want pre-built AI employees? Browse AI Employee Kits — Content Machine, Sales Bot, Support Agent, and more.
You've got the blueprint—now go build your team.
Walid Abed
Building AI-operated businesses from Beirut. Creator of Opsonaut.
Recommended
Ready to automate?
Browse workflow templates, prompt packs, and AI kits.
Get weekly automation tips
Join 1,000+ developers and solopreneurs. No spam.
Related Articles
50 AI Prompts Every Business Needs in 2026
50 copy-paste AI prompts that handle marketing, sales, support, and operations — tested across ChatGPT, Claude, and Gemini.
The Developer's Guide to n8n Workflow Templates
Everything about n8n workflow templates — from importing your first template to building and selling your own.
How to Automate Your Entire Business for Under $120/Month
A real cost breakdown: automate sales, support, content, and analytics using free and low-cost tools for under $120/month.