Turn a target keyword into a full content brief with SERP analysis, intent, outline, internal links, and meta ready to hand to a writer.
You are an SEO content strategist. You produce briefs that writers can execute without a kickoff call. WORKFLOW: 1. Call keyword_research on the target keyword to find related queries and intent signals. 2. Call analyze_serp to pull the top 10 results and extract structure, depth, and angle. 3. Call build_brief to assemble the full content brief. 4. Call score_topical to rate the brief against existing site coverage. RULES: - Classify intent as one of: informational, navigational, commercial, transactional. Never skip. - The outline must beat the median SERP result on at least 2 dimensions (depth, freshness, structure, original data). - Always include 3 internal-link suggestions tied to existing site URLs the user provides. - Refuse to produce a brief if the SERP is dominated by sites with DR > 80 unless the user has DR > 60.
import { agent, tool } from "@agent-sdk"
import { z } from "zod"
const keywordInput = z.object({
keyword: z.string(),
market: z.string().default("US"),
})
const briefInput = z.object({
keyword: z.string(),
serp: z.array(z.any()),
intent: z.enum(["informational", "navigational", "commercial", "transactional"]),
internalUrls: z.array(z.string().url()).default([]),
})
export default agent({
model: "claude-sonnet-4-6",
permissionMode: "bypassPermissions",
maxTurns: 18,
systemPrompt: `...`, // see System Prompt section above
tools: {
keyword_research: tool({
description: "Pull related queries, volume hints, and intent signals",
inputSchema: keywordInput,
execute: async ({ keyword, market }) => {
// Brave Search + suggest endpoints
},
}),
analyze_serp: tool({
description: "Fetch top 10 results and extract structural patterns",
inputSchema: keywordInput,
execute: async ({ keyword, market }) => {
// returns { results: [{ url, title, h2s, wordCount, schema }], median }
},
}),
build_brief: tool({
description: "Assemble final brief with outline + meta + links",
inputSchema: briefInput,
execute: async ({ keyword, serp, intent, internalUrls }) => {
// returns markdown brief
},
}),
score_topical: tool({
description: "Score brief against existing site coverage",
inputSchema: z.object({ brief: z.string(), siteUrls: z.array(z.string().url()) }),
execute: async ({ brief, siteUrls }) => {
// returns { topicalFit, cannibalRisk, score }
},
}),
},
})BRAVE_API_KEYBrave Search API keyAGENT_API_KEYServer-side API key for token exchangeMost content briefs cost $200 each from a freelance strategist and take 2 days. This produces a stronger brief in 4 minutes per keyword.