Zing 论坛

正文

Serverless-Clawdbot:基于边缘函数的Agentic操作系统与API工作流引擎

一个将传统常驻守护进程架构转换为无服务器友好形态的开源项目,利用Vercel Edge Functions和Workflow DevKit实现具备持久队列和自主能力的AI代理系统,支持Telegram、WhatsApp和SMS多通道交互。

serverlessedge-functionsagentic-aiworkflowtelegram-botwhatsapp-apivercelredis
发布时间 2026/04/09 06:45最近活动 2026/04/09 06:53预计阅读 10 分钟
Serverless-Clawdbot:基于边缘函数的Agentic操作系统与API工作流引擎
1

章节 01

Serverless-Clawdbot: Core Overview

Serverless-Clawdbot is an open-source project that transforms traditional resident daemon architecture into a serverless-friendly form. It uses Vercel Edge Functions and Workflow DevKit to build an AI agent system with persistent queues and autonomous capabilities, supporting multi-channel interactions (Telegram, WhatsApp, SMS). The project addresses limitations of traditional AI agent frameworks in deployment, scalability, and cost-effectiveness.

2

章节 02

Project Background & Architecture Transition

With the popularity of serverless and edge computing, traditional AI agent systems' architecture is undergoing profound changes. Most existing AI assistants rely on resident background processes (daemon) to maintain state, handle message queues, and execute scheduled tasks. This architecture has limitations in deployment, scalability, and cost-effectiveness. Serverless-Clawdbot provides an innovative solution: converting the traditional resident daemon architecture into a serverless-friendly form while maintaining original UI interaction conventions, using Vercel Edge Functions and Workflow DevKit to重构 the underlying execution model.

3

章节 03

Core Architecture & Multi-channel Support

Single Public Gateway Route

All functions converge to a single public gateway route app/api/claw/route.ts, leveraging serverless advantages (on-demand startup, auto-scaling, pay-as-you-go). All external interactions (health checks, pairing authentication, message reception, Webhook calls) are processed through this entry point.

Persistent Queue & Autonomous Capabilities

Using Workflow DevKit's use workflow and use step primitives, workflow steps are naturally persistent (auto-recovered if interrupted). The daemonWorkflow() function uses sleep("1s") to simulate the main loop of traditional daemons, with a 1-minute Cron watchdog to ensure continuous operation, overcoming Vercel Cron's 1-second scheduling limitation.

Multi-channel Message Support

Native support for three channels:

  • Telegram: Full Bot API support with Webhook verification key.
  • WhatsApp Cloud API: Meta official API integration with verification token and access token configuration.
  • Textbelt SMS: JSON-formatted SMS reply Webhook endpoint. Each channel has independent endpoints but uses a unified internal mechanism.
4

章节 04

Security & Authentication Mechanisms

Pairing System

By default, the system is in 'locked' mode. Unknown senders receive a 6-digit pairing code and must reply with /pair command to verify. Pairing codes are dynamically generated when needed, stored in Redis, and output via Vercel function logs. Admins can preset allowed identities via ADMIN_IDENTITIES (format: telegram:123456789,sms:+15551234567).

Autonomous Mode Control

Two modes:

  • Assistive (default): Avoids destructive operations unless explicitly requested.
  • Full: Allows more free actions (use with caution). This分级授权 balances security and convenience.
5

章节 05

Integration & Expansion Capabilities

Composio Integration

Built-in support for Composio (third-party service integration platform), enabling access to hundreds of SaaS APIs (GitHub, Google Workspace, Slack, Notion, etc.). Integration is optional and filterable.

SSH Tool

Optional SSH tool with strict allowlist restrictions, providing server management capabilities while maintaining security.

Webhook API

Exposes a Webhook API for external systems to trigger agent message delivery. Requires x-claw-secret header verification, supporting message sending and task scheduling.

6

章节 06

Deployment & Operation Guidelines

Redis Configuration

State persistence relies on Redis. Two options:

  • Upstash Redis (recommended): Use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
  • Vercel-injected Redis variables: Use KV_REST_API_URL and KV_REST_API_TOKEN. Falls back to in-memory storage if no Redis variables are configured (suitable for local development, not production).

Management Interface

Web management interface (/ui) for configuring Webhooks, sending test messages, and connecting Composio. Requires ADMIN_UI_PASSWORD environment variable.

Workflow DevKit Debugging

Use npm run workflow:web to start Workflow DevKit UI for local log checking and state monitoring, helpful for debugging workflow logic.

7

章节 07

Technical Highlights & Innovation Value

Serverless-Clawdbot proves AI agents can run efficiently on serverless architecture, with multiple values:

  • Cost Optimization: Pay-as-you-go model means no cost when idle, attractive for individual developers and small teams.
  • Auto-scaling: Cloud platform auto-scaling handles sudden traffic without manual server configuration.
  • Simplified Operation: No need to manage servers, daemons, or container orchestration, allowing focus on agent logic.
  • Architectural Demonstration: Provides a concrete example for migrating traditional resident applications to serverless, with推广able design patterns.
8

章节 08

Application Scenarios & Future Outlook

Suitable Scenarios

  • Individual developers needing to quickly deploy AI assistant prototypes.
  • Applications with fluctuating message volumes and hard-to-estimate server resources.
  • Small teams wanting to reduce operation and maintenance burden.
  • Scenarios requiring unified multi-channel message processing.

Usage Suggestions

  1. Configure ADMIN_IDENTITIES carefully to avoid repeated pairing.
  2. Choose autonomous mode based on actual needs; use full mode cautiously.
  3. Must configure Redis in production (avoid in-memory storage).
  4. Regularly check Vercel function logs to monitor agent status.
  5. Use Workflow DevKit for development and debugging.

Future Outlook

As edge computing and serverless technologies develop, more similar projects will emerge, pushing AI agent deployment towards lighter and more flexible models. Serverless-Clawdbot provides valuable practical references for this trend.