Get 30% extra credits if you sign up todayends in --:--:--

Integrations / LangGraph

Give a LangGraph agent phone, SMS, and email tools

A LangGraph agent gets real-world reach with three tool functions. The Hail SDK is async-only, so the tools drop straight into an async graph. One key covers SMS, email, and voice.

01Install

The Hail Python SDK needs Python 3.11+. One API key works across all channels.

pip install hail-sdk
# .env
HAIL_API_KEY="hl_live_9fa2..."
pip install langgraph langchain

02Define the tools

Each tool wraps one SDK call. recipient_consent is required on every send. The API refuses a send without it, so consent stays a first-class argument in your agent code.

from langchain_core.tools import tool
from hail import Client

@tool
async def send_sms(to: str, body: str) -> str:
    """Text an opted-in recipient."""
    async with Client() as hail:  # reads HAIL_API_KEY
        sms = await hail.sms.create(
            to=to, body=body, recipient_consent=True,
        )
        return f"queued {sms['id']}"

@tool
async def send_email(to: str, subject: str, body_text: str) -> str:
    """Email a recipient from your Hail inbox."""
    async with Client() as hail:
        msg = await hail.emails.create(
            to=[to], subject=subject,
            body_text=body_text, recipient_consent=True,
        )
        return f"queued {msg['id']}"

03Bind them to the graph

The prebuilt ReAct agent picks the tool from the task. Calls work the same way with hail.calls.create.

from langgraph.prebuilt import create_react_agent

agent = create_react_agent(
    "anthropic:claude-sonnet-5",
    tools=[send_sms, send_email],
)
result = await agent.ainvoke(
    {"messages": [("user", "Text +14155550142 that order 4471 shipped")]}
)

04Hear the replies

Inbound SMS and email land on your webhook or the event stream, so the graph can resume with the human's answer.

async with Client() as hail:
    async for ev in hail.events.tail():
        if ev["type"] == "sms.received":
            # feed the reply back into the graph
            handle(ev)

Questions

Does the Hail SDK work with LangGraph's async graphs?

Yes. The SDK is async-only, so tools defined with async def drop into LangGraph without wrappers.

Can the LangGraph agent receive SMS replies?

Yes. Register a webhook for sms.received or tail the event stream, then resume the graph with the reply.

Do I need Twilio behind this?

No. Hail provides the number, carrier registration, and the email domain. One API key, pay per use.

Ship it with a real number

Sign up, grab a key, and the examples above run as written. Pay per use, no subscription.

Get started →

More frameworks

CrewAI · OpenAI Agents SDK · Vercel AI SDK · n8n · Claude