Ultron

Onboarding Sequencer

Send behavior-triggered onboarding emails that adapt to user actions, hand off cold accounts to sales, and stop spamming activated ones.

Next.jsTypeScriptResendZod

Capabilities

Record entry point and goal at signup to personalize the sequence
Listen for activation events and stop emailing users who already activated
Send the next email based on actual behavior, not a fixed cadence
Hand off PQL accounts to sales after 7-day activation stall
System Prompt
You are an onboarding strategist. You guide new users from signup to activation without being annoying.

WORKFLOW:
1. Call ingest_user on signup to record the entry point and goal.
2. Call detect_action to listen for activation events (first deploy, first invite, first export).
3. Call send_next_email based on what they have and have not done yet.
4. Call hand_off_to_sales when an account hits PQL criteria but stalls before activation.

RULES:
- Stop sending the moment a user activates. Never email an active user a "have you tried…" prompt.
- Sales handoff requires both PQL signal and 7-day stall.
- Subject lines max 6 words, no exclamation marks.
- Every email must offer one action; never two CTAs.
Agent Source
import { agent, tool } from "@agent-sdk"
import { z } from "zod"

const userInput = z.object({
  userId: z.string(),
  signupSource: z.string(),
  goal: z.string().optional(),
})

export default agent({
  model: "claude-sonnet-4-6",
  permissionMode: "bypassPermissions",
  maxTurns: 30,
  systemPrompt: `...`, // see System Prompt section above
  tools: {
    ingest_user: tool({
      description: "Record entry point and stated goal at signup",
      inputSchema: userInput,
      execute: async ({ userId, signupSource, goal }) => { /* persist */ },
    }),
    detect_action: tool({
      description: "Listen for activation events",
      inputSchema: z.object({ userId: z.string() }),
      execute: async ({ userId }) => { /* events[] */ },
    }),
    send_next_email: tool({
      description: "Send the right next email based on user state",
      inputSchema: z.object({ userId: z.string() }),
      execute: async ({ userId }) => { /* via Resend */ },
    }),
    hand_off_to_sales: tool({
      description: "Notify sales for stalled PQL accounts",
      inputSchema: z.object({ userId: z.string() }),
      execute: async ({ userId }) => { /* webhook */ },
    }),
  },
})

File Structure

agents/
onboarding-sequencer.ts
lib/onboarding/
state.ts
templates.ts
handoff.ts
app/api/onboarding/
route.ts
Setup
$ npm install
$ cp .env.example .env.local
# Add RESEND_API_KEY
$ npm run dev

Environment Variables

RESEND_API_KEYResend key for transactional sends
AGENT_API_KEYServer-side API key for token exchange

Sell This Agent

Most onboarding sequences treat all users the same. This branches by behavior and stops the moment they activate.

Setup fee
$2,400
Monthly retainer
$400/mo
Target marketB2B SaaS, PLG products, Growth teams

Included

Full agent source code
Behavior-triggered branching
Activation suppression
Connect to Ultron pipelineUnlock
Multi-channel (in-app + email)Unlock
Turn views into income.Drop your video link, get paid as the view count climbs.
Submit a video