Metadata-Version: 2.4
Name: dial-langchain
Version: 0.6.0
Summary: Official Dial LangChain tools — phone numbers, SMS, WhatsApp, and voice calls for AI agents
Requires-Python: >=3.11
Requires-Dist: dial-sdk
Requires-Dist: langchain-core>=0.2
Description-Content-Type: text/markdown

# dial-langchain

Official [LangChain](https://www.langchain.com/) tools for [Dial](https://getdial.ai) — phone numbers, SMS, WhatsApp, and AI voice calls for AI agents.

## Install

```bash
pip install dial-langchain
# or
uv add dial-langchain
```

This pulls in [`dial-sdk`](https://pypi.org/project/dial-sdk/) and `langchain-core` automatically. Requires Python 3.11+.

## Quickstart

The quickest way is `DialToolkit` — construct it once with your API key and call `get_tools()` to hand an agent the full set, no per-tool imports:

```python
from dial_langchain import DialToolkit
from langchain.chat_models import init_chat_model
from langgraph.prebuilt import create_react_agent

model = init_chat_model("claude-sonnet-4-6", model_provider="anthropic")

toolkit = DialToolkit(api_key="sk_live_...")
agent = create_react_agent(model, toolkit.get_tools())
```

`DialToolkit` is a standard LangChain [`BaseToolkit`](https://python.langchain.com/api_reference/core/tools/langchain_core.tools.base.BaseToolkit.html), so `get_tools()` works anywhere a list of tools is expected. It also accepts an optional `base_url` (defaults to `https://getdial.ai`; override it for local or self-hosted setups).

### Pick individual tools

When you only want a subset, import the tools directly and hand them to the agent yourself. Each Dial capability is a LangChain `BaseTool`:

```python
from dial_langchain import (
    ListNumbersTool,
    SendMessageTool,
    MakeCallTool,
    ListCallsTool,
    GetCallTool,
    WaitForMessageTool,
)

tools = [
    ListNumbersTool(api_key="sk_live_..."),
    SendMessageTool(api_key="sk_live_..."),
    MakeCallTool(api_key="sk_live_..."),
]

# Drop into any LangChain agent:
from langchain.agents import create_react_agent
agent = create_react_agent(model, tools, prompt)
```

The tools are async — LangChain calls them via `ainvoke`.

## Available tools

| Tool | Tool name (for the LLM) |
| --- | --- |
| `ListNumbersTool` | `list_numbers` |
| `PurchaseNumberTool` | `purchase_number` |
| `SetNumberPropertiesTool` | `set_number_properties` |
| `ListMessagesTool` | `list_messages` |
| `SendMessageTool` | `send_message` |
| `ListCallsTool` | `list_calls` |
| `MakeCallTool` | `make_call` |
| `GetCallTool` | `get_call` |
| `WaitForMessageTool` | `wait_for_message` |

Each tool wraps the corresponding [`dial-sdk`](https://pypi.org/project/dial-sdk/) call under the hood. `DialToolkit.get_tools()` returns all of them.

## Related

- [`dial-sdk`](https://pypi.org/project/dial-sdk/) — the underlying async Python SDK.
- [Documentation](https://docs.getdial.ai)
