DEV Community

Fathin Dosunmu
Fathin Dosunmu

Posted on • Originally published at agentsim.dev

The Complete Guide to Phone Verification for AI Agents in 2026

This is the definitive reference for phone verification in the AI agent ecosystem. Whether you're building browser automation, account creation workflows, or multi-service onboarding — this guide covers every approach, what works, what doesn't, and why.


The Verification Landscape in 2026

Phone verification is now the primary gatekeeper for online services. As AI agents become more capable, the verification infrastructure has evolved to detect and block automated signups.

Services That Block VoIP Numbers

Service Block Severity Error Message
Stripe Hard block "This phone number cannot be used for verification"
Google Hard block + behavioral "This number cannot be used"
WhatsApp Hard block "Unsupported phone numbers, such as VoIP"
Amazon Silent failure Code never arrives
Microsoft Risk-based Error 399287 "BadReputation"
Vercel Hard block Registration rejected
DocuSign Hard block Registration rejected
Banks Hard block Varies

The Detection Stack

Every major service uses some combination of:

  1. LERG lookup — Checks carrier and line type from the master phone database
  2. NPAC query — Checks if the number was ported from mobile to VoIP
  3. HLR query — Real-time check of mobile network registration
  4. Behavioral analysis — Pattern detection (creation velocity, geographic consistency)
  5. Reputation scoring — Number history, abuse reports, fraud databases

Every Approach Ranked

❌ Twilio / Vonage / VoIP Providers

  • Cost: $1-15/month per number
  • Success rate: 0% on Stripe, Google, WhatsApp, banks
  • Why it fails: Numbers registered as voip in LERG. Every service blocks them.
  • When to use: Voice bots, customer support, non-verification use cases

❌ Google Voice / TextNow / Free Services

  • Cost: Free
  • Success rate: 0% on most services
  • Why it fails: Same VoIP detection. Plus, automating these violates ToS.
  • When to use: Never for production AI agents

⚠️ Prepaid SIM Cards (Manual)

  • Cost: $3-10 per SIM + manual labor
  • Success rate: ~90% (some services block prepaid)
  • Why it's problematic: Doesn't scale. Requires physical SIM management, manual number rotation, and someone physically handling the phones.
  • When to use: One-off testing, not production automation

✅ AgentSIM (Real SIM API)

  • Cost: $0.99/session, 10 free/month
  • Success rate: 98-100% across all services
  • Why it works: Real SIM cards on real carrier networks (T-Mobile, AT&T, Verizon). Numbers pass LERG, NPAC, and HLR checks because they ARE mobile numbers.
  • When to use: Production AI agent verification at any scale

Implementation Guide

Installation

pip install agentsim-sdk
Enter fullscreen mode Exit fullscreen mode

Pattern 1: Basic OTP Verification

import agentsim

agentsim.configure(api_key="asm_live_xxx")

async with agentsim.provision(agent_id="signup-bot", country="US") as num:
    # num.number is a real E.164 mobile number
    print(f"Phone: {num.number}")  # +14155552671

    # Enter number on whatever service needs verification
    await enter_phone_number(num.number)

    # Wait for OTP — real SMS on real SIM
    otp = await num.wait_for_otp(timeout=60)
    print(f"Code: {otp.otp_code}")  # "391847"

    await enter_verification_code(otp.otp_code)
# Number auto-released when context exits
Enter fullscreen mode Exit fullscreen mode

Pattern 2: With Browser Automation (Playwright)

import agentsim
from playwright.async_api import async_playwright

agentsim.configure(api_key="asm_live_xxx")

async def automated_signup(service_url):
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        page = await browser.new_page()
        await page.goto(service_url)

        async with agentsim.provision(
            agent_id="browser-signup",
            country="US"
        ) as num:
            # Fill phone field
            await page.fill('[type="tel"]', num.number)
            await page.click('button:has-text("Send")')

            # Get OTP from real SIM
            otp = await num.wait_for_otp(timeout=60)

            # Enter code
            await page.fill('[name="code"]', otp.otp_code)
            await page.click('button:has-text("Verify")')

        await browser.close()
Enter fullscreen mode Exit fullscreen mode

Pattern 3: Synchronous (Non-Async)

import agentsim

agentsim.configure(api_key="asm_live_xxx")

with agentsim.provision_sync(agent_id="sync-bot") as num:
    print(num.number)
    enter_phone(num.number)

    otp = num.wait_for_otp_sync(timeout=60)
    enter_code(otp.otp_code)
Enter fullscreen mode Exit fullscreen mode

Pattern 4: MCP Integration (Claude Code / Cursor / Windsurf)

{
  "mcpServers": {
    "agentsim": {
      "url": "https://mcp.agentsim.dev/mcp",
      "headers": {
        "Authorization": "Bearer asm_live_xxx"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Your AI agent calls provision_number and wait_for_otp as MCP tools — no SDK installation needed.

Pattern 5: Auto-Rerouting (Fallback Countries)

async with agentsim.provision(agent_id="global-bot", country="US") as num:
    otp = await num.wait_for_otp(
        timeout=60,
        auto_reroute=True,      # Try another country if US fails
        max_reroutes=2,
        on_reregistration_needed=handle_new_number
    )
Enter fullscreen mode Exit fullscreen mode

Error Handling

from agentsim.exceptions import (
    OtpTimeoutError,
    PoolExhaustedError,
    RateLimitError
)

try:
    async with agentsim.provision(agent_id="bot") as num:
        otp = await num.wait_for_otp(timeout=60)
except OtpTimeoutError:
    print("SMS didn't arrive in 60s — service may have blocked this number")
except PoolExhaustedError:
    print("No numbers available — try a different country")
except RateLimitError:
    print("Too many requests — back off and retry")
Enter fullscreen mode Exit fullscreen mode

Cost Comparison

Solution Setup cost Per-verification cost Stripe Google WhatsApp
Twilio $0 $1.15/number + SMS
Google Voice $0 Free
Prepaid SIM $5-10/SIM Manual labor ⚠️ ⚠️ ⚠️
AgentSIM $0 $0.99/session

Free tier: 10 sessions/month. No subscription required.

Best Practices

  1. Rate limit aggressively — Most bans come from velocity, not carrier detection
  2. Use realistic browser fingerprints — Headless detection is separate from phone verification
  3. Rotate IPs — Don't create multiple accounts from the same IP
  4. Warm up accounts — Login and use accounts normally after creation
  5. Handle failures gracefully — Use try/except with AgentSIM's typed exceptions

Links

Top comments (0)