Skip to main content

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
  1. What the OpenAI Agents SDK gives you
  2. What WhatsApp adds to the problem
  3. Three ways to use OpenAI agents in MonoChat
  4. Step by step: an OpenAI Agents SDK agent on WhatsApp
  5. Patterns that work well on WhatsApp
  6. Costs
  7. Not locked in

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

OptionWhere it runsWhat you need
OpenAI Agents SDKInside MonoChatNothing extra; uses your AI models
OpenAI Agents API (hosted by OpenAI)OpenAI’s cloudYour OpenAI API key
Custom (your own Agents SDK service)Your own serverAn 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:

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.

FAQ

Frequently asked questions

Can I use the OpenAI Agents SDK on WhatsApp without hosting anything?

Yes. In MonoChat, choose the OpenAI Agents SDK as the provider of an AI Harness. It runs inside MonoChat and uses your AI models, with nothing extra to set up. You then use it from an AI Agent node in a flow connected to your WhatsApp number.

What is the difference between the OpenAI Agents SDK and the OpenAI Agents API in MonoChat?

The OpenAI Agents SDK harness runs inside MonoChat on your AI models. The OpenAI Agents API option uses agents hosted by OpenAI in its cloud and needs your own OpenAI API key.

I already built an agent with the OpenAI Agents SDK. Can I keep it?

Yes. Run it on your own server and connect it to MonoChat as a Custom harness with an endpoint URL and a shared secret. MonoChat delivers the conversations from every channel and handles handover to your team.

Which models can the agent use?

Each AI Agent node has a main model, a fallback model that takes over after a soft limit or failure, and a fast model for background work. You choose them from the AI models available in your MonoChat account, and you can set a budget limit per run.

Does MonoChat add a markup on OpenAI usage?

No. When you bring your own provider keys, you pay the provider directly and MonoChat adds no AI markup.

First month of Growth on us

Run WhatsApp, Instagram and Messenger from one inbox

Start free with MonoChat: shared team inbox, AI assistants, templates and campaigns on official Meta APIs.

One code per business • 30 days to redeem • No card needed

$150 to get started.

Claim