AivexaNewsSearch
AI news for builders and product teamsChecked every hour

Build WhatsApp AI agents with Amazon Bedrock AgentCore

Collected Nov 17, 2026

AWS's machine learning blog has introduced SMART, the Social Messaging Agent Runtime Toolkit, an open source Python SDK and Terraform stack for putting an AI agent on WhatsApp. The premise is that the agent itself is usually the easy part: inbound messages from Meta arrive as deeply nested, type-dependent payloads that have to be authenticated and normalised, voice notes and documents each need their own pipeline, memory has to persist across sessions, reminders need durable scheduling, and anything sent more than 24 hours after the user's last message must go out as a pre-approved Meta template. Standing that up by hand involves configuring more than 10 AWS services. SMART is aimed at teams that would otherwise build that layer from scratch or outsource it to a third-party messaging vendor. It is distributed as sample code and AWS describes it as non-production usage, calling on adopters to clear security, legal and compliance requirements before deploying.

The design keeps a deliberately small contract with the developer's agent. The agent receives the inbound message and returns text, optionally with richer message attachments; everything else is handled by the toolkit. Helper functions bind a session to AgentCore memory scoped to the sender's phone number, and a context wrapper collects messages that tools want to emit mid-turn so they can be sent in order once the turn completes. The example entrypoint uses Strands Agents with a Bedrock model, but because AgentCore is framework-agnostic the SDK exposes the same memory and session hooks to LangGraph, Pydantic-AI or any other framework that gives the developer control over the conversation loop. Model, prompt, framework and business logic stay with the team.

Operationally, inbound WhatsApp traffic lands at AWS End User Messaging Social and is routed through Amazon SNS to a webhook Lambda. That function verifies the SNS signature, normalises the payload and rate-limits each user at 20 messages per minute by default when the optional DynamoDB state table is enabled. It also sends a read receipt and typing indicator before the model has finished. Voice notes are transcribed with Amazon Transcribe; other media becomes a descriptor or is passed to a hook the team registers. When the agent throttles or errors, the user gets a readable, customisable message instead of silence.

A single deploy command runs terraform apply and provisions AgentCore runtime and memory, four Lambda functions (webhook, notification, event and scheduler) on Python 3.12 with X-Ray tracing and dead-letter queues, the SNS ingestion topic and event API, EventBridge Scheduler, S3 buckets for media and audit trails, CloudWatch dashboards and alarms, and a Bedrock Guardrails resource configured by default. The agent container image and Lambda layer are built in AWS CodeBuild during the apply, so Docker is not needed locally. External systems can trigger outbound handlers through an API Gateway endpoint protected by an API key and a Lambda authorizer, and scheduled outreach runs through EventBridge Scheduler using Meta-approved templates for messages that fall outside the 24-hour window. AgentCore Observability traces each step for debugging and audit.

Prerequisites are a WhatsApp Business Account with a registered phone number linked through AWS End User Messaging Social, an AWS account in a Region where AgentCore runtime and memory are available with model access enabled, plus Python 3.11 or later, Terraform 1.7 or later, uv and the AWS CLI. A starter IAM policy for the deployer role ships with the repository. The default walkthrough model is Claude Haiku 5.5 on Bedrock.

Projects start from `socialagent init`, which offers three blueprints: minimal (an echo agent with no tools, skills or templates), personal-assistant (memory, per-user state, scheduling, skills and media tools on Strands) and appointment-scheduler (a booking flow that stores appointments as per-user state and sends reminders). Local iteration happens through a REPL that stubs AWS channel I/O: memory becomes a file-backed session, state a local JSON file, notifications print to the terminal including buttons and list rows, one-shot schedules fire immediately while recurring ones are only registered. Model calls are real, so non-minimal blueprints need AWS credentials, and the REPL does not simulate IAM or Meta's template review, which is why testing on a deployed stack is recommended.

One step is outside Terraform: the WhatsApp Business Account's event destination has to be pointed at the stack's SNS topic, either through the admin console's Bind action or the CLI. Until that link is made, inbound messages go nowhere and nothing reports an error. Deploy also syncs any templates.yaml with Meta; a rejected template fails the deploy, and a force sync pushes previously approved templates back through review. Meta classifies templates by purpose, and emojis or marketing language are the usual cause of a transactional template being reclassified as promotional.

An optional administration console, deployed from its own Terraform root, registers stacks through a shared S3 registry. It offers fleet health, reading and manually replying to conversations, inspecting and cancelling EventBridge schedules, browsing per-user state, restarting Lambdas or the runtime, reviewing deployment history and errors, triggering test events, template management with WhatsApp-style rendering and reclassification warnings, and phone-number rebinding as a UI action. Sign-in uses Amazon Cognito with MFA, with role-based permissions enforced on every API route, served from CloudFront over a private S3 bucket. Teardown is ordered, and three things survive destroy: S3 buckets holding objects (unless force destroy is enabled), templates registered with Meta, and the account-level phone number registration.

Why it matters: teams building customer-facing assistants for WhatsApp-heavy markets in Latin America, India and Southeast Asia get a reference implementation of the integration layer rather than having to learn Meta's payload shapes and session rules by hitting them in production. The blueprint and recipe structure, with local REPL testing, should shorten the path from prototype to a deployed stack. The caveats are real, though: this is AWS-published sample code, it ties deployments to AgentCore and Meta's template review process, and the account-level settings that Terraform cannot manage are exactly the ones whose misconfiguration fails silently, so a deploy-and-verify step belongs in any rollout plan.

Read at AWS Machine Learning Blog

Based on reporting from the original publisher. Visit the source for full context and later updates.

Publisher excerpt

SMART, an open-source Python SDK and Terraform stack, deploys the full WhatsApp channel layer to your AWS account with one command. Bring any agent that runs on Amazon Bedrock AgentCore, and SMART handles webhook ingestion, media, conversation memory, scheduling, and Meta message templates.