Campaign Agent
14
Campaigns
3
Off target
3
Moves awaiting approval
| Campaign | Spend | Cost per lead | Target | Proposed move |
|---|---|---|---|---|
| Search: integration platform | $18,400 | $92 | $110 | Raise daily budget 15% |
| Display: retargeting | $7,200 | $214 | $120 | Cut daily budget 30% |
| Social: webinar | $5,100 | $118 | $120 | No change |
| Search: competitor terms | $9,800 | $141 | $110 | Cut daily budget 20% |
What matters here
- A campaign performance agent joins ad spend to leads and pipeline by campaign, so the numbers come from one place.
- Changing a campaign budget is a tool marked for approval, so a marketer sees the exact change before it happens.
- Each proposal carries its evidence: spend, leads, cost per lead and pipeline against the target.
- Targets live in the app where marketing can edit them, so the agent applies the same rules every week.
- The agent drafts the weekly summary and never posts it, so what leadership reads stays with a person.
Who this is for
You run marketing operations or demand generation. The data lives in the ad platforms, the marketing automation tool and the CRM, and the weekly report takes a day to build.
How it works in practice
One week of campaigns, from raw numbers to a decision a marketer makes in minutes.
- 1
A scheduled run starts
A scheduled function runs the agent early each Monday over the previous week.
- 2
It pulls spend and results
Spend by campaign from the ad platform, and leads and pipeline by campaign from the CRM.
- 3
It compares to targets
Cost per lead and pipeline against the targets marketing set, with small samples noted, not judged.
- 4
It proposes the moves
Raise or cut a budget, with the numbers behind each and the campaigns it compared.
- 5
A marketer approves
change_budget is marked for approval, so the run pauses and shows the exact change. The marketer approves, edits or declines.
- 6
It applies and writes the summary
Approved changes go to the ad platform. The agent drafts the weekly summary for a person to read and post.
What a campaign agent is made of
Targets, read tools, one gated write and a draft.
Your targets
Cost per lead and pipeline targets per campaign, kept in the app's database where marketing can edit them.
Read tools
Spend by campaign, leads and pipeline by campaign, and site conversions. Read only.
One write tool, gated
change_budget, marked for approval, so every budget move waits for a marketer.
A draft tool
Saves the weekly summary in the app. It has no way to post it.
The prompts
Paste these into Claude Code, Codex or Cursor in order. Each one leaves you with something that runs, so you can stop after any step.
These prompts start from a Helix project, which is what handles sign-in, credentials and hosting. Start with Helix.
Targets and the proposal queue
What good looks like, and where proposals wait.
Create a Helix app: a campaign performance agent for marketing.
Store campaigns with a name, channel and owner. Store targets that marketing can edit: cost per lead and pipeline per campaign, and a minimum number of leads before a campaign is judged.
Store proposals: the campaign, the move, the numbers behind it (spend, leads, cost per lead, pipeline) and the outcome (waiting, approved, edited, declined) with who decided and when.
Show a table of this week's campaigns against their targets, and the waiting proposals with approve, edit and decline on each.
The agent and its tools
Read, compare, propose, wait.
Add an agent to the app that reviews last week's campaigns.
Give it these tools:
- get_spend: spend by campaign for a date range.
- get_leads_and_pipeline: leads and pipeline by campaign for a date
range.
- get_conversions: site conversions by campaign.
- change_budget: set a campaign's daily budget.
- draft_summary: save the weekly summary in the app. It must not post
anything.
Mark change_budget as needing approval every time.
For each campaign, compare cost per lead and pipeline to its target. Propose to raise or cut a budget only where the numbers clearly miss or beat the target, and show the numbers. If a campaign has fewer leads than the minimum, say there is not enough data and propose nothing.
Run it every Monday
A report that is ready before the meeting.
Run the agent early every Monday over the previous seven days.
Post to the marketing channel in Slack with how many proposals are waiting and a link to approve them.
Show a trend view: cost per lead and pipeline by campaign for the last 12 weeks.
Connect it to real systems
Your ad platform, your CRM, your analytics.
Now connect it to the systems we actually run.
Anything in angle brackets is a placeholder. Swap it for whatever we use.
<Google Ads>. Read spend by campaign, and set a daily budget when change_budget is approved.
<HubSpot>. Read leads and pipeline by campaign. Read only.
<Google Analytics>. Read conversions by campaign. Read only.
<Slack>. Post the Monday message to the marketing channel.
Only write through change_budget. Everything else is read only.
Ship it
A URL, and marketing on it.
Deploy my app.
What it connects to
The agent reads the ad platform and the CRM, and writes only through the tool that waits for approval.
-
Google Ads Read spend and results by campaign, and change a daily budget after approval. Reads and writes -
HubSpot Read leads and pipeline by campaign. Reads -
Salesforce The same, if that is your CRM. Reads
-
Google Analytics Read site conversions by campaign. Reads
-
Slack Tell the team the proposals are waiting for approval. Writes
Named systems are the ones most teams actually run, not a list of the only ones that work. Swap in whatever you use.
Running it for real
The build gets you a working agent. It can move real spend, so approval, credentials and the record matter most.
- 1
Deploy the app and its agent together
One command, or Deploy from CI on every merge, takes the app to a live URL. The agent ships with its app, so you can roll back any deployment.
- 2
Approval before any budget moves
change_budget waits for a campaign owner every time, who sees the campaign and the exact change. SSO decides who can approve.
- 3
Credentials held by Tray
The ad platform and CRM credentials are held in Tray, not in the code, so they can be rotated without a redeploy.
- 4
A named owner and every step logged
The app and its agent have a named owner. Every run, proposal and approved change is logged, and Tray streams the logs to your SIEM.
- 5
Know what the weekly review costs
AI usage shows per app, so the cost of the review is visible next to the spend it manages.