Skip to content

Connect Amply to AI Agents: Monitor IPs and Scale Email Delivery

Learn how to connect Amply to AI agents using Truto to automate email delivery, monitor IP pools, and orchestrate DNS validations autonomously.

Uday Gajavalli Uday Gajavalli · · 6 min read
Connect Amply to AI Agents: Monitor IPs and Scale Email Delivery

To connect Amply to AI Agents, engineering teams need a predictable, machine-readable way to map its transactional email and deliverability infrastructure to function-calling LLMs. Whether you are building an internal DevOps assistant to monitor IP reputations or an autonomous script to provision new sending domains, translating the Amply API into LLM-compatible tools requires specific architectural choices.

This article is part of a broader set on AI integration patterns. If your team uses ChatGPT, check out our guide on connecting Amply to ChatGPT, or if you are working within Anthropic's ecosystem, read our guide on connecting Amply to Claude.

Below, we will explore the engineering realities of the Amply API, present the optimal tool inventory structure for LLM frameworks like LangChain or Vercel AI SDK, and show you how to orchestrate multi-step email operations.

The Engineering Reality of the Amply API

When you connect Amply to AI agents, you aren't just dealing with generic CRUD operations. You are orchestrating email deliverability infrastructure. This presents a few domain-specific challenges that your agentic framework must account for:

  1. Multi-Step Domain Verification Orchestration: Verifying a new sending domain in Amply is not a single API call. Your agent must first create the domain, then request the specific DNS challenge records (which return nested objects containing spf, dkim, whitelabel, and shared CNAME/TXT structures). The agent must then pause, rely on a separate tool to apply those records to your DNS provider (like Route53 or Cloudflare), and finally trigger the create_a_amply_verified_domain_validation endpoint. Your agent's system prompt must explicitly instruct it to wait for DNS propagation between these steps.
  2. Stateful IP and Pool Management: Amply treats IP addresses and IP pools as deeply linked relational entities. An IP address has a specific status, rdns (Reverse DNS) configuration, and an array of associated ip_pools. When your agent needs to isolate a poorly performing IP, it must first fetch the IP details, identify the pool ID, and update the pool assignments via the update endpoints. The agent needs full context of this relational model to avoid stranding an IP without a pool.
  3. Strict Rate Limit Passthrough: Truto does not automatically retry, throttle, or apply backoff logic to rate limit errors. When Amply returns an HTTP 429, Truto passes that error directly back to your agent. However, Truto does normalize the upstream rate limit information into standardized IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset). Your integration layer or LLM framework is strictly responsible for inspecting these headers and implementing backoff before allowing the agent to proceed.

Amply AI Agent Tool Inventory

To give your AI agent control over Amply, Truto provides a structured set of schemas via the /tools endpoint. We divide these into "Hero Tools" (the most commonly chained operations) and the full inventory.

Hero Tools for Amply

1. create_a_amply_email

Send a transactional email via Amply. The agent must supply a from object, personalizations (containing the recipient to addresses), and either raw content or a template UUID.

User prompt: "Send an email to user_123@example.com using the 'Welcome' template, from support@ourdomain.com."

2. get_single_amply_verified_domain_dns_challenge_by_id

Fetches the critical DNS challenge details required to authorize a verified domain. Returns the exact CNAME and TXT values needed for SPF, DKIM, and link whitelabeling.

User prompt: "Get the DNS records required to verify the domain 'marketing.acme.com' so I can update Route53."

3. create_a_amply_verified_domain_validation

Triggers the verification check on Amply's side once DNS records have been configured. This is the final step in the domain onboarding loop.

User prompt: "I just added the TXT records. Tell Amply to validate the domain 'marketing.acme.com'."

4. list_all_amply_ip_addresses

Lists all dedicated IP addresses in the Amply account. Crucial for monitoring deliverability status, reverse DNS settings, and seeing which IPs are currently enabled.

User prompt: "List all our Amply IP addresses and tell me if any are marked as disabled."

5. create_a_amply_monitor

Deploys a new deliverability monitor. The agent configures the type, detection_method, and alert_conditions to watch for spikes in bounces or spam complaints on specific IP pools.

User prompt: "Set up a new monitor on the 'Transactional' IP pool that alerts us if the bounce rate exceeds 2%."

For the complete tool inventory and full schema details, visit the Amply integration page.

Workflows in Action

Connecting Amply to AI agents unlocks high-velocity automation for IT admins and deliverability engineers. Here are two realistic workflows demonstrating how an agent chains these tools together.

Scenario 1: Automated Deliverability Incident Response

A DevOps engineer receives a generic alert that emails are bouncing and asks the agent to investigate.

"We are seeing bounce alerts on our main application. Check our Amply monitors, list the IPs in the affected pool, and tell me their current status."

Agent Execution Steps:

  1. Calls list_all_amply_monitors to find the monitor currently triggering the alert and identifies it tracks the 'App-Transactional' IP pool.
  2. Calls list_all_amply_ip_pools to find the exact ID of the 'App-Transactional' pool.
  3. Calls get_single_amply_ip_pool_by_id to retrieve the list of IP addresses assigned to that specific pool.
  4. Iterates through get_single_amply_ip_address_by_id for each IP to check their status and enabled flags.

Result: The agent replies with a concise report: "Monitor 'App Bounces' is active. The 'App-Transactional' pool contains 3 IPs. IP 192.0.2.4 is currently flagged with a degraded status. Would you like me to move it to a quarantine pool?"

Scenario 2: Zero-Touch Domain Onboarding

A marketing operations manager needs to set up a new subdomain for a specific campaign.

"Start the domain verification process for 'promo.ourbrand.com' and tell me the exact DNS records I need to give to the IT team."

Agent Execution Steps:

  1. Calls create_a_amply_verified_domain with the name promo.ourbrand.com to register it.
  2. Extracts the new domain ID from the response.
  3. Calls get_single_amply_verified_domain_dns_challenge_by_id using the domain ID to fetch the required CNAME and TXT values for SPF, DKIM, and link tracking.

Result: The agent outputs a neatly formatted table containing the exact hostnames and values required for IT to update the company's DNS provider, stopping execution until the user confirms the DNS is updated.

Building Multi-Step Workflows

To build autonomous loops, your integration layer must retrieve the schema from Truto, bind it to your LLM framework, and handle execution safely. Truto's /integrated-account/<id>/tools endpoint returns tool definitions formatted specifically for function calling.

Here is the architectural pattern for connecting Amply to an AI framework like LangChain or Vercel AI SDK.

1. Fetch and Bind Tools

Using the Truto SDK (e.g., TrutoToolManager from truto-langchainjs-toolset), fetch the tools for your connected Amply account.

import { TrutoToolManager } from 'truto-langchainjs-toolset';
import { ChatOpenAI } from '@langchain/openai';
 
// Initialize the manager with your Truto API key and Amply Account ID
const toolManager = new TrutoToolManager({
  apiKey: process.env.TRUTO_API_KEY,
  accountId: 'amply-account-123'
});
 
// Fetch the tool schemas dynamically
const amplyTools = await toolManager.getTools();
 
// Bind tools to the LLM
const llm = new ChatOpenAI({ modelName: 'gpt-4o' });
const agent = llm.bindTools(amplyTools);

2. Handling the 429 Rate Limit Reality

When executing tool calls in a loop, your agent might hit Amply's rate limits. Because Truto acts as a pure passthrough for these errors, you must intercept the tool execution phase to catch HTTP 429s.

Truto standardizes the headers, making it easy to calculate the exact sleep duration:

// Example of intercepting a tool execution failure within an agent loop
async function executeWithBackoff(toolCall, maxRetries = 3) {
  let attempt = 0;
  
  while (attempt < maxRetries) {
    try {
      const response = await invokeTool(toolCall);
      return response;
    } catch (error) {
      if (error.status === 429) {
        // Read Truto's normalized IETF headers
        const resetTimeSecs = parseInt(error.headers['ratelimit-reset'], 10);
        const sleepMs = resetTimeSecs * 1000;
        
        console.log(`Rate limit hit. Agent sleeping for ${resetTimeSecs} seconds...`);
        await new Promise(resolve => setTimeout(resolve, sleepMs));
        attempt++;
        continue;
      }
      throw error; // Throw non-rate-limit errors back to the agent
    }
  }
  throw new Error('Max retries exceeded for Amply tool execution');
}

By handling the normalized ratelimit-reset header in your execution code, you prevent the LLM from hallucinating retries or crashing the loop. The agent simply pauses, waits out the penalty box, and resumes managing your email infrastructure.

FAQ

How do I get Amply tools for my AI agent?
You can retrieve the complete list of Amply tool schemas by making a GET request to the Truto `https://api.truto.one/integrated-account//tools` endpoint. This returns definitions ready to be passed into frameworks like LangChain or Vercel AI SDK.
Does Truto handle Amply rate limits automatically?
No. Truto does not retry or absorb rate limits. When Amply returns an HTTP 429, Truto passes that directly to the caller, but standardizes the rate limit information into IETF headers (`ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset`). The caller must handle the retry and backoff logic.
Can an AI agent configure Amply DNS settings completely on its own?
The agent can use the Amply tools to generate the required CNAME and TXT records. However, applying those records to the internet requires a separate tool connected to your DNS provider (like AWS Route53 or Cloudflare) before the agent can trigger Amply's validation endpoint.

More from our Blog