At cloudnaut we build outbound AI voice agents on Amazon Connect for business-to-business follow-up calls. To keep the work we deliver confidential, this post uses an illustrative scenario: a commercial equipment-rental business that calls its business customers about contracts nearing the end of their term. The scenario is invented. The architecture, problems and measurements come from our real delivery work.

The agent runs on Amazon Connect outbound campaigns, Amazon Lex V2 and Amazon Q in Connect AI agents, all defined in AWS CDK and deployed by a pipeline.

Why business follow-up calls are a hard fit for voice AI

The agent places the call, the person who answers may not be the person we want, and one phone number can have several rental records of two kinds. For a contract ending, the customer either extends or returns the equipment, so the agent captures an extension or a return date and reads any quoted rate or pro-rata amount exactly. For a return already logged, the depot has recorded equipment back but not matched it to a contract, so the agent states the return and asks which contracts it covers. One call might cover four contracts ending and one logged return, each needing its own outcome.

Recording redaction stays on. A voicemail carries no name, amount or contract detail. Without confirmed identity, the call ends with no account detail. The agent cannot take a payment, send a link or change contract data.

Nor is there room for invented numbers. On early live calls our model spoke an amount that was not on the record, guessed the "next" contract number by continuing a pattern, and named the wrong weekday for a date. Most of the design below follows from that.

Architecture

Architecture of the outbound voice agent: ingestion, dialling, call handling and post-call processing

View / edit diagram source ↗

Data in and the dial sweep

Rental records arrive from an upstream table as a change stream. A sync Lambda normalises them into a DynamoDB tracking table partitioned by phone number, tagging each record as a contract ending or a logged return. Records with nothing left to act on are never presented.

An EventBridge schedule runs a dial sweep that upserts one Customer Profile per phone number and sets its dial status to QUEUED. When several profiles share a phone, only the oldest is queued, so each handset is dialled once.

Outbound campaigns

The campaign is an agentless Amazon Connect outbound campaign (the v2 campaigns API) sourced from a Customer Profiles segment. The segment is a dynamic query on dial status equal to QUEUED, owned in CDK. A few behaviours shaped the design:

  • The campaign re-reads its segment at a refresh frequency with a minimum of one hour. With our sweep schedule, the calculated gap from a record landing to a dial is typically 35 to 40 minutes and at most about 75. A running campaign has no supported way to pick up a new lead sooner.
  • Calling windows, time zones and holidays map to the campaign's communication time settings. Per-recipient time zone detection needs a campaign source, one reason we chose segment sourcing.
  • A campaign can only be started from its initial state, with no way back, so changing the calling window means recreating it. A custom resource computes the run window at deploy time and waits for the campaign to reach Running.
  • Dialling to a country is denied by default and needs an AWS Support request. The approval cannot be read back from any API, so our dialler Lambda also checks its own allow list.

Answering machine detection is set on the campaign, and a "Check call progress" block in the flow sends live answers to the AI path and voicemail to a short message with no personal data. Undetected results fail open to the AI path. We had to enable waiting for the machine's beep, or the message played over the greeting and only its tail was recorded.

The contact flow and the agent

The outbound contact flow creates the Amazon Q in Connect session, builds the greeting, loads the records, checks identity, then runs a native Loop block. The loader Lambda returns a JSON array so the Loop block steps through one record per pass with no extra Lambda call.

Inside the loop, a Lex V2 bot hands each turn to Amazon Q in Connect through the built-in AMAZON.QInConnectIntent. The AI agent is an orchestration agent with a prompt, a guardrail and six tools, running Anthropic Claude Haiku 4.5 on Amazon Bedrock through a global cross-region inference profile.

The Lex step picks its agent through the Connect.SelfService orchestrator use case, and the self-service agent slot does not accept an orchestration agent. So a session-injector Lambda pins our agent to each session with UpdateSession, and copies per-record values into the session's custom data. Mind the limits: keys allow only letters, digits and underscores, one bad key fails the whole batch, and one prompt can reference at most 20 custom variables.

Tools

Two tools are small Lambdas exposed over MCP behind an Amazon Bedrock AgentCore Gateway, which authenticates Connect with a custom JWT authoriser. A date resolver turns spoken phrases into an ISO date and a spoken date without a weekday. It works in the business time zone, because evening dialling in UTC pushed "tomorrow" a day out, and for an ambiguous phrase it returns a clarifying question instead of a date. A calculator does decimal arithmetic on amounts with half-up rounding and returns the result in words.

Two more tools use the Amazon Q in Connect Retrieve tool, one filtered to FAQ content and one to standard issue reason codes by a content tag. The knowledge base is fed from Amazon S3, and metadata sidecar files do not become tags there, so a custom resource tags content after ingestion. Untagged content silently never matches.

The last two tools return control to the flow. Complete closes one record with an outcome and a summary. In the scenario the outcomes are EXTENSION_AGREED, RETURN_BOOKED, ALREADY_RETURNED, RETURN_MATCHED, ISSUE_RAISED with a knowledge base reason code, CALLBACK_SCHEDULED, STOP_REQUESTED and NO_ACTION. Escalate covers identity doubt, a request for a person, distress and contested issues.

After the call

The contact trace record arrives on Amazon Kinesis. A processor Lambda reconciles records the call never reached and invokes an outcome writer, which puts one JSON file per account per call into S3 for the operations team. Records without an outcome are retried after a delay, up to a set limit.

The call flow

Sequence of one outbound call from voicemail check and identity to the per-record loop and transfer

View / edit diagram source ↗

The flow speaks a fixed, approved opening that names the business, then asks whether it is speaking with the named person. A Lambda builds that question so the order is always the same. A separate identity AI agent with Complete, Retry and Escalate tools handles the answer, and the flow counts the retries. We moved the counting into the flow after a prompt-only version let one call loop for 36 turns.

If the phone has more contracts than the per-call limit (five by default), the flow plays a referral message and discusses none of them. Otherwise it loops through the records, oldest first. Each pass sets the current record, injects it into the session and hands over to the agent, which closes that record with its own Complete call.

Per-record loop: record kind check, agent turn, Complete or Escalate, and the advance decision

View / edit diagram source ↗

After each Complete, the flow reads an advance decision from the tool call and either continues the loop or ends the call. Before we added this branch, a model "goodbye" could end a call with records still open. Escalate leaves the loop for a transfer to a human queue.

Designing the agent

Our rule: the model handles conversation, and code handles anything that must be right every time. Prompt rules are probabilistic. We saw the model ignore an explicit rule even with a worked example in the prompt.

Deterministic logic in code

Opening text, record counts, the last-record flag, dates, arithmetic and outcome validation all live in the flow and the Lambdas. We used to inject a position like "3 of 5". The agent read it as "4 of 5", thought it was on the last contract and wrapped up one record early, losing an agreed extension. The loader now marks the last element with a plain true or false value. When the agent dropped zeros from a spelled-out contract number, we made the loader pre-separate every character, so reading it back is a copy task. The prompt bans weekday names outright, and every date goes through the date resolver.

Neutral labels and a record-kind gate

One agent handles both record kinds. With field names written for contracts ending, it read a logged return as a contract still running and asked the customer to arrange the return. We renamed the record fields to neutral terms such as kind, amount, date and age in days. The prompt makes the agent check the record kind before it speaks and commit to the matching branch. When the customer says which contracts a return covers, the agent records RETURN_MATCHED, never NO_ACTION.

Immutable ids with a server-side check

The prompt treats record values as immutable, but the Amazon Q in Connect session keeps earlier records in its history and cannot be cleared. So the outcome Lambda rejects any Complete whose contract number differs from the loaded record and leaves the row active for a later call. A conditional write also stops an agreed extension from being downgraded by a later Complete without one.

Two-step confirmation

Return-to-control tools have a setting that asks the user to confirm before the tool runs, but on voice we found it was not audibly enforced. So the prompt asks two separate questions before Complete: is the recorded resolution right, and shall we move on. The Complete schema also requires the advance decision, a summary of what the customer approved and confirmation evidence fields. On a three-record live call, both steps held for every record.

The cost is at least two more customer turns per record. Nothing caps read-backs yet, and one review found six rounds of them. Contract numbers the customer reads out are not protected the way loaded numbers are, and one summary recorded an extra digit.

Hold and resume

The prompt has hold and resume rules for every record kind. The identity agent has its own hold path, driven by the flow and tested live with "Hold on a second".

Guardrail settings

Our guardrail anonymises PII rather than blocking it. With BLOCK, spoken contract numbers and amounts matched PII patterns and the guardrail replaced the whole reply, so the agent looped on the same fallback line. We left names and email addresses unconfigured, because masking names garbled the opening. Amazon Q in Connect guardrails can only be tested on live calls, so prompt injection, card details and distress are scripted test calls.

Reducing latency

Each turn costs about 2 to 6 seconds of model inference, and the flow and Lex add their own waits.

Capping model thinking. The prompt limits the model's reasoning to one short sentence, except for issues and for splitting a return across contracts. Capping it, with a leaner prompt, took median inference from about 4.4 seconds to about 2.4 seconds. A later 100-turn sample measured a median of 2.26 seconds, a p95 of 3.55 seconds, and one turn in 100 above 4 seconds. Trimming prompt text alone did very little, because the static part of the prompt, about 9,400 tokens, is cached after the first turn.

A direct question at every hand-off. If the agent's opening text is a statement, Lex waits out its three-second no-input timeout before the agent responds. Each record now states its details and asks the question in one prompt, which removed the three-second wait from what had been a six-second pause at the first record's opening. We also removed an explicit Wait action from the flow.

Pre-built opening text. The loader builds the opening for each record, with fixed wording for each record kind, at no model cost.

Fewer tool calls. The prompt allows one tool call at a time. We have no clean figure, but each call adds a model round trip.

Short fillers. The agent may say "One moment" before a tool call. A global Lex filler we tried first played during every inference, including transitions between records, so we removed it.

Lex timing. A two-second Lex start timeout cut the gap before the next record from about 7.9 to about 5.8 seconds, and lower values clipped replies. When we moved to Amazon Connect agentic voice with the Advanced speech recognition model, those audio timeout attributes had to go entirely, because leftover ones caused HTTP 424 dependency failures.

Warm Lambdas. Provisioned concurrency on the call-start Lambdas cut the chance of a cold start but does nothing for inference.

Model and speech choices. We run on Claude Haiku 4.5, and model time is the one cost this stack cannot remove. We tested Amazon Nova Sonic speech-to-speech: cold starts ran about 6.1 seconds median and warm turns about 3.1, against about 2.4 for our speech-to-text path, with no perceived gain in naturalness. It also could not serve the multilingual voice we needed.

None of this makes a call feel instant. In one investigation, about 11 seconds passed before the agent asked "Are you still there?".

Speech and telephony realities

When a customer "was not heard", start with the recording. Connect's IVR recording is stereo, with the customer on their own channel. In the failures we investigated, the customer's reply was 22 to 30 dB quieter than their earlier answers. In one case, a concurrent call on the same flow, bot and prompt heard "yes" many times while ours got a faint fraction of a second. The audio was lost on the caller's leg, through the handset, network or carrier, with voice activity detection cutting off soft speech. No Lex or prompt setting, including a lower end-confidence threshold, could have recovered it.

Lex conversation logs were off by design because of PII, so the ASR text for a missed turn was gone. Agree a retention position for those logs early.

The silence path decides outcome quality. Today, two empty turns close the record with no action and end the call, so the remaining records are skipped and the operations team gets "no action" for a customer who may simply not have been heard. We plan to re-ask the pending question once, prefer a callback outcome and add an optional touch-tone fallback for confirmations.

Test on several handsets and networks, and avoid speaker and Bluetooth. We saw silence gating and media loss on one mobile route and not on another with the same stack.

Delivery and operations

The stack is AWS CDK in TypeScript, split into nine stacks from networking to security, with one config file per environment. The CI pipeline builds, tests, synthesises, runs a preflight and deploys the base stacks. A post-deploy stage then deploys security, runs an agent bootstrap script, deploys the contact flow and campaign, and runs a verify script.

Some setup has no CloudFormation resource. The main one is the AI agent's security profile association, which grants its MCP tool permissions. Without it, tool calls fail with MCP error -32603 Unauthorized, which looks like a knowledge base miss, and it must be re-run whenever the agent is replaced. Per-country dialling approval also sits outside the template.

Do not attach a resource policy to the AgentCore Gateway. It switched the gateway to deny by default, and Connect's tool discovery failed with no error shown.

Prompt, agent and Lex versions are snapshots. CloudFormation creates a prompt or agent version once and does not republish it when the prompt text changes, so each prompt change needs a new version resource. A Lex version captures the last built locale, so a custom resource sets the speech model and rebuilds the locale before the version is cut.

Validate contact flows on a throwaway flow, because one invalid block fails the whole flow resource and rolls back the stack. Our Connect instance was shared, so we never changed instance-wide settings. When removing a cross-stack export, deploy the consumer stack before the producer. Console fixes are overwritten by the next deploy, so bring them into CDK straight away.

Testing

Offline, we run Jest for the CDK and pytest for the Lambdas, with no AWS calls. The real test is the phone. In scenario terms, one scripted run of 11 live calls covered extensions with tricky dates, a split return, already returned, a knowledge base question, issues, a callback, a stop-calling request and four escalation reasons. A later 22-case suite ended at 22 of 22: 16 passed first time and 6 passed on retest after fixes.

Keep manual tests out of the campaign. We seed manual test records in a status the sweep never queues but the loader still presents, and send outcome files for test numbers to a test bucket. Use fresh seed data for every scenario, because reused rows carried stale issue, escalation or over-limit flags into later tests. Run a regression set on every prompt or guardrail change, with a multi-record call and the compliance paths each time.

Key takeaways

  • Put counts, dates, sums, the last-record flag and opening text in code.
  • Close each record with its own tool call, and check record ids on the server.
  • Platform-managed confirmation was not enforced on voice for us. Use the prompt and required evidence fields.
  • Capping model thinking did far more for latency than trimming a cached prompt.
  • Ask a direct question at every hand-off, or Lex adds a three-second wait.
  • Script and verify the setup that sits outside CloudFormation.

Closing

Amazon Connect has the parts for an outbound AI agent: campaigns, flows, Lex, Amazon Q in Connect and MCP tools. Making them behave on real business calls took deterministic code around the model, careful turn design and a lot of live testing. If you are planning AI-driven outbound calling on Amazon Connect, talk to us at cloudnaut. We are happy to share what worked and what we would change.