AI
How to build a WhatsApp agent with the OpenAI Agents SDK
The OpenAI Agents SDK gives you agents, tools, handoffs and guardrails. Here is how to turn it into a WhatsApp agent that customers can actually rely on, without building the WhatsApp plumbing, the inbox or the handover yourself.
MonoChat Team Updated: 6 min read
On this page
The OpenAI Agents SDK is OpenAI’s open-source framework for building agents: a model with instructions, tools it may call, handoffs to other agents and guardrails around its inputs and outputs, all run in a loop until the task is done. It is a great way to build an agent. It does not, on its own, give you a WhatsApp number, a team inbox, template messages or a way for a person to take over. With MonoChat’s Agent Harness you choose the OpenAI Agents SDK as an AI Harness, place an AI Agent node in a flow, connect WhatsApp and test, and MonoChat takes care of the rest.
This guide covers what the SDK gives you, the three ways to use OpenAI agents in MonoChat, a step-by-step setup and the WhatsApp-specific details that decide whether customers trust the agent.
What the OpenAI Agents SDK gives you
The SDK is built around a small set of ideas:
- Agents: a model plus instructions that describe its job.
- Tools: functions the agent can call, such as “look up an order” or “check a time slot”, plus MCP servers.
- Handoffs: one agent passing the task to another that specialises in it, for example from a general support agent to a returns agent.
- Guardrails: checks that run alongside the agent to stop inputs or outputs you do not want.
- Sessions and tracing: memory across turns and a record of what the agent did, step by step.
Together that is an agent harness: the loop that lets a model act, check its work and continue, instead of answering once. For customer messaging, this is the difference between explaining your return policy and actually creating the return.
What WhatsApp adds to the problem
Building the agent is half the job. Putting it in front of customers on WhatsApp means handling:
- The WhatsApp Business Platform. An official API connection, a verified business and an approved number.
- The 24-hour window. Free-form replies are allowed within 24 hours of the customer’s last message; after that you need an approved template.
- Policy. Since January 15, 2026, WhatsApp keeps general-purpose AI assistants off the platform. An agent that serves your own customers is allowed, and a clear path to a human is expected when replies are automated.
- People. Some conversations must go to a person, with the history intact, inside the tool your team already uses.
- Other channels. Customers who write on Instagram, Messenger or your website expect the same answers.
MonoChat handles these around the agent, so your work stays on the agent itself.
Three ways to use OpenAI agents in MonoChat
| Option | Where it runs | What you need |
|---|---|---|
| OpenAI Agents SDK | Inside MonoChat | Nothing extra; uses your AI models |
| OpenAI Agents API (hosted by OpenAI) | OpenAI’s cloud | Your OpenAI API key |
| Custom (your own Agents SDK service) | Your own server | An endpoint URL and a shared secret |
Start with the OpenAI Agents SDK harness if you want an OpenAI-style agent without deploying anything. Choose the OpenAI Agents API if your agents already live on OpenAI’s hosted platform. Choose Custom if your developers have written their own agent with the SDK, with their own tools, handoffs and tests, and want to keep running that code; see how to connect your own AI agent to WhatsApp.
Step by step: an OpenAI Agents SDK agent on WhatsApp
1. Add an AI Harness
Add an AI Harness in MonoChat and choose OpenAI Agents SDK as the provider. It runs inside MonoChat and uses the AI models you have already set up, so there are no extra keys or servers for this step.
2. Add an AI Agent node to a flow
In the flow that receives your WhatsApp conversations, add an AI Agent node and select the harness. Write the agent’s instructions: who it serves, what it can do, what it must never do and when it hands over.
3. Pick the main, fallback and fast models
Every AI Agent node has three model roles:
- The main model reasons and writes the replies.
- The fallback model takes over after a soft limit or a failure.
- The fast model handles background work.
Add a budget limit per run so one unusual conversation cannot run up a large bill. Not sure how to pick the fallback? Read why your customer-facing AI agent needs a fallback model.
4. Connect your tools
Give the agent the tools that match your most frequent requests:
- AI function tools for calls to your own APIs with structured inputs.
- MCP integration for tools from MCP-compatible systems.
- The AI knowledge base for answers grounded in your documents and policies.
- Custom functions for logic that runs inside the conversation.
Three good tools beat fifteen half-tested ones. Add more once you see real conversations.
5. Connect WhatsApp (and everything else)
Connect your WhatsApp Business number through MonoChat, an official Meta Business Partner. The same flow can run on Instagram, Messenger, TikTok, Telegram, web chat, SMS and voice, so one agent covers every channel.
6. Test with real messages
Use last month’s conversations as your test set. Include the hard ones: angry customers, vague questions, several requests in one message, a customer who asks for a person straight away. Check the tool calls, the tone and the handover. Then go live.
Patterns that work well on WhatsApp
One question per message. Agents built for chat on the web tend to answer with long lists. On a phone, short messages and one clear question at a time get better replies from customers.
Confirm before irreversible actions. Let the agent propose, and the customer confirm, before a cancellation, refund or booking change.
Specialists through handoffs, people through the inbox. The SDK’s handoffs are great for routing between agents (sales, support, returns). Handover to a person belongs in MonoChat’s shared team inbox, where the conversation arrives with its full history.
Instructions that name the limits. “Refunds up to €50 you may approve; above that, hand over to the billing team.” Explicit numbers beat vague rules.
Keep it about your business. An agent that helps your customers is allowed on WhatsApp. One that answers anything at all risks breaching WhatsApp’s 2026 rules; our WhatsApp AI chatbot policy guide explains where the line is.
Costs
Three things add up: your MonoChat plan, the AI model usage and Meta’s WhatsApp message fees. Since October 1, 2026, Meta charges service replies after the first 1,000 per business number each month; see our WhatsApp API pricing guide.
On the AI side, MonoChat adds no markup when you use your own provider keys. Budgets per run, a cheaper fast model for background work and a reliable fallback keep the bill predictable.
Not locked in
Agent Harness lets you choose the framework, not just the model. If you later want to try the Claude Agent SDK, Pi, Claude Managed Agents or your own framework, add another AI Harness and point the AI Agent node at it. Your channels, tools and handover stay as they are. Compare all providers on the Agent Harness page.
Put this into practice with MonoChat