What the agent does
This is for a company that sells client-reporting software to marketing agencies. On the first working day of each month an agency's account managers open Semrush, export each client's Position Tracking campaign, paste the numbers into a slide deck and write two paragraphs on what moved. The reporting software already builds the deck and sends it; what it lacks is the agency's Semrush data, which sits behind the agency's own Semrush login and is paid for in the agency's own API units. The company saves one agent as a template that names Semrush, and makes one agent from it per agency.
The company connects its own Semrush first with POST /me/connections {"type": "mcp", "name": "semrush", "url": "https://mcp.semrush.com/v2/mcp", "auth": {"mode": "oauth"}} and saves the template naming semrush. When an agency links Semrush in the software, its backend calls POST /o/{org}/agents {"template": "<template id>", "name": "seo-<agency id>"} and then POST /o/{org}/agents/{agent}/connections {"type": "mcp", "name": "semrush"}, and opens the authorize_url for the agency's admin, who signs in on Semrush's login page. Semrush's docs say OAuth is the default for its MCP server, that SEO data needs one of the plans that include API units, and that MCP requests use the same units as direct API requests.
On a run the agent works from the client domain and the Position Tracking campaign the request names. It calls position_tracking to find the report it needs, get_report_schema to learn that report's parameters, and execute_report for the tracked keywords with their position at the start and end of the month, the ranking URL and search volume. It runs the same three steps with domain_overview for the domain's organic traffic estimate and keyword count, month on month. Semrush's docs say the Projects API is read only through MCP, so the agent can read the agency's campaigns but cannot create or change one.
From those rows it builds what the deck needs: keywords that entered the top 10, keywords that left it, the ten largest gains and losses, keywords whose ranking URL changed, and keywords that dropped out of the results it tracks. It returns them as JSON for the software to lay out. It writes no advice and makes no forecast; the commentary on why a page moved stays with the account manager who knows what the client changed.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "<agent id>",
"input": "Build the October 2026 SEO numbers for client Harbor Dental (harbordental.example). Position Tracking campaign: \"Harbor Dental - Local\", database us. Call position_tracking to find the rankings report for that campaign, get_report_schema for its parameters, then execute_report for every tracked keyword with position on 2026-10-01 and 2026-10-31, ranking URL on both dates and search volume. Then call domain_overview, get_report_schema and execute_report for harbordental.example in the us database for September and October 2026: organic keywords and organic traffic. Make no other report calls. Return only JSON: {campaign, period, keywords_tracked, entered_top10: [{keyword, from, to, url}], left_top10: [...], biggest_gains: [10 of {keyword, from, to}], biggest_losses: [10 of {keyword, from, to}], url_changed: [{keyword, url_before, url_after}], not_ranking: [keyword], domain: {organic_keywords: {sep, oct}, organic_traffic: {sep, oct}}, api_errors: [string]}. Positions are numbers or null when not ranking. Write no commentary."
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
The answer is JSON in the session's result and in the run.completed webhook. The reporting software drops the numbers into the client's deck: a table of the keywords that entered and left the top 10, the gains and losses, and the domain's traffic estimate beside last month's. The account manager opens the draft deck, writes the paragraph on what happened, and sends it as they already do.
What the account manager checks: that the campaign is the right one for the client, since an agency often tracks a local and a national campaign for the same domain; keywords listed in url_changed, which can mean a new page is competing with an old one; and anything in api_errors, which usually means the agency's Semrush units ran out mid-month. Semrush's traffic figure is its own estimate, and the deck should label it that way.
Run it on every first working day of the month
The reporting software's scheduler sends one POST /o/{org}/sessions per client on the first working day, with the agency's agent id as agent, the client and campaign in input, and a request_id that is a UUID v5 of the client id and the month, so a retried job does not spend the agency's Semrush units twice.
An agency with sixty clients gets sixty runs that morning. Runs past the key's concurrent limit wait queued and start as slots free, so the scheduler sends them all at once and collects each run.completed webhook as it arrives.
The use case this job follows, with its automation and trigger: Run an agent per customer task.
Why run it on Rush?
Each agency's Semrush sign-in belongs to its agent alone, so one agency's runs can never read another agency's campaigns, and the reporting company never holds a Semrush key. Every call spends the agency's own Semrush units under its own plan, which keeps the cost of the data where the agency already pays for it. The session's accounts field names the Semrush connection each run used.
Each run has its own computer and a record of every report it called, so when a client asks why a number in the deck differs from what they see in Semrush, the agency can open that month's session and see the exact parameters. GET /o/{org}/sessions?agent=<agent id> lists one agency's runs with their total_cost_usd, which the company needs to price the feature per client.
Frequently asked questions
Which Semrush plan does the agency need?
Semrush's MCP page lists the plans whose API units cover SEO data, and says other plans can add an API units package. Every report the agent runs spends those units, so the prompt names exactly which reports to call and nothing else.
Can the agent set up a Position Tracking campaign for a new client?
No. Semrush's docs say the Projects API is read only through its MCP server. A person sets up the campaign in Semrush, and the software starts sending runs for it the next month.
Why not write the commentary too?
The agency knows that the client rebuilt its services pages or paused a campaign; the rankings alone do not. The numbers are the slow part to gather, and the paragraph is where the account manager's judgement is worth paying for.
What happens when the agency disconnects Semrush?
The software removes the sign-in with DELETE /o/{org}/agents/{agent}/connections/{id}. Until someone at the agency signs in again, GET /o/{org}/agents/{agent} lists Semrush under missing_connections and each run is refused 422 CONNECTION_NOT_READY before a sandbox starts, so the software can show a reconnect button instead of an empty report.
More Semrush jobs
More jobs like this: Run an agent per customer task
- Time Audit From a Microsoft Calendar Each Month (Microsoft Calendar)
- Create a Notion Onboarding Page for Every New Customer Through an API (Notion)
- How to Prep Board Meeting Financials From QuickBooks (QuickBooks)