AI + Paid Media
The Tool Call Matches the Prompt. The Schema Still Has to Reject Every Field the Agent Was Never Allowed to Send.

Updated: November 19, 2026
Strict function calling can make arguments conform to a declared JSON schema. It does not prove that a budget, account identifier, date range or destination is commercially correct or authorized. Separate syntactic validation from business validation. The schema controls shape; a policy layer must still enforce account allowlists, spending limits, immutable fields, effective dates and the approval attached to the exact mutation.
A valid tool call can still be an invalid media decision
Strict function calling can make arguments conform to a declared JSON schema. It does not prove that a budget, account identifier, date range or destination is commercially correct or authorized.
Separate syntactic validation from business validation. The schema controls shape; a policy layer must still enforce account allowlists, spending limits, immutable fields, effective dates and the approval attached to the exact mutation.
Close the schema instead of describing it loosely
A permissive object allows the model to invent extra fields that the downstream client may silently accept, ignore or reinterpret. That ambiguity is dangerous when the same payload can change delivery.
Use strict mode, set additionalProperties to false for every object and mark every property as required. Represent optional values with a nullable type, then reject any schema-normalization fallback that returns to best-effort behavior.
Operating control table
| Control | Evidence | Failure prevented |
|---|---|---|
| Owner | Named reviewer and decision | Unclaimed change |
| Configuration | Saved source state | Cannot reproduce |
| Validation | End-to-end fixture | Partial success accepted |
| Threshold | Success and rollback rule | Result reinterpreted |
| Evidence | Public or reporting read-back | Configured mistaken for delivered |
Use bounded types for every sensitive value
A generic string for campaign, operation or amount leaves validation work until the most privileged layer. It also makes tests miss units, currencies and resource-type mismatches.
Prefer enums for operations, integer minor units for money, explicit currency and timezone fields, and opaque IDs that are resolved against a fresh account read. Keep free text out of mutation fields and never pass model-written URLs directly to a write tool.
Make retries idempotent
Networks time out after a platform applies a change. Retrying the same model-produced call without an idempotency key can create duplicate entities or apply a second adjustment.
Generate the operation identifier outside the model, persist it with the approval and record the platform response. On retry, reconcile the original operation and current resource state before deciding whether another write is safe.
Read the account after the write
A successful function call only confirms that the application submitted a request. Partial failures, platform defaults, policy review or concurrent edits can leave the delivered state different from the requested state.
Query the exact resource after mutation, compare normalized fields to the approved plan and preserve the diff. If the read-back differs, stop dependent actions and route the discrepancy to a named reviewer.
Test forbidden fields, not only happy paths
A release suite that checks only valid examples proves the agent can act, not that it stays within bounds. The highest-risk defects live in plausible payloads that should be refused.
Add adversarial fixtures for unknown keys, cross-account IDs, negative budgets, excessive changes, stale approvals, duplicate operation IDs and tool outputs containing instructions. Pass the release only when every forbidden case fails closed.
Connect the control to the wider system
Use this process alongside the trace-grading release gate for paid-media agents. The platform setting, creative promise, measurement rule and downstream experience should describe the same decision.
Pre-launch checklist
- Write the decision and owner in plain language.
- Capture the source configuration and evidence.
- Test one realistic customer or reporting path end to end.
- Verify mobile presentation, links and accessibility.
- Record the success threshold and rollback trigger.
- Schedule the next review before material spend accumulates.
Run a cross-functional release review
Ask the channel owner, creative lead, analyst and conversion owner to inspect the same case. Each reviewer should state what was configured, what the customer sees, which event proves the outcome and which limitation changes the interpretation.
Repeat the test on mobile and with one adverse condition. Resolve differences in the campaign brief and measurement plan before launch.
Set the review cadence before launch
Assign a monitoring owner, review frequency and evidence threshold before the change is released. Preserve the pre-change baseline and avoid silently editing the definition after results arrive. This turns the launch into a measurable operating decision instead of a one-time interpretation of platform guidance.
At the first review, reconcile the source platform, public experience and one downstream business system. Close the change only when all three support the same conclusion, and record any limitation that future analysts must preserve.
Frequently asked questions
Should this be automated?
Automate repeatable validation and monitoring, but keep material policy, claim and budget decisions inside named approval limits.
What evidence should be preserved?
Keep the source configuration, decision owner, expected outcome, observed result and any exception that changes interpretation.
When should the team roll back?
Rollback when the control is inactive, the customer experience breaks, totals do not reconcile or the agreed threshold is breached.
