Skip to content

Connect Puzzel to AI Agents: Automate SMS, Email, and Call Logs

Learn how to connect Puzzel to AI agents using Truto's tools endpoint to autonomously orchestrate SMS, email follow-ups, and contact center call logs.

Uday Gajavalli Uday Gajavalli · · 9 min read
Connect Puzzel to AI Agents: Automate SMS, Email, and Call Logs

You want to connect Puzzel to an AI agent so your system can autonomously monitor call queues, extract call logs, and execute automated SMS and email follow-ups based on real-time contact center activity. Here is exactly how to do it using Truto's /tools endpoint and SDK, bypassing the need to build and maintain a custom integration from scratch.

The contact center industry is shifting rapidly. Static IVR menus and rigid routing rules are being replaced by agentic AI - autonomous systems that sit alongside your human agents, reading queue states and executing multi-step workflows across your tech stack. If your team uses ChatGPT, check out our guide on connecting Puzzel to ChatGPT, and if you are building on Anthropic's models, read our guide on connecting Puzzel to Claude. For developers building custom autonomous workflows, you need a programmatic way to fetch Puzzel tools and bind them directly to your agent framework.

Giving a Large Language Model (LLM) read and write access to your Puzzel instance is a massive engineering headache. You either spend months building, hosting, and maintaining a custom connector that deals with the nuances of contact center state management, or you use a managed infrastructure layer that handles the boilerplate for you.

This guide breaks down exactly how to fetch AI-ready tools for Puzzel, bind them natively to an LLM using frameworks like LangChain, LangGraph, CrewAI, or Vercel AI SDK—addressing the core SaaS integration bottleneck when architecting AI agents—and execute complex omnichannel workflows.

The Engineering Reality of Puzzel's API

Building AI agents is easy. Connecting them to external SaaS APIs is hard.

Giving an LLM access to external 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. If you decide to build a custom integration for Puzzel, you own the entire API lifecycle.

Puzzel is an omnichannel contact center platform. Its API is not a simple CRUD interface for database records; it is a highly stateful, real-time reflection of phone calls, chat queues, and agent availability. This introduces several specific integration challenges that break standard LLM assumptions.

The Complexity of Real-Time State and Tickers

Standard APIs operate on static records (like fetching a user profile). Puzzel relies heavily on tickers and real-time state endpoints. When an agent needs to know how many calls are waiting, it doesn't query a static database table; it queries an access point ticker for a specific ticker_period_window. LLMs struggle with time-bound, stateful data. If you do not perfectly enforce the schema for these ticker queries, your AI agent will hallucinate queue lengths or request data using invalid time windows, causing the Puzzel API to reject the request.

Session and User Context Switching

Puzzel's architecture requires strict adherence to user and session contexts. Many critical endpoints require a user_id, and sometimes an iq_session_id, just to perform basic tasks like reserving a request or downloading a call recording. If an AI agent attempts to reserve a user request without the correct internal ID mappings, the API will throw a 400-level error. Hardcoding these relationships in standard API integrations is brittle; the LLM needs explicitly defined tools that enforce these dependencies before the network request is ever made.

Strict Rate Limits and The 429 Problem

Puzzel enforces strict rate limits to protect its real-time contact center infrastructure. If your AI agent gets stuck in a loop - perhaps aggressively polling a visual queue to see if a VIP caller has connected - Puzzel will quickly return an HTTP 429 Too Many Requests error.

It is a critical factual note that Truto does not automatically retry, throttle, or apply exponential backoff when an upstream API throws a rate limit error. For a broader look at this challenge, see our guide on how to handle third-party API rate limits when an AI agent is scraping data. When Puzzel returns an HTTP 429, Truto passes that error directly to the caller. However, Truto does the heavy lifting of normalizing Puzzel's specific rate limit information into standardized HTTP headers per the IETF specification (ratelimit-limit, ratelimit-remaining, ratelimit-reset).

Your agent execution loop is strictly responsible for catching the 429 error, reading the ratelimit-reset header, and pausing execution. If you build this integration yourself, you have to write custom logic to parse Puzzel's specific rate limit format before you can even implement backoff.

Generating AI-Ready Puzzel Tools

To bridge the gap between Puzzel's complex API and your LLM, Truto maps Puzzel's endpoints into standardized resources and methods, creating Proxy APIs. Truto then exposes these as tool definitions via the /tools endpoint.

By calling GET https://api.truto.one/integrated-account/<id>/tools, you retrieve a comprehensive JSON array of tools, complete with descriptions and strictly typed JSON schemas for every supported Puzzel operation.

This completely eliminates the need to manually write and maintain JSON schemas for Puzzel's endpoints. When Puzzel updates its API, Truto updates the schema, and your AI agent automatically receives the new definition on its next execution cycle.

Hero Tools for Puzzel Workflows

When connecting Puzzel to your agent framework, you do not need to expose every single endpoint. You should equip your agent with high-leverage tools that enable specific business outcomes. Here are the most critical "hero tools" to bind to your LLM for contact center automation.

Create a Puzzel SMS (create_a_puzzel_sm)

SMS is a critical channel for immediate customer follow-up. This tool allows the AI agent to autonomously dispatch SMS messages directly through Puzzel's infrastructure. It requires the agent's user_id and the message payload. This is vital for workflows where a caller abandons the queue and the system needs to immediately reach out to retain them.

"Send an SMS to +15550199344 acknowledging their missed call and offering a callback time between 2 PM and 4 PM."

Send a Puzzel Email (create_a_puzzel_user_email)

For longer-form communication, such as sending post-call summaries, ticket updates, or compliance documents, the agent needs to send emails via the Puzzel platform. This tool formats and dispatches the email using the integrated account's configuration, ensuring the communication remains tied to the official support thread.

"Draft and send an email to the client we just spoke with, summarizing the three action items we agreed upon regarding their account migration."

List User Call Logs (list_all_puzzel_user_call_logs)

Before an agent can make an intelligent decision about routing or follow-up, it needs historical context. This tool retrieves the last 20 request logs for a specific user, exposing the queue name, access point, media type, answered time, and crucial metrics like speakTimeSeconds. When dealing with larger datasets, you must consider how to feed paginated SaaS API results to AI agents without blowing up context.

"Pull the call logs for agent ID 4591 for today and identify any calls where the speak time exceeded 15 minutes."

List Missed Calls (list_all_puzzel_missed_calls)

Missed calls are lost revenue or churn risks. This tool allows the AI agent to search for missed calls within a specific queue, retrieving the caller's destination, how long they waited in the queue before abandoning, and whether the call has been tagged for follow-up by another representative.

"Check the 'Enterprise Escalation' queue for any missed calls in the last two hours that waited longer than 5 minutes."

Reserve User Requests (puzzel_user_requests_reserve)

In a contact center, tasks (like an email response or a callback) sit in queues until an agent reserves them. This tool allows the AI agent to explicitly reserve a specific request for a specific user, effectively assigning the task and updating the Puzzel state to prevent duplicate work by human agents.

"Reserve request ID 88473 in the personal queue so we can process the password reset manually."

Create a Scheduled Task (create_a_puzzel_scheduled_task)

Often, a workflow requires future action - like calling a customer back next Tuesday. This tool allows the AI agent to insert a scheduled task directly into the Puzzel system, defining the contact ID, phone number, scheduled date and time, and the specific queue it should be routed to.

"Create a scheduled task to call back contact ID 1093 on Thursday at 10:00 AM on the 'Technical Support' queue."

To view the complete inventory of available tools, query parameters, and schema definitions, visit the Puzzel integration page.

Building Multi-Step Workflows

To build a reliable AI agent, you must construct a robust execution loop. When using frameworks like LangChain, LangGraph, or the Vercel AI SDK, you will use Truto's SDK (e.g., TrutoToolManager from truto-langchainjs-toolset) to fetch the tools and bind them to your model.

The real engineering challenge lies in handling the execution loop, particularly around rate limits. As mentioned earlier, Truto does not absorb rate limit errors. You must build your loop to respect the IETF standard headers.

Here is a conceptual example of how to handle tool execution and rate limit backoff in a custom agent loop using TypeScript:

import { ChatOpenAI } from "@langchain/openai";
import { TrutoToolManager } from "truto-langchainjs-toolset";
 
async function runPuzzelAgent(prompt: string, integratedAccountId: string) {
  const llm = new ChatOpenAI({ modelName: "gpt-4o", temperature: 0 });
  
  // 1. Fetch Puzzel tools from Truto
  const toolManager = new TrutoToolManager({
    apiKey: process.env.TRUTO_API_KEY,
  });
  const tools = await toolManager.getTools(integratedAccountId);
  
  // 2. Bind tools to the LLM
  const llmWithTools = llm.bindTools(tools);
  
  let currentMessage = prompt;
  let executionComplete = false;
 
  while (!executionComplete) {
    try {
      // 3. Invoke the LLM
      const response = await llmWithTools.invoke(currentMessage);
      
      if (response.tool_calls && response.tool_calls.length > 0) {
        // 4. Execute tool calls
        for (const toolCall of response.tool_calls) {
            console.log(`Executing Puzzel Tool: ${toolCall.name}`);
            const tool = tools.find(t => t.name === toolCall.name);
            
            // Execute the tool
            const toolResult = await tool.invoke(toolCall.args);
            
            // Feed result back into the context
            currentMessage += `\nTool ${toolCall.name} returned: ${JSON.stringify(toolResult)}`;
        }
      } else {
        // No more tool calls, workflow complete
        console.log("Agent finished:", response.content);
        executionComplete = true;
      }
    } catch (error) {
      // 5. Handle Rate Limits Explicitly
      if (error.response && error.response.status === 429) {
        const resetTime = error.response.headers.get('ratelimit-reset');
        const delay = resetTime ? (parseInt(resetTime) * 1000) - Date.now() : 5000;
        
        console.warn(`Puzzel Rate Limit hit. Pausing execution for ${delay}ms...`);
        await new Promise(resolve => setTimeout(resolve, Math.max(delay, 1000)));
        // Loop will continue and retry the last state
      } else {
        console.error("Fatal API Error:", error);
        throw error;
      }
    }
  }
}

This loop ensures that your agent can chain multiple actions together while safely respecting Puzzel's upstream infrastructure.

Workflows in Action

When you equip an AI agent with Puzzel tools, you unlock autonomous workflows that previously required a team of human supervisors. Here are two concrete examples of multi-step workflows in action.

Scenario 1: Missed Call Triage and SMS Follow-Up

Persona: Support Operations Lead

"Check the VIP Support queue for missed calls in the last hour. If any caller waited longer than 3 minutes before dropping, text them immediately to apologize and offer a callback."

Step-by-step execution:

  1. The agent calls list_all_puzzel_missed_calls, passing the queue ID for "VIP Support".
  2. It filters the returned JSON array for calls where inQueueSeconds is greater than 180.
  3. For each matching record, it extracts the destination (the caller's phone number).
  4. The agent iterates through the list, calling create_a_puzzel_sm for each number, generating a personalized apology and callback offer.

The Result: The system autonomously runs a triage operation, catching high-value customers who abandoned the queue and proactively engaging them via SMS, reducing churn without human intervention.

Scenario 2: Call Log Audit and Email Reporting

Persona: Quality Assurance Manager

"Review the call logs for agent 5092 for today. Find the longest call they took, summarize the call context if available, and send an email report to the QA manager with the details."

Step-by-step execution:

  1. The agent calls list_all_puzzel_user_call_logs, passing the target user_id.
  2. It sorts the returned payload by speakTimeSeconds to isolate the longest interaction.
  3. It extracts the requestId, queueName, and answeredAt timestamps.
  4. The agent calls create_a_puzzel_user_email, formatting a structured report containing the call details and dispatching it to the QA team's address.

The Result: A time-consuming manual QA process is reduced to a single prompt, with the LLM fetching the data, analyzing the metrics, and utilizing Puzzel's native email system to deliver the report.

Strategic Wrap-Up

Connecting AI agents to Puzzel unlocks massive operational efficiency, but the integration layer is a trap for engineering teams. Attempting to manage contact center session states, strict rate limits, and custom API schemas manually will drain your team's resources and lead to brittle agents that fail in production.

By leveraging Truto's /tools endpoint, you bypass the infrastructure build completely. You get auto-updating schemas, standardized rate limit normalization, and immediate access to high-leverage operations like SMS dispatch, email routing, and queue management.

Stop building custom REST clients for every LLM project. Focus your engineering effort on designing better agent logic and prompting strategies, and let a unified API handle the SaaS complexity.

FAQ

How does Truto handle Puzzel API rate limits for AI agents?
Truto does not automatically retry or throttle requests. It passes HTTP 429 errors directly to your agent while normalizing Puzzel's rate limit data into standard IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) so your framework can handle backoff.
Do I need to manually update JSON schemas for Puzzel API changes?
No. By using Truto's /tools endpoint, your AI framework dynamically fetches the latest structured JSON schemas for Puzzel endpoints on every execution cycle, eliminating schema drift.
Can an AI agent send SMS and emails directly through Puzzel?
Yes. By binding tools like create_a_puzzel_sm and create_a_puzzel_user_email to your LLM, the agent can autonomously dispatch messages using Puzzel's native omnichannel infrastructure.

More from our Blog