[PR #6795] Add Telnyx communication tools for LangGraph agents #5301

Closed
opened 2026-02-20 17:51:30 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/6795

State: closed
Merged: No


Summary

This PR adds Telnyx telephony tools for LangGraph agents, enabling AI agents to send SMS messages and make voice calls.

Tools Added

  • TelnyxSendSMS: Send SMS text messages via Telnyx API
  • TelnyxMakeCall: Make voice calls using Telnyx Call Control
  • TelnyxHangupCall: Hang up active voice calls

Features

  • Full LangChain BaseTool compatibility for seamless integration with ToolNode
  • Pydantic input schemas for proper parameter validation
  • Comprehensive error handling with user-friendly messages
  • Async support via _arun methods
  • Configurable via environment variables or constructor parameters

Usage Example

from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
from telnyx_tools import TelnyxSendSMS, TelnyxMakeCall

model = ChatOpenAI(model="gpt-4o")
tools = [TelnyxSendSMS(), TelnyxMakeCall()]
agent = create_react_agent(model, tools)

response = agent.invoke({
    "messages": [("user", "Send SMS to +15551234567 saying 'Hello from LangGraph!'")]
})

Prerequisites

Users need to set:

  • TELNYX_API_KEY: Their Telnyx API key
  • TELNYX_FROM_NUMBER: Their Telnyx phone number

Testing

All tools follow the existing LangGraph tool patterns and include:

  • Proper docstrings following LangChain conventions
  • Error handling for missing dependencies, credentials, and API errors
  • Input validation via Pydantic models

Documentation

Includes:

  • README.md with setup and usage instructions
  • agent_example.py demonstrating full integration
  • Inline documentation for all tool classes
**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6795 **State:** closed **Merged:** No --- ## Summary This PR adds Telnyx telephony tools for LangGraph agents, enabling AI agents to send SMS messages and make voice calls. ### Tools Added - **TelnyxSendSMS**: Send SMS text messages via Telnyx API - **TelnyxMakeCall**: Make voice calls using Telnyx Call Control - **TelnyxHangupCall**: Hang up active voice calls ### Features - Full LangChain BaseTool compatibility for seamless integration with ToolNode - Pydantic input schemas for proper parameter validation - Comprehensive error handling with user-friendly messages - Async support via `_arun` methods - Configurable via environment variables or constructor parameters ### Usage Example ```python from langgraph.prebuilt import create_react_agent from langchain_openai import ChatOpenAI from telnyx_tools import TelnyxSendSMS, TelnyxMakeCall model = ChatOpenAI(model="gpt-4o") tools = [TelnyxSendSMS(), TelnyxMakeCall()] agent = create_react_agent(model, tools) response = agent.invoke({ "messages": [("user", "Send SMS to +15551234567 saying 'Hello from LangGraph!'")] }) ``` ### Prerequisites Users need to set: - `TELNYX_API_KEY`: Their Telnyx API key - `TELNYX_FROM_NUMBER`: Their Telnyx phone number ## Testing All tools follow the existing LangGraph tool patterns and include: - Proper docstrings following LangChain conventions - Error handling for missing dependencies, credentials, and API errors - Input validation via Pydantic models ## Documentation Includes: - README.md with setup and usage instructions - agent_example.py demonstrating full integration - Inline documentation for all tool classes
yindo added the pull-request label 2026-02-20 17:51:30 -05:00
yindo closed this issue 2026-02-20 17:51:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#5301