Skip to navigation

LangChain

Give your LangChain agent a real phone number. Make calls, send messages, buy numbers, and manage voice agents — all through the langchain-agentphone package.

Get your API key from agentphone.ai/settings. Tool calls and hosted voice do not require your own webhook server. For real-time inbound handling in your application, configure a webhook endpoint.

Installation

pip install "langchain-agentphone==0.1.0" "langchain>=0.3,<0.4" "langgraph>=0.6,<0.7" "langchain-anthropic>=0.3,<0.4"

Set your API key as an environment variable:

export AGENTPHONE_API_KEY="your_api_key_here"

langchain-agentphone 0.1.0 requires langchain-core<1. The example uses the compatible 0.3-era LangChain stack; it is not a LangChain 1.x example. For a project on current LangChain, connect the hosted MCP server using LangChain’s MCP integration instead of forcing incompatible dependency versions.

Configure credentials for the model provider separately (the example uses ANTHROPIC_API_KEY).

Setup

Using the toolkit

The AgentPhoneToolkit gives your agent access to all 12 LangChain tools at once. Use selected_tools to expose only the capabilities you need.

from langchain_agentphone import AgentPhoneToolkit
from langchain.chat_models import init_chat_model
from langgraph.prebuilt import create_react_agent
model = init_chat_model(
model="claude-sonnet-4-6",
model_provider="anthropic",
)
# All 12 tools
toolkit = AgentPhoneToolkit()
agent = create_react_agent(model, toolkit.get_tools())
response = agent.invoke({
"messages": [
("user", "List my agents and phone numbers without changing anything.")
]
})

Selecting specific tools

# Only messaging
toolkit = AgentPhoneToolkit(selected_tools=["send_sms"])
# Calls and transcripts
toolkit = AgentPhoneToolkit(
selected_tools=["make_call", "get_transcript", "list_calls"]
)

Importing individual tools

from langchain_agentphone import AgentPhoneSendSMS, AgentPhoneMakeCall
send_sms = AgentPhoneSendSMS()
make_call = AgentPhoneMakeCall()
agent = create_react_agent(model, [send_sms, make_call])

Use cases

  • Autonomous phone calls — have your agent call a number and hold a full AI conversation, then retrieve the transcript after the call ends
  • SMS messaging — send and receive texts, manage conversation threads across multiple numbers
  • Phone number management — provision numbers with specific area codes, assign them to agents
  • AI voice agents — create agents with configurable voices, system prompts, and model tiers that handle calls autonomously
  • Appointment reminders — pull schedules from a calendar API and text or call customers with reminders
  • Lead qualification — call new leads within seconds, qualify interest, and book meetings automatically

Available tools

The package provides 12 LangChain tools:

ToolDescription
AgentPhoneSendSMSSend a message to a phone number
AgentPhoneMakeCallMake an AI-powered phone call
AgentPhoneGetTranscriptGet the transcript for a completed call
AgentPhoneListCallsList recent calls
AgentPhoneListConversationsList SMS conversation threads
AgentPhoneGetConversationGet messages in a conversation
AgentPhoneBuyNumberBuy a phone number with a specific area code
AgentPhoneListNumbersList your phone numbers
AgentPhoneCreateAgentCreate an AI phone agent
AgentPhoneListAgentsList your phone agents
AgentPhoneCreateContactCreate a contact
AgentPhoneListContactsList your contacts

Every tool has a full Pydantic schema so your LLM knows exactly what arguments to pass.

Resources