商业产业 Hacker News AI 2026-07-05T10:51 正文 ok 1066 words

AgentLine:面向 AI Agent 的开源电话呼叫基础设施

英文标题:🔶 Show HN: Open-source phone calling infra for AI agents

AgentLine 是一个开源的 AI 原生电话平台,为 Claude、Cursor 等 AI 代理提供真实电话号码与真人语音交互能力。它提供简洁的 REST API 与原生 MCP 服务器,让代理只需五分钟即可拨打电话、收发短信并获取完整通话转录,无需任何电信知识。平台内置由 Deepgram、OpenAI、Cartesia 驱动的语音处理管道,支持自托管(MIT 许可)和云端服务。对开发者而言,AgentLine 大幅简化了将智能语音对话集成到应用中的工作,是构建 AI 客服、语音助手等场景的高效工具。
打开原文相关 5 · 机会 3
media16.5 KB media1.2 KB media3.3 KB media1.8 KB media1.3 KB media3.6 KB media3.1 KB media77.9 KB

中文


AgentLine 是一个开源的 AI 原生电话平台,为 AI 代理提供真实电话号码和类人语音。它提供简单的 REST API 和 MCP 服务器,使得 AI 代理(Claude、Cursor、自定义 LLM 代理)能够拨打和接听电话、处理短信以及获取通话转录——完全无需电信知识。

你的 AI 代理  →  AgentLine API  →  真实电话呼叫
                                 →  短信消息
                                 →  通话转录
AgentLine Twilio/Vonage 自行构建
专为 AI 代理设计 ✅ 专门打造 ❌ 为呼叫中心打造
设置时间 5 分钟 数小时
MCP 服务器 ✅ 原生支持 ❌ 无
技能文件安装 ✅ 一个文件 ❌ 复杂的 SDK
语音处理管道 ✅ 内置(STT + TTS + LLM) ❌ 自行携带
开源 ✅ MIT 许可证 ❌ 专有

  • 📞 语音通话 — 通过简单的 API 拨打和接听真实电话
  • 🎙️ AI 语音管道 — 内置 STT(Deepgram)+ LLM(GPT-4o)+ TTS(Cartesia)管道
  • 💬 短信 — 接收和读取传入的文本消息
  • 🔌 MCP 服务器 — 为 Claude Desktop 和 Cursor 提供原生模型上下文协议支持
  • 📋 技能文件 — 一键安装到任何 AI 代理(Claude Code、Cursor、OpenClaw 等)
  • 🌍 多提供商 — SignalWire(美国),并支持可插拔的提供商架构
  • 📝 转录 — 自动通话转录,保存完整的对话历史
  • 📬 事件邮箱 — 基于轮询的事件系统,适用于没有 Webhook 端点的代理
  • 💰 内置计费 — 按秒计算通话费用,并跟踪余额
  • 🐳 Docker 就绪 — 一条命令即可在本地运行整个技术栈

graph LR A["🤖 AI Agent"] -->|REST API / MCP| B["⚡ AgentLine API"] B -->|Provision Numbers| C["📱 SignalWire"] B -->|Speech-to-Text| D["🎤 Deepgram"] B -->|Text-to-Speech| E["🔊 Cartesia"] B -->|LLM Reasoning| F["🧠 OpenAI"] C -->|Voice & SMS| G["📞 PSTN Network"] B -->|Events & Transcripts| A

加载中

语音管道——混合中继模式

AgentLine 采用异步的混合中继架构,而非脆弱的实时 WebSocket 流:

来电者拨打你的代理号码
  → SignalWire 接听电话
  → 向来电者播放 TTS 问候语
  → 录制来电者的语音
  → Deepgram 进行转录(快速、准确)
  → LLM 生成代理的回复
  → Cartesia 将回复朗读出来
  → 循环继续,直到通话结束
  → 完整的转录记录被存储以供检索

方案一:Docker Compose(推荐)

git clone https://github.com/agentlineHQ/AgentLine.git
cd AgentLine
cp .env.example .env
# 在 .env 中填入你的 API 密钥(参见下方配置说明)
docker-compose up -d

这会启动:

  • API 服务器 位于 http://localhost:8000
  • PostgreSQL 位于 localhost:5432(模式自动应用)
  • Redis 位于 localhost:6379

方案二:本地开发

git clone https://github.com/agentlineHQ/AgentLine.git
cd AgentLine
python -m venv venv
source venv/bin/activate  # 或在 Windows 上使用 venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# 填入你的 API 密钥
uvicorn agentline.main:app --reload

方案三:使用托管版本

无需自托管——访问 agentline.cloud 注册即可立即获取 API 密钥。


将 .env.example 复制为 .env 并填入你的凭据:

变量 是否必需 描述
SUPABASE_URL 是 你的 Supabase 项目 URL
SUPABASE_ANON_KEY 是 Supabase 匿名密钥
SUPABASE_SERVICE_ROLE_KEY 是 Supabase 服务角色密钥(服务器端)
DATABASE_URL 是 PostgreSQL 连接字符串
SIGNALWIRE_PROJECT_ID 是 SignalWire 项目 ID
SIGNALWIRE_TOKEN 是 SignalWire API 令牌
SIGNALWIRE_SPACE_URL 是 你的 SignalWire 空间 URL
DEEPGRAM_API_KEY 是 Deepgram API 密钥(STT)
CARTESIA_API_KEY 是 Cartesia API 密钥(TTS)
OPENAI_API_KEY 是 OpenAI API 密钥(LLM)
REDIS_URL 否 Redis URL(默认为 localhost:6379)
SECRET_KEY 是 应用密钥
BASE_URL 是 你的部署的公开 URL

启动后,访问 http://localhost:8000/docs 可查看交互式 Swagger UI。

方法 路径 描述
POST /v1/agents 创建新的 AI 语音代理
GET /v1/agents 列出所有代理
PATCH /v1/agents/{id} 更新代理(提示词、语音、问候语)
POST /v1/numbers 预置一个电话号码
GET /v1/numbers 列出电话号码
POST /v1/calls 拨打外呼电话
GET /v1/calls 列出通话记录
GET /v1/calls/{id}/transcript 获取通话转录
POST /v1/calls/{id}/hangup 挂断当前通话
GET /v1/events 轮询事件邮箱(消费)
GET /v1/events/peek 查看事件(非破坏性)
GET /v1/messages 列出短信消息
GET /v1/billing/balance 查看账户余额
GET /v1/billing/expenditure 支出明细

所有请求都需要 API 密钥:

curl -H "Authorization: Bearer sk_live_YOUR_KEY" \
     -H "Content-Type: application/json" \
     https://api.agentline.cloud/v1/agents

AgentLine 包含一个内置的 MCP(模型上下文协议)服务器,因此像 Claude Desktop 和 Cursor 这样的 AI 代理可以原生使用电话工具。

通过 Claude Desktop 连接

添加到你的 Claude Desktop 配置中:

Windows: %APPDATA%\Claude\claude_desktop_config.json macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "agentline": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote@latest",
        "http://localhost:8000/mcp",
        "--header", "Authorization: Bearer sk_live_YOUR_KEY"
      ]
    }
  }
}
工具 描述
create_agent 创建新的 AI 语音代理
list_agents 列出所有代理
update_agent 更新代理配置/提示词/语音
make_outbound_call 发起外呼电话
list_calls 列出通话历史
get_call_transcript 获取通话完整转录
hangup_call 挂断当前通话
buy_phone_number 预置新的电话号码
list_phone_numbers 列出所有电话号码
poll_events 轮询事件邮箱
peek_events 查看待处理事件
get_account_balance 查看账户余额
list_available_voices 列出可用语音预设
npx @modelcontextprotocol/inspector http://localhost:8000/mcp

技能文件——30 秒内安装

AgentLine 附带一个技能文件,可让任何 AI 代理立即获得电话功能:

https://agentline.cloud/skill.md

如何使用:

  1. 复制上面的技能文件 URL
  2. 将其添加到你的 AI 代理中(Claude Code、Cursor、OpenClaw 等)
  3. 设置你的 AGENTLINE_API_KEY 环境变量
  4. 告诉你的代理:“拨打 +1234567890”——一切即开即用!

该技能文件也包含在此仓库中: skills/agentline/SKILL.md。



docker build -t agentline .
docker run -p 8000:8000 --env-file .env agentline

AgentLine 可运行在任何支持 Python 3.12+ 和 Docker 的环境中:AWS、GCP、Azure、Fly.io、Render、Railway 等。


数据库模式位于 schema.sql 中。它会创建以下表:

  • accounts — 用户账户,包含余额追踪
  • api_keys — 用于认证的哈希 API 密钥
  • agents — AI 语音代理配置
  • phone_numbers — 预置的电话号码
  • calls — 通话记录及转录
  • messages — 短信消息记录
  • event_mailbox — 服务器端事件队列
  • billing_ledger — 不可变的计费交易日志

迁移文件位于 migrations/ 目录中。


如果使用 agentline.cloud 上的托管版本:

项目 费用
语音通话(呼入/呼出) 0.10 美元/分钟(按秒计费)
电话号码 2.00 美元(一次性)
短信(呼入) 免费

自托管:你只需支付自己的提供商费用(SignalWire、Deepgram、Cartesia、OpenAI)。


欢迎贡献!请参阅 CONTRIBUTING.md 了解指导原则。


社区

  • 💬 Discord — 与团队和其他开发者交流
  • 🐦 Twitter — 更新与公告
  • 📖 文档 — 完整 API 文档
  • 📝 博客 — 指南与教程

MIT 许可证 — 可用于任何用途。欢迎商用。


由 AgentLine 团队用 ❤️ 构建

给你的 AI 代理一个声音。 ☎️

English / 原文


AgentLine is an open-source AI-native telephony platform that gives AI agents real phone numbers and human-like voices. It provides a simple REST API and MCP server so AI agents (Claude, Cursor, custom LLM agents) can make and receive phone calls, handle SMS, and retrieve transcripts — without any telecom knowledge.

Your AI Agent  →  AgentLine API  →  Real Phone Calls
                                 →  SMS Messages
                                 →  Call Transcripts

| AgentLine | Twilio/Vonage | Build It Yourself
---|---|---|---
Built for AI agents | ✅ Purpose-built | ❌ Built for call centers | ❌ You stitch it together
Setup time | 5 minutes | Hours | Weeks
MCP server | ✅ Native | ❌ None | ❌ Build your own
Skill file install | ✅ One file | ❌ Complex SDK | ❌ Hundreds of lines
Voice pipeline | ✅ Included (STT + TTS + LLM) | ❌ BYO | ❌ BYO
Open source | ✅ MIT | ❌ Proprietary | ✅ Your code


  • 📞 Voice Calls — Make and receive real phone calls through a simple API
  • 🎙️ AI Voice Pipeline — Built-in STT (Deepgram) + LLM (GPT-4o) + TTS (Cartesia) pipeline
  • 💬 SMS — Receive and read inbound text messages
  • 🔌 MCP Server — Native Model Context Protocol support for Claude Desktop and Cursor
  • 📋 Skill File — One-file install for any AI agent (Claude Code, Cursor, OpenClaw)
  • 🌍 Multi-Provider — SignalWire (US) with pluggable provider architecture
  • 📝 Transcripts — Automatic call transcription with full conversation history
  • 📬 Event Mailbox — Poll-based event system for agents without webhook endpoints
  • 💰 Built-in Billing — Per-second call billing with balance tracking
  • 🐳 Docker Ready — One command to run the entire stack locally

graph LR
    A["🤖 AI Agent"] -->|REST API / MCP| B["⚡ AgentLine API"]
    B -->|Provision Numbers| C["📱 SignalWire"]
    B -->|Speech-to-Text| D["🎤 Deepgram"]
    B -->|Text-to-Speech| E["🔊 Cartesia"]
    B -->|LLM Reasoning| F["🧠 OpenAI"]
    C -->|Voice & SMS| G["📞 PSTN Network"]
    B -->|Events & Transcripts| A

Loading

Voice Pipeline — Hybrid Relay Mode

AgentLine uses an asynchronous Hybrid Relay architecture instead of fragile real-time WebSocket streams:

Caller dials your agent's number
  → SignalWire answers the call
  → Plays TTS greeting to caller
  → Records caller's speech
  → Deepgram transcribes (fast, accurate)
  → LLM generates agent response
  → Cartesia speaks the response
  → Loop continues until call ends
  → Full transcript stored for retrieval

Option 1: Docker Compose (Recommended)

git clone https://github.com/agentlineHQ/AgentLine.git
cd AgentLine
cp .env.example .env
# Fill in your API keys in .env (see Configuration below)
docker-compose up -d

This starts:

  • API server at http://localhost:8000
  • PostgreSQL at localhost:5432 (schema auto-applied)
  • Redis at localhost:6379

Option 2: Local Development

git clone https://github.com/agentlineHQ/AgentLine.git
cd AgentLine
python -m venv venv
source venv/bin/activate  # or venv\Scripts\activate on Windows
pip install -r requirements.txt
cp .env.example .env
# Fill in your API keys
uvicorn agentline.main:app --reload

Option 3: Use the Hosted Version

Skip self-hosting — sign up at agentline.cloud and get an API key instantly.


Copy .env.example to .env and fill in your credentials:

Variable Required Description
SUPABASE_URL Yes Your Supabase project URL
SUPABASE_ANON_KEY Yes Supabase anonymous key
SUPABASE_SERVICE_ROLE_KEY Yes Supabase service role key (server-side)
DATABASE_URL Yes PostgreSQL connection string
SIGNALWIRE_PROJECT_ID Yes SignalWire project ID
SIGNALWIRE_TOKEN Yes SignalWire API token
SIGNALWIRE_SPACE_URL Yes Your SignalWire space URL
DEEPGRAM_API_KEY Yes Deepgram API key (STT)
CARTESIA_API_KEY Yes Cartesia API key (TTS)
OPENAI_API_KEY Yes OpenAI API key (LLM)
REDIS_URL No Redis URL (defaults to localhost:6379)
SECRET_KEY Yes App secret key
BASE_URL Yes Public URL of your deployment

Once running, visit http://localhost:8000/docs for the interactive Swagger UI.

Method Path Description
POST /v1/agents Create a new AI voice agent
GET /v1/agents List all agents
PATCH /v1/agents/{id} Update agent (prompt, voice, greeting)
POST /v1/numbers Provision a phone number
GET /v1/numbers List phone numbers
POST /v1/calls Make an outbound call
GET /v1/calls List calls
GET /v1/calls/{id}/transcript Get call transcript
POST /v1/calls/{id}/hangup End an active call
GET /v1/events Poll event mailbox (consume)
GET /v1/events/peek Peek at events (non-destructive)
GET /v1/messages List SMS messages
GET /v1/billing/balance Check account balance
GET /v1/billing/expenditure Spending breakdown

All requests require an API key:

curl -H "Authorization: Bearer sk_live_YOUR_KEY" \
     -H "Content-Type: application/json" \
     https://api.agentline.cloud/v1/agents

AgentLine includes a built-in MCP (Model Context Protocol) server , so AI agents like Claude Desktop and Cursor can use telephony tools natively.

Connect from Claude Desktop

Add to your Claude Desktop config:

Windows: %APPDATA%\Claude\claude_desktop_config.json macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "agentline": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote@latest",
        "http://localhost:8000/mcp",
        "--header", "Authorization: Bearer sk_live_YOUR_KEY"
      ]
    }
  }
}
Tool Description
create_agent Create a new AI voice agent
list_agents List all agents
update_agent Update agent config/prompt/voice
make_outbound_call Initiate an outbound phone call
list_calls List call history
get_call_transcript Get the full transcript of a call
hangup_call End an active call
buy_phone_number Provision a new phone number
list_phone_numbers List all phone numbers
poll_events Poll event mailbox
peek_events Peek at pending events
get_account_balance Check account balance
list_available_voices List voice presets
npx @modelcontextprotocol/inspector http://localhost:8000/mcp

Skill File — Install in 30 Seconds

AgentLine ships with a skill file that lets any AI agent gain telephony powers instantly:

https://agentline.cloud/skill.md

How to use:

  1. Copy the skill URL above
  2. Add it to your AI agent (Claude Code, Cursor, OpenClaw, etc.)
  3. Set your AGENTLINE_API_KEY environment variable
  4. Tell your agent: "Call +1234567890" — it just works!

The skill file is also included in this repo at skills/agentline/SKILL.md.



docker build -t agentline .
docker run -p 8000:8000 --env-file .env agentline

AgentLine runs anywhere that supports Python 3.12+ and Docker: AWS, GCP, Azure, Fly.io, Render, Railway, etc.


The database schema is in schema.sql. It creates tables for:

  • accounts — User accounts with balance tracking
  • api_keys — Hashed API keys for authentication
  • agents — AI voice agent configurations
  • phone_numbers — Provisioned phone numbers
  • calls — Call records with transcripts
  • messages — SMS message records
  • event_mailbox — Server-side event queue
  • billing_ledger — Immutable billing transaction log

Migrations are in the migrations/ directory.


If using the hosted version at agentline.cloud:

Item Cost
Voice calls (inbound/outbound) $0.10/min (billed per second)
Phone number $2.00 (one-time)
SMS (inbound) Free

Self-hosted: you pay only your provider costs (SignalWire, Deepgram, Cartesia, OpenAI).


We welcome contributions! See CONTRIBUTING.md for guidelines.


Community

  • 💬 Discord — Chat with the team and other builders
  • 🐦 Twitter — Updates and announcements
  • 📖 Docs — Full API documentation
  • 📝 Blog — Guides and tutorials

MIT — use it for anything. Commercial use welcome.


Built with ❤️ by the AgentLine team

Give your AI agent a voice. ☎️