Ballast — Run Meta Ads with AI, Safely
Problem
Meta opened its Ads MCP server to AI agents in 2026, so an agent can now create, edit and activate campaigns on its own. Nothing stands between the model and the budget: eager edits reset Meta's learning phase, spend drifts past what the business meant to risk, and nobody can audit why a change happened.
Business Impact
Agencies and in-house teams want AI to manage Meta ads, but one bad edit can burn a day's budget or reset weeks of learning. Ballast makes the AI's freedom explicit: small changes inside limits run on their own, bigger ones wait for a person, and hard limits never move. In the sandbox demo the local model proposed scaling the best ad set by 20% and cutting the worst by 20%; both were held for approval because they passed the 15% auto step, and a spend spike was detected (z = 16.7) and paused within the guardrails.
System Approach
- Rust engine (axum, tokio): pure decision core, 256-way sharded signal store with pre-hashed keys, EWMA spend-spike detection, approvals, and a SHA-256 hash-chained JSONL audit log
- Thirteen guardrail checks, including a daily spend cap, per-ad-set cap, max budget step, auto-approve step, learning-phase lock, edit cooldown, activation review, anomaly hold and an action allow-list, under Observe, Assist or Autopilot mode
- Allowed changes are reserved at decision time, so parallel proposals cannot jointly break the cap, and rolled back if the Meta write fails
- AI SDK 7 planner with a single propose_change tool; Meta's write tools stay with Ballast, never with the model
- Launch flow: brief → three AI ad drafts (local Qwen with reasoning off, about 7 s) → live feed preview → campaign, ad set, creative and ad created paused through ads_create_* MCP tools → go-live through ads_activate_entity only after the guardrails or a human approve
- Account page: anyone pastes a Meta token, Ballast asks Meta's Ads MCP server which ad accounts it can see, and saves the connection on the local machine only
- Sandbox account that speaks the same Meta Ads MCP tools and validates arguments like Meta, so every feature works before connecting a real account
- Light dashboard in Next.js 16: ad sets with CPA and ROAS against targets, approval inbox, guardrail sliders and the verified audit trail
Key Decisions & Trade-offs
- The engine trusts its own view of the current budget, not the caller's, so a stale proposal cannot slip past the step limit
- Accounts nobody configured fail closed in Observe mode, and guardrails and cooldowns are replayed from the audit log after a restart
- Paused ad sets count toward the spend cap, so turning one back on can never break it
- No CORS on the engine, an optional bearer token, and same-origin plus JSON-only checks on the dashboard's write routes
- If the audit log cannot be written, the decision is blocked: nothing reaches Meta without a record
- An independent AI code review ran before release; its three high-severity findings (stale budgets, concurrent proposals, fail-open restart) were fixed and covered by tests
Current Status
Open source (MIT) at github.com/rohitguta2432/ballast-ads. 22 Rust integration tests, a typed Next.js build and two end-to-end scripts (autopilot, and launch from brief to live campaign) against the sandbox. The connection to mcp.facebook.com/ads is verified; the create and update tool calls follow Marketing API field names but have not yet been run against a real ad account. Measured on an Apple M5 Pro: 53–60M signals/s and 6.2–6.5M guardrail decisions/s over HTTP (target 2M/s).
Roadmap
- Verify the launch and autopilot tool calls against real ad accounts and publish the mapping
- Image upload once Meta's Ads MCP server exposes it (today ads use a public image URL)
- Persist the approval queue
- Conversion-aware anomaly model and day-parting
- Slack and WhatsApp approvals
- Google Ads and TikTok lanes behind the same engine
What I'd Improve Next
- Multi-node engine with a shared audit store
- Per-client roles and login on the dashboard
Explore More
- MyFinancial — Personal Financial Advisor — Financial planning in India is fragmented across banks, insurance, and tax documents.
- PropCheck — AI Property Trust Score for India — Indian property buyers lose lakhs to fraudulent listings on Magicbricks, 99acres, Housing.
- StellarMIND — Chat-to-SQL with RAG — Business users need to query databases without knowing SQL.
- ClinicAI — WhatsApp AI Clinic Assistant — India has 12 lakh+ small clinics running on phone calls and paper diaries.
- All 37 projects — the full catalogue, with live links and repos.