Skip to content

Connect Bland to AI Agents: Unified Phone, SMS & Voice Tools

Learn how to connect Bland to AI agents using Truto's unified tools. Build autonomous workflows that execute calls, clone voices, and manage SMS without custom API code.

Uday Gajavalli Uday Gajavalli · · 10 min read

You want to connect Bland to an AI agent so your system can independently orchestrate voice calls, trigger conversational pathways, manage SMS campaigns, and clone custom voices based on context. Here is exactly how to do it using Truto's /tools endpoint and SDK, bypassing the need to manually build custom API wrappers or state machines for asynchronous telecommunications tasks.

Giving a Large Language Model (LLM) read and write access to your telecommunication stack is an engineering headache. You either spend weeks building, hosting, and maintaining a custom connector that understands Bland's specific async patterns and voice constraints, or you use a managed infrastructure layer that handles the boilerplate for you. If your team uses ChatGPT, check out our guide on connecting Bland to ChatGPT, or if you are building on Anthropic's models, read our guide on connecting Bland to Claude. For developers building custom autonomous workflows, you need a programmatic way to fetch these tools and bind them to your agent framework.

This guide breaks down exactly how to fetch AI-ready tools for Bland, bind them natively to an LLM using LangChain (or any framework like LangGraph, CrewAI, or Vercel AI SDK), and execute complex communications workflows. For a deeper look at the architecture behind this approach, refer to our research on architecting AI agents and the SaaS integration bottleneck.

Why a Unified Tool Layer Matters for Agent Safety

Before writing a line of integration code, decide what layer your agent talks to. This choice determines how safe your production system will be.

Direct API tools (one tool per raw Bland endpoint) look convenient, but they push provider-specific telecommunications quirks directly into the LLM's context window. The model has to remember that pathways are asynchronous, that specific fields require strict E.164 formats, and that different voice engines handle audio payloads differently. Every one of those quirks is a hallucination waiting to happen.

A unified tool layer collapses these complexities behind strict, deterministic schemas. Your agent sees simple capabilities like bland_calls_send_simple_pathway, bland_voices_clone, and bland_pathways_generate - not raw multipart-form binary upload endpoints or obscure polling interfaces. That gives you four concrete safety wins:

  1. Smaller attack surface for hallucination. The LLM only ever chooses from stable function names. It never invents non-existent payload structures or hallucinates E.164 formatting logic.
  2. Deterministic input validation. Every tool has a strict JSON schema. Invalid arguments are rejected before they hit Bland's servers, so a broken tool call fails fast instead of creating a ghost call or hanging an SMS thread.
  3. Centralized authentication context. The agent never sees bearer tokens or API keys. It just requests the action, and the proxy layer routes it securely.
  4. Standardized error handling. Downstream 400 and 500 errors are parsed predictably, allowing the agent to understand exactly why a call failed and attempt an immediate correction.

The Engineering Reality of Custom Bland Connectors

Building AI agents is easy. Connecting them to external SaaS APIs is hard. Giving an LLM access to external communications data sounds simple in a prototype. You write a Node.js function that makes a fetch request and wrap it in an @tool decorator. In production, this approach collapses entirely, especially with an ecosystem as complex as Bland AI.

If you decide to integrate Bland yourself, you own the entire API lifecycle. Bland's API introduces several highly specific integration challenges that break standard LLM assumptions.

The Asynchronous Generation Trap

Bland relies heavily on asynchronous generation for complex assets like conversational pathways. When an agent needs to create a new pathway via bland_pathways_generate, it cannot simply wait for a synchronous JSON response containing the final pathway. It receives a jobId instead. If you hardcode this, you must explicitly prompt the LLM to understand that it has to take that jobId and repeatedly call bland_pathways_get_generation_status until the ready flag is true. LLMs are notoriously bad at arbitrary polling loops - they tend to either poll infinitely without delay or hallucinate the final result before the job completes.

Complex Audio Lifecycle Constraints

Voice cloning in Bland is not a simple file upload. The rules change depending on the underlying voice engine (BTTS V1 vs V2/V3). For example, V2 and V3 engines require exactly one audio file of roughly 10 seconds, capped at 10 MB, and cannot accept additional training samples later. V1 voices can accept up to 5 appended samples later. Exposing this raw endpoint to an LLM means the model has to correctly reason about which engine version it is using and validate file size and count constraints in its head. When it gets this wrong, the API rejects the request, and the agent enters a failure loop.

Call State and Transfer Logic

Agents orchestrating live phone workflows often attempt to issue commands to calls that are not in the correct state. For instance, transferring a call (bland_calls_transfer_active) only works if the call is currently in the queue_status of started. LLMs often try to transfer calls that are still in queued status or have already completed. Without a protective schema layer, these state mismatches crash the agent loop entirely.

Fetching and Binding Bland Tools to Agents

To give your AI agent access to Bland without building these custom endpoints, you use Truto's /tools API.

Every integration on Truto is essentially a comprehensive JSON object that represents how an underlying product's API behaves. Integrations have Resources (like calls, voices, pathways), which map to the endpoints on the underlying product's API. Every Resource has Methods defined on them (List, Get, Create, Update, Delete, custom actions).

These Methods serve as Proxy APIs. Truto handles the pagination, authentication, and query parameter processing, and provides a description and schema for all of them. By calling GET https://api.truto.one/integrated-account/<id>/tools, you receive all of these Proxy APIs formatted perfectly for LLM tool binding.

Here is how you initialize this in a TypeScript environment using LangChain:

import { ChatOpenAI } from "@langchain/openai";
import { TrutoToolManager } from "truto-langchainjs-toolset";
import { AgentExecutor, createOpenAIToolsAgent } from "langchain/agents";
 
// 1. Initialize the LLM
const llm = new ChatOpenAI({
  modelName: "gpt-4o",
  temperature: 0,
});
 
// 2. Fetch the tools for the specific Bland integrated account
const trutoManager = new TrutoToolManager({
  trutoApiKey: process.env.TRUTO_API_KEY,
  integratedAccountId: "bland-account-uuid",
});
 
// 3. Bind the tools to the LLM
const tools = await trutoManager.getTools();
const llmWithTools = llm.bindTools(tools);
 
// 4. Create the agent executor
const agent = await createOpenAIToolsAgent({
  llm,
  tools,
  prompt: customPromptTemplate,
});
 
const executor = new AgentExecutor({
  agent,
  tools,
});

Building Multi-Step Workflows

Autonomous agents shine when they chain multiple operations together to solve a complex goal. However, chaining API calls means you must account for rate limits.

A critical architectural note: Truto does not retry, throttle, or apply backoff on rate limit errors. When an upstream API returns HTTP 429, Truto passes that error to the caller. Truto normalizes upstream rate limit info into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF spec. The caller is responsible for retry and backoff logic.

Here is a complete LangGraph implementation showing a multi-step execution loop that safely catches rate limits, backs off, and retries the tool call:

import { StateGraph, MessagesAnnotation } from "@langchain/langgraph";
import { ToolNode } from "@langchain/langgraph/prebuilt";
import { TrutoToolManager } from "truto-langchainjs-toolset";
 
const buildBlandAgent = async () => {
  const manager = new TrutoToolManager({
    trutoApiKey: process.env.TRUTO_API_KEY,
    integratedAccountId: "bland-account-uuid",
  });
  
  const tools = await manager.getTools();
  const toolNode = new ToolNode(tools);
 
  // Define the LLM node with explicit error handling for HTTP 429
  const callModel = async (state: typeof MessagesAnnotation.State) => {
    try {
      const response = await llmWithTools.invoke(state.messages);
      return { messages: [response] };
    } catch (error: any) {
      if (error.status === 429) {
        // Read the standardized ratelimit-reset header passed by Truto
        const resetTime = parseInt(error.headers['ratelimit-reset'] || '1', 10);
        console.warn(`Rate limited. Backing off for ${resetTime} seconds.`);
        await new Promise(resolve => setTimeout(resolve, resetTime * 1000));
        // Retry logic could be implemented here or deferred to the supervisor node
        return { messages: [{ role: "system", content: "Rate limit hit, execution delayed." }]};
      }
      throw error;
    }
  };
 
  const workflow = new StateGraph(MessagesAnnotation)
    .addNode("agent", callModel)
    .addNode("tools", toolNode)
    .addEdge("__start__", "agent")
    .addConditionalEdges("agent", (state) => {
      const lastMessage = state.messages[state.messages.length - 1];
      return lastMessage.tool_calls?.length ? "tools" : "__end__";
    })
    .addEdge("tools", "agent");
 
  return workflow.compile();
};

The Architecture of the Tool Call

When your agent executes a tool, the request flows through the Proxy API layer, ensuring the exact schema expected by Bland is delivered.

sequenceDiagram
    participant Agent as AI Agent
    participant LangChain as Agent Framework
    participant Truto as Truto Proxy Layer
    participant Bland as Bland API

    Agent->>LangChain: Decides to call "bland_calls_send_simple_pathway"
    LangChain->>Truto: POST /proxy/bland/calls (normalized payload)
    Truto->>Bland: POST /v1/calls (provider-specific payload)
    
    alt Rate Limit Exceeded
        Bland-->>Truto: HTTP 429 Too Many Requests
        Truto-->>LangChain: HTTP 429 + ratelimit-reset Header
        LangChain-->>Agent: Error: Caller must apply backoff
    else Success
        Bland-->>Truto: HTTP 200 OK {call_id}
        Truto-->>LangChain: Normalized JSON Response
        LangChain-->>Agent: Formatted Tool Message
    end

Hero Tools for Bland AI Agents

Below are the highest-leverage tools exposed via the Truto integration that give your agents control over the Bland platform.

Send a Pathway Call

bland_calls_send_simple_pathway

Triggers an outbound call using a specific conversational pathway to guide the interaction. This is the primary mechanism for executing predefined voice workflows. Always ensure the phone number is provided in strict E.164 format.

"Send an outbound call to +15550198372 using the 'Overdue Invoice Collection' pathway ID. Return the resulting call_id so we can track its status."

Analyze a Completed Call

bland_calls_analyze

Analyzes a completed call using AI against a specific goal and a set of questions. The agent provides an array of questions and expected answer types. This is essential for autonomously scoring lead qualification calls or QAing support calls without human intervention.

"Analyze call_id 9a8b7c6d with the goal of 'Determine if the prospect is interested in our enterprise tier.' Ask if they mentioned a timeline, and if they agreed to a follow-up meeting."

Generate a Pathway via Prompt

bland_pathways_generate

Queues the generation of a new conversational pathway from a natural language prompt. Because this operation is asynchronous, the agent receives a jobId that it must subsequently use with the generation status tool to retrieve the finalized pathway.

"Generate a new customer support pathway for resetting passwords. The prompt is: 'You are a helpful IT agent. First, ask for the user's employee ID. Then, verify their manager's name. If successful, confirm the reset link was sent.'"

Clone a Custom Voice

bland_voices_clone

Clones a voice using provided audio samples. The agent passes the desired voice name and the raw or base64-encoded audio samples. This allows dynamic creation of distinct personas for different outreach campaigns.

"Clone a new voice called 'Technical Support Lead' using the provided 10-second WAV audio sample. Ensure the gender is set to female."

Create or Retrieve Contact Memory

bland_memory_create_contact_memory

Fetches or initializes the AI memory for a specific contact, scoped to a persona. This memory persists facts, recent messages, and open items across multiple calls and SMS threads, allowing the voice agent to remember previous conversations.

"Retrieve the contact memory for contact_id 12345 communicating with the 'Sales Engineer' persona so I can review what was discussed on their last call before we dial them again."

Retrieve SMS Conversation Webhooks

bland_sms_conversations_get_webhook

Retrieves the post-conversation webhook data for an SMS thread. When building omni-channel agents, this tool allows the LLM to inspect the final disposition of an SMS conversation and route the data into a CRM.

"Fetch the post-conversation webhook payload for SMS conversation ID 'sms_998877' to see if the user confirmed their appointment time via text."

For the complete inventory of available endpoints, schemas, and parameter requirements, refer to the Bland integration page.

Workflows in Action

AI agents provide the most value when executing multi-step operations that traditionally required a human clicking through a dashboard. Here is how agents utilize the tools above in the real world.

Scenario 1: Autonomous Lead Qualification and Handoff

Persona: Revenue Operations Engineer

"Find the contact memory for John Doe. If there are no open objections, trigger the 'Enterprise Discovery' pathway call to his number. Once the call finishes, analyze the transcript to see if he agreed to a demo. If he did, update his contact facts with the demo date."

  1. bland_memory_get_contact_memory: The agent fetches the contact's historical memory to verify previous interactions and ensure they aren't being double-dialed.
  2. bland_calls_send_simple_pathway: The agent executes the outbound call using the specified pathway ID, receiving a call_id back.
  3. bland_calls_analyze: After polling for completion, the agent analyzes the call recording specifically asking, "Did the user agree to a demo?"
  4. bland_memory_update_facts: Based on the analysis, the agent writes structured facts back to the contact's memory, ensuring the next AI or human agent has total context.

Scenario 2: Dynamic Pathway Generation and Testing

Persona: Voice Application Developer

"I need to test a new IVR flow. Generate a pathway for handling billing disputes. Poll the status until it is ready, then immediately initiate a live listen session on a test call so I can hear the result."

  1. bland_pathways_generate: The agent submits the prompt to generate the new pathway and receives a jobId.
  2. bland_pathways_get_generation_status: The agent loops (using its internal backoff logic) until the ready status returns true, capturing the newly minted pathway_id.
  3. bland_calls_send_simple_pathway: The agent initiates a test call to the developer's registered test number.
  4. bland_calls_listen: The agent requests a live listen WebSocket URL for the active call and returns it to the user so they can stream the audio in real-time.

Building for Production

Connecting an AI agent to Bland is fundamentally about managing complexity. Raw API integration forces your LLM to become an expert in telecommunications constraints, asynchronous polling intervals, and audio file chunking.

By leveraging a unified tool layer and Proxy APIs, you strip away the transport and formatting logic, leaving the LLM to do what it does best: orchestrating logic and making decisions based on clean, deterministic JSON schemas. Keep your rate limit handling robust, ensure strict parameter validation, and let the agent framework handle the execution.

FAQ

How does an AI agent interact with Bland's asynchronous pathways?
Agents must use the `bland_pathways_generate` tool to receive a jobId, and then execute a polling loop using the `bland_pathways_get_generation_status` tool until the pathway is marked as ready.
Does Truto automatically handle Bland API rate limits for my agent?
No. Truto passes HTTP 429 errors directly back to the caller alongside standardized IETF rate limit headers (ratelimit-reset, etc.). The agent's execution framework is responsible for handling the backoff and retry logic.
Can I use these tools with Vercel AI SDK or CrewAI?
Yes. Truto's `/tools` endpoint returns standard JSON schemas that can be adapted and bound to any LLM framework, including LangChain, LangGraph, CrewAI, and the Vercel AI SDK.
How does the unified tool layer improve LLM reliability?
It provides strict, deterministic JSON schemas and collapses complex telecommunications quirks (like E.164 formats and async states) into simple function calls, drastically reducing the LLM's surface area for hallucination.

More from our Blog