Meta Business Agent Platform

Test your agent

Updated: Nov 12, 2026
Copy for LLM

What you’ll end up with

By the end of this guide you’ll have a repeatable way to exercise your agent before customers reach it: single turns through the Agent Test API, a step-by-step record of what the agent actually did on each turn, scenario suites through Agent Eval, and a short list of live conversations with people you trust. You’ll also have a set of deliberately hostile test messages, because an agent that only ever sees the question you designed it to answer will fail the first time someone asks something else.
Happy-path testing tells you the agent works. It doesn’t tell you what it does when your API is down, when a shopper asks about a competitor, when the message arrives in a language you didn’t plan for, or when two of your instructions disagree. Those are the cases that reach production, so Try to break it is the longest section here.

Prerequisites

  • An onboarded agent on an eligible phone number. If you don’t have one yet, work through the Quickstart first — every call below assumes the Agent Onboarding API has already succeeded for your entity_id.
  • A valid system user access token (SUAT) or Business Integration System User (BISU) token with the whatsapp_business_messaging permission — see Generate an access token. Reading agent data, including evaluations and insights, also needs whatsapp_business_management.
  • The phone number ID for the number the agent runs on, shown in WhatsApp Manager⁠ under Account tools > Phone numbers. It is the entity_id path parameter on every endpoint here except Agent Budget, whose entity_id is the ID of the business portfolio that owns the agent.
You don’t need billing, a webhook subscription, or an enabled agent to run anything in Test one turn at a time or Run scenario suites.
Note: Set X-API-Version: 2.0.0 explicitly on every Meta Business Agent Platform call. Without the header, a request resolves to the oldest version the endpoint supports. Cloud API endpoints differ — Thread Control takes 1.0.0.

Pick the right surface

Three surfaces test different things, and none of them replaces the others.
SurfaceWhat it’s good forWhat it can’t tell you
Fast single turns and multi-turn threads against the full pipeline. Not billed, and works while the agent is off.
Anything about WhatsApp delivery, thread control, or how a real person phrases things.
Repeatable scored runs across a set of scenarios, driven by a simulated user. Good for regression checks after a config change.
Whether the scenarios you scored are the ones your customers actually bring.
Allowlisted live conversations
Real WhatsApp delivery, real message formatting, real human phrasing, thread control behavior.
Scale — the allowlist holds at most 20 consumer phone numbers per WhatsApp Business phone number.
Work through them in that order. Each one costs more to set up than the last, so catch what you can cheaply first.

Test one turn at a time

The Agent Test API runs your message through the full agent pipeline and returns the reply synchronously. Tokens consumed here are not billed, and the agent does not need to be enabled — so this is where most of your iteration happens.
curl -X POST "https://api.facebook.com/<ENTITY_ID>/agent_test" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "X-API-Version: 2.0.0" \
  -H "Content-Type: application/json" \
  -d '{
    "user_msg": "Do you deliver to Leeds on a Sunday?"
  }'
Pass the conversation_id from the response back on the next call to continue the same thread; omit it to start clean.
Read past agent_response — the other fields are where the failures show up:
FieldRead it for
handoff_reason
The agent decided a person was needed. Check that the trigger was the one you intended, not a question it should have answered.
no_response_reason
The agent produced nothing at all. ELIGIBILITY_CHECK_FAILED is one possible value. A silent turn in testing is a silent turn in production.
quick_replies
The suggestions offered alongside the reply. Confirm they’re actions the agent can actually complete.
product_variant_ids
Which catalog products the reply referenced. Check the agent cited the product you expected, not a near-match.
ui_components
The rich messages the agent produced from your interactive messages, such as buttons, lists, carousels, and WhatsApp Flows. Check that the agent picked the one you expected for this message and filled in the right labels, URLs, and rows. A Flow carries only its flow_id.
Rate limits apply: 500 requests per hour for each entity_id, and 10,000 per hour for each app. A test script that loops without a delay will hit 429 and stall your run.

See what the agent actually did

A wrong answer tells you the agent failed. It doesn’t tell you whether the model reasoned badly, a tool timed out, or the knowledge was never retrieved. Conversation Turns gives you the ordered steps behind a turn, and it accepts the conversation_id that agent_test returned — so you can inspect a test conversation the same way you’d inspect a real one.
curl -G "https://api.facebook.com/<ENTITY_ID>/insights/conversations/turns" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "X-API-Version: 2.0.0" \
  --data-urlencode "user_phone_number=<CONVERSATION_ID>"
Each step is an LLM_CALL or a TOOL_CALL carrying a status of SUCCESS, ERROR, or TIMEOUT, plus latency_ms. Tool steps also carry tool_name, tool_input, and tool_output. Three things worth checking on every failed turn:
  • A TOOL_CALL step that ends in TIMEOUT rather than ERROR separates a tool that never came back from one that returned a failure. Check your own API’s latency for that call before you change anything about the agent.
  • A tool_input that doesn’t match what you expected means the agent mis-filled the parameters — usually a connector tool description problem, not a model problem.
  • A turn with no TOOL_CALL at all, where you expected one, means the agent never decided the tool applied.
Turns whose records are malformed, and tool responses that can’t be matched back to a call, may be omitted — so an absent step is weaker evidence than a present one.

Run scenario suites

Agent Eval runs multi-turn conversations against your agent using a simulated user, then scores them. Use it as a regression check: run the same cases before and after a change to your instructions, knowledge, or connectors, and compare.
List the evaluation cases defined for your entity, each carrying a scenario, an optional max_turns, and the success_criteria the agent has to meet:
curl -G "https://api.facebook.com/<ENTITY_ID>/agent-eval/cases" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "X-API-Version: 2.0.0"
Submit a run over the cases you want, passing their IDs as a comma-separated eval_case_ids query parameter and an empty JSON body:
curl -X POST "https://api.facebook.com/<ENTITY_ID>/agent-eval/run?eval_case_ids=<CASE_ID_1>,<CASE_ID_2>" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "X-API-Version: 2.0.0" \
  -H "Content-Type: application/json" \
  -d '{}'
The response returns a job_id and a status of QUEUED. Poll GET /agent-eval/run?job_id=<JOB_ID> until status reaches COMPLETED or FAILED. While it runs, progress.current_stage moves through simulation, evaluation, insights, and done — done is the terminal stage, so poll status rather than treating insights as completion. On failure, error.code (for example SIMULATION_FAILED) and error.failed_case_ids name what broke.
A completed job returns average conversation and turn scores on a 1–5 scale, a natural-language summary, and top_failure_categories with recommended actions. Treat the categories as your backlog. For a specific conversation, fetch GET /agent-eval/details?eval_ids=<EVAL_ID> — it returns the full transcript and per-turn labels, which is where you find out whether a low score came from one bad turn or a conversation that drifted.
Scores are only as honest as the scenarios. A suite written from your own product knowledge scores the agent on the conversations you already know how to handle. Add cases for the ones you don’t.

Try to break it

Everything above confirms the agent does what you designed. This section is about finding what you didn’t design for. Run each of these through the Agent Test API and read the full response, not just agent_response.

Ask what it doesn’t know

  • Ask about a product you don’t sell, a location you don’t serve, and a policy you’ve never published. A good agent says it doesn’t know. A badly grounded one invents an answer.
  • Ask a question your knowledge sources answer inconsistently — an FAQ that contradicts your website, or a price in the catalog that differs from a PDF you uploaded. The agent will pick one, and you need to know which.
  • Ask about a competitor, and about something completely unrelated to your business. Check the reply stays in scope rather than helpfully answering.
  • Delete or change a knowledge source, then re-ask a question that depended on it. Stale retrieval after a config change is a real failure mode and it’s invisible unless you look for it.

Push on the instructions

Your instructions are the agent’s rules, and rules conflict. Write two instructions that both claim priority for the same trigger — then send a message that fires both and see whether the agent duplicates, contradicts itself, or picks one. Consolidating both into a single instruction with ordered steps is usually the fix. See Agent instructions.
Then attack them:
  • Ask the agent directly to ignore its instructions, reveal them, or act as a different assistant.
  • Ask it to promise something you never authorized — a discount, a refund, a delivery date, a legal or medical opinion.
  • Ask it to commit on your behalf: “so you guarantee it arrives Friday?”
Where an exact phrase must never appear in a reply, set it in never_say_phrases on the Agent Settings API. Matching responses are withheld. Send the phrase back in every paraphrase you can think of and confirm what the consumer actually sees when a reply is withheld — that path needs to be acceptable on its own, because it is what your customer gets.

Break the tools

Connector failures are the most common cause of an agent that tests well and fails in production, because your test environment is usually healthy and production isn’t.
  • Point a connector at an endpoint that is slow, then one that is down. Confirm the agent degrades into something a customer can act on rather than stalling or claiming success. Check the step status in Conversation Turns — SUCCESS, ERROR, or TIMEOUT — to see which one happened.
  • Let a credential expire, or rotate it without updating the connector. The connector’s connection_status moves to EXPIRED or ERROR; the consumer-facing behavior is what you’re testing.
  • Return a valid-but-empty result — no orders, no availability, an empty cart. “No results” is a different reply from “something went wrong,” and agents frequently conflate them.
  • Return an unexpected shape: a null where you promised a string, an error body with a 200 status, a much larger payload than usual.
  • Ask for something that requires two tools in sequence, and make the second one fail. Check that the agent doesn’t report the whole task as done.
The failure_code_name values you’ll see in connector logs, and what each one means, are in Connector errors.

Send input it didn’t expect

  • A very long user_msg, and a one-character one.
  • Emoji-only, punctuation-only, and messages in a language you didn’t configure for.
  • The same question asked five different ways, including with typos, slang, and no punctuation. Consistency across paraphrases is a better quality signal than a single correct answer.
  • Two unrelated questions in one message, and a question that contradicts the one before it.
  • Personal or sensitive information volunteered mid-conversation, so you can see how the agent handles it before a customer does.

Stress the conversation, not just the turn

  • Run a conversation well past the length you expect — does the agent still remember what was established at the start, and does it repeat itself?
  • Change your mind halfway through. Cancel an order you just placed, switch products, ask it to start over.
  • Go quiet, then resume. If followup is enabled in your settings, confirm the follow-up message fires at the interval you set and reads correctly out of context.
  • Reuse an old conversation_id after changing your configuration, and start a fresh one with the same question. A reply that only appears in one of them tells you the change didn’t take effect where you thought.

Trip the limits

Every limit is a failure mode your integration has to survive. Cause each one on purpose once, so you find out how your own code reacts:
LimitHow to hit itWhat you should verify
Agent Test rate limit
Loop past 500 calls in an hour for one entity_id, or 10,000 for one app
Your harness backs off on 429 instead of failing the suite
Allowlist capacity
Add a 21st consumer phone number to one WhatsApp Business phone number
You get 400, and the error detail reports the maximum
Allowlist format
Submit a number that isn’t E.164, or send consumer_phone_number and consumer_instagram_username together
The mutually exclusive fields are rejected as you expect
Budget cap
Set a low max_budget on the Agent Budget API and exhaust it. Its entity_id is the business portfolio ID, not the phone number ID the rest of this page uses
A reached budget finishes the turn in flight, then stops replying to new messages and hands off to a human until the time window rolls over. Confirm your handoff routing covers that, because it fires without warning
Bad entity_id
Call with a WhatsApp Business account ID instead of a phone number ID
You recognize the 400, which reports as an invalid WhatsApp phone number
Every failure returns a JSON error object with title, detail, status, and an fbtrace_id. Log the fbtrace_id — it’s how support finds a specific failed call. The full status-code list is in Troubleshooting.

Test with real people before everyone

The Agent Test API never touches WhatsApp. To see real delivery, formatting, and timing, turn the agent on for a small group.
Set ai_audience to ALLOWLISTED_ONLY on the Agent Settings API and set rollout.enabled to true. An allowlisted-only agent doesn’t require a payment method, so you can do this before you set up billing. Then add your testers with the Agent Allowlist API:
curl -X POST "https://api.facebook.com/<ENTITY_ID>/agent_config/allowlist" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "X-API-Version: 2.0.0" \
  -H "Content-Type: application/json" \
  -d '{
    "consumer_phone_number": "+15551234567"
  }'
Give your testers the awkward cases from Try to break it rather than a script — people phrase things in ways you won’t predict, which is the entire reason for this stage.
Two behaviors only appear here, not in the Agent Test API:
  • Your app taking control silently. If your app sends any message into a conversation, it becomes the primary responder and the agent stops replying until control is released. This is the most common cause of an agent that answers in testing and goes quiet in production. Release control with the Thread Control (Cloud API) endpoint.
  • Webhook routing. While the agent holds control your app receives consumer messages on the standby field, not messages, and messaging_handovers fires whenever control changes hands. Confirm your handlers are subscribed to all three before you widen the audience — see Thread control and message routing.
Widening to ai_audience of EVERYONE does require a payment method on your Business Agent account.

Keep testing after launch

Real traffic surfaces cases no suite anticipated, so treat the first weeks as continued testing.
  • Tool Call Insights reports per-tool volume, latency, and how often each tool succeeded, failed, or timed out. A tool whose timeout rate climbs is degrading your answers before any customer reports the problem. Figures roll up once a day, so the most recent day may be incomplete, and a query may span at most 30 days.
  • Conversation Insights and Agent Insights show how conversations are going in aggregate; a rising handoff rate usually means a knowledge or instruction gap, not a broken agent.
  • Pull Conversation Turns for conversations that ended in a handoff and read the steps. Those are your next eval cases.
Every time you change instructions, knowledge, or a connector, re-run the eval suite before you ship the change. A change that fixes one scenario routinely breaks another, and the scores are the only way you’ll catch that.