← AI for marketing

Lesson 4 of 4 · Agents and harnesses

How to set up AI agents for recurring marketing work

How an agent’s setup works, and how to build one that checks its own work before you read it.

About 9 minutes · Checked 7 November 2026

An AI agent is a model that can take actions: search the web, open and edit files, run tools, and keep going until a job is done. The software around the model that makes this possible is called a harness. Claude Code, Codex, Cowork and ChatGPT's agent are all harnesses. For marketers, agents suit recurring work with several steps, like a weekly competitor brief or a monthly report.

The usual mistakes are writing a rule into the prompt and assuming the agent will always follow it, adding a second AI to “review” the work without telling it what to check, and building something elaborate before something simple works.

How it works

How an agent works

On its own, a model can only write text. It can't open a file or load a page. What it can do is write a request, such as “search for this” or “open that file.” The harness runs the request and puts the result into the context window. The model reads the result and picks the next step, and the loop repeats until the job is done or a limit is reached.

repeat until done, or a limit is reached

Anthropic's advice is to “find the simplest solution possible, and only increase complexity when needed.” Often a fixed sequence of steps, which Anthropic calls a workflow, does the job better than an agent that chooses its own steps.

Harnesses have five parts

When an agent goes wrong, work out which part failed and fix that part.

Prompt rules and harness rules

A rule written in the prompt is a request. A rule built into the harness is enforced. Tell a model “don't publish anything” and it will follow that most of the time, but now and then it misreads the situation and publishes anyway. Give it no publishing tool and it can't publish, however it reads the situation. Anything that must never happen belongs in the harness, as a missing tool, a permission or a check. Use the prompt for guidance.

Context is limited

Remember the desk from lesson 2. Everything the agent works with has to fit on it at once: the instructions, the files, the conversation and every tool result. When the desk fills up, older material gets summarized or dropped, and the agent can lose instructions it was given early on.

The fix is to keep a short index on the desk and the details in a drawer. Anthropic and OpenAI both landed on this: a short file that says what exists and where, which the agent reads first, with the details in separate files it opens only when it needs them. Claude's skills work the same way. Until a skill is needed, only its name and description sit on the desk, about 100 tokens (a short paragraph) each.

Harnesses go out of date

Each part of a harness makes up for something the model can't do well on its own. When a newer model can do that thing itself, take the part out, because all it adds is time and cost.

Worked examples

Three examples

Worked example 1 · A weekly competitor brief (illustrative)

The five parts, filled in

Every Monday, an agent should write a one-page brief on two competitors that a rep can use with a buyer. Its setup looks like this.

PartFor the competitor brief
ContextA short CLAUDE.md (a notes file the agent reads first) with the goal, the reader and what a good brief looks like; the buyer profile; last week's brief.
ToolsWeb search, and saving a copy of each competitor's pricing and product pages with the date. No email or publishing tool.
StateA change log: what changed since last week, and open questions.
ChecksEvery price matches a page saved that day. Every claim names its source. Anything that can't be confirmed is marked unknown.
LimitsTwo attempts to fix a failed check, then stop and flag it to you.

The checks do the work that “make sure every fact is accurate” in the prompt can't, because they compare the brief against something saved outside the model.

Worked example 2 · Agents building an app for hours

What Anthropic's harness fixed, part by part

In November 2025, Anthropic's engineers described agents building a web app across many sessions, each starting with an empty context window. Each fix maps to one part.

  1. State: split the first run from the rest. A first agent writes a setup script, a progress log and a feature list, and saves the starting code. Every later session works on one feature and leaves the code clean.

    Without this, agents tried to build everything at once and ran out of room halfway through a feature.

  2. Checks: every feature starts as failing. Each entry in the feature list begins as "passes": false, and a clone of claude.ai had more than 200 of them. The agent was told it was “unacceptable to remove or edit tests.”

    Agents had been calling the project done early and marking features as passing without testing them.

  3. Tools: test like a user. Claude tended to run small code tests and miss that a feature didn't work from start to finish. Giving it a browser to click through the app, and telling it to test “as a human user would,” fixed much of that.

  4. Checks again, four months later. A March 2026 follow-up split the work between a planner, a builder and a reviewer that clicks through the running app and grades it against strict criteria.

    A single agent took 20 minutes and $9 and built a game where nothing responded to input. The three-role setup took six hours and $200. Even the reviewer slipped at first, talking itself into approving problems it had spotted.

Worked example 3 · A real session

The video in lesson 1, built by an agent

The explainer in lesson 1 was built by an agent in Claude Code on 7 November 2026. Step through it and watch which part does the work at each step.

Run the traceReal session
ContextToolsWorkChecksLimitsState

The harness said no twice, once through network rules and once through a permission check, and both times the agent changed its approach instead of working around the rule. Looking at the frames found four problems that a clean render hid. Saved state made the before-and-after comparison possible, because version 1 stayed on disk. The last mistake was caught by a separate check after publishing, which compared every number with its source.

Your turn

Fix the Monday brief

Your weekly competitor brief runs as an agent. In week three it quotes a competitor's old price, even though its instructions say “make sure every fact is accurate.” You have an hour before next Monday's run. What do you change?

Add “double-check every price” to the instructions.

What happens

Week four is right. In week six the competitor changes its plans, the price is wrong again, and the brief says every price was double-checked.

An instruction is a request. The model can't check against a page it never opened.

Add a second agent to review the brief.

What happens

The reviewer approves the brief, wrong price included, and praises how thorough it is.

A reviewer with no criteria and nothing to compare against tends to agree. Even Anthropic's reviewer talked itself into approving problems it had spotted.

Add a check: every price must match a pricing page saved that day, with two tries to fix it, then stop.

What happens

In week six the check fails. The agent opens the pricing page again, sees the new plans, fixes the brief and logs the change. If the page had been blocked, it would have stopped and told you.

The check compares the brief against a saved page, so it holds whatever the model believes.

Rebuild it as a planner, a writer and a reviewer.

What happens

It works in the end, and every run now takes much longer and costs much more than one check would have.

Add a part only when you can name the problem it fixes. Here, one check does.

Takeaway

What you can do now

You can name the five parts of any agent setup, put the rules that must hold into the harness instead of the prompt, and fix a failing agent by finding the part that broke, usually by adding a check against a saved source. Pick a job you have this week and start from the How to section of the lesson that fits it.

How to

How to set up a small agent for a recurring task

If the work is explaining, planning or drafting from material you can paste in, use a chat (Claude or ChatGPT). If it needs a folder of files, several steps, or picking up again next week, use an agent tool (Claude Code, Codex or Cowork), and stick with one while you learn.

If you've only used chat, start with Cowork in the Claude desktop app. Choose Work in a folder and pick a folder made for this task. Keep the default Ask before acting mode. It's one of the harness's limits: it pauses before anything that reaches outside the folder, such as sending an email.

  1. Fill in the five parts for your task, like the table in worked example 1.
  2. Create a folder for the task, open it in your agent tool, and paste the prompt below.
  3. Do one run and read every failed check.
  4. Test the checks: put a wrong price into a draft on purpose and confirm the run stops.
Set up this folder for a recurring task: [task, e.g. weekly competitor brief].

Create:
- CLAUDE.md, under 60 lines: the goal, the reader, what good output looks like, and a map of where things live. Point to files; don't paste their contents.
- sources/ for dated source material. Never edit these files.
- checks.md: 4–6 checks a draft must pass, each specific enough to fail.
- progress.md: what's done, what's next, open questions.

Then do one run:
1. Draft the output.
2. Run every check and show me which failed and why.
3. Fix failures (at most two attempts per check), then stop and ask if any still fail.
4. Update progress.md with what changed and the next step.

Use more than one kind of check. A script can confirm that every claim has a source attached. You can judge whether the source supports the sentence. A second model can look for gaps, but two models agreeing isn't proof on its own.

Done when a deliberately wrong price in a test run fails a check and stops the run before it reaches the brief.

Sources and fact check

Checked 7 November 2026. The Anthropic material was checked against the original engineering posts and the skills documentation, and every figure held up. OpenAI's post couldn't be loaded from the checking environment, so the lesson uses only what search results quoted from it directly.

  1. Anthropic: Effective harnesses for long-running agents (26 November 2025).vendor
  2. Anthropic: Harness design for long-running application development (24 March 2026).vendor
  3. Anthropic: Building effective agents (19 December 2024).vendor
  4. OpenAI: Harness engineering (February 2026).vendor
  5. Claude docs: Agent Skills and best practices.vendor
  6. Claude Code: Explore the context window.vendor
  7. Anthropic: Use Claude Cowork safely (checked 9 November 2026).vendor

Other lessons

Lesson 1 · AI video

How to quickly get started with AI video for marketing

Read the lesson

Lesson 2 · Second brains

How to give your AI assistant your marketing knowledge

Read the lesson

Lesson 3 · SEO and AI answers

How to show up in search and AI answers

Read the lesson