Skip to content
Alpue Studio

Blog / Agents and harnesses

Agent harness examples: the parts, shown on one ad question

An agent harness is the software around a language model that runs its loop, executes its tools, holds its context and applies its permissions. LangChain writes it as Agent = Model + Harness, and Anthropic calls its Claude Agent SDK a general-purpose agent harness. The examples below follow one question, why conversions dropped last week, through each part and show what is missing when a part is absent.

What counts as an agent harness

The vendors word it differently. Microsoft's Learn page calls a harness "the runtime scaffolding that turns a language model into an agent that can perform work". Google Cloud describes "a software environment that surrounds an artificial intelligence model", with tools, memory of past interactions and multi-step tasks. LangChain says a raw model is not an agent until a harness gives it state, tool execution, feedback loops and enforceable constraints.

Named examples, as of November 2026, and what each one's own documentation lists:

HarnessPublisherWhat the documentation lists
Claude Agent SDKAnthropicBuilt-in tools, hooks, subagents, MCP, permissions, sessions
Claude Managed AgentsAnthropicA hosted harness, labeled beta, that runs the agent loop, with sessions in a cloud sandbox that Anthropic manages or one you host
Agent Framework HarnessMicrosoftAn iteration limit on tool calls, todo tracking, plan and execute modes, file memory, tool approval, OpenTelemetry, optional background agents and shell tools, in .NET, Python and Go
Codex, in OpenAI's harness engineering postOpenAIA repository with an AGENTS.md file, documentation and feedback loops that a team built around Codex agents

Sources draw the line between a harness and a framework in different places. Google Cloud says an orchestration framework focuses on the developer experience of writing the code and a harness on the runtime environment. Microsoft ships its harness inside Agent Framework.

The question with a chat model and with a harness

A chat model with no tools answers from what the person pastes in. Google Cloud writes that "Language models can't browse the web, query databases, or send emails on their own." Asked why conversions dropped last week, it can list usual causes, such as broken tracking, a budget cut or a promotion that ended, but it cannot check them. The person runs each query and pastes the result back.

A harness closes that gap with a loop. The Agent SDK documentation describes the cycle. The model receives the prompt with the system prompt, tool definitions and history. It replies with text, tool call requests or both. The SDK runs the requested tools and feeds the results back, and the cycle repeats until the model answers with no tool calls. Anthropic's guide to building agents says agents are typically just language models using tools based on environmental feedback in a loop, and that stopping conditions such as a maximum number of iterations keep control. The SDK offers max_turns and max_budget_usd for that, and says that without limits the loop runs until the model finishes by itself.

Tools that query the ad account

The first tool call in our example is a query. Google Ads reports come from GAQL, and a harness exposes it as a tool the model fills in.

SELECT segments.date, campaign.name, metrics.clicks,
       metrics.cost_micros, metrics.conversions
FROM campaign
WHERE segments.date DURING LAST_14_DAYS
ORDER BY segments.date

Google's date range documentation defines LAST_14_DAYS as the last 14 days not including today, evaluated in the account's time zone, so on 26 November it covers 12 to 25 November. The metrics reference says metrics.conversions counts only conversion actions whose include_in_conversions_metric attribute is true. So a changed conversion setting can move this number without a single click changing.

There is also a timing trap. A 2019 announcement in the Google Ads Help Center says standard columns attribute a conversion to the date of the click, and the metrics reference lists metrics.conversions_by_conversion_date for the date it happened. The newest days can therefore still gain conversions after the agent has read them, so part of a drop may fill in later.

The second query asks what changed in the account.

SELECT change_event.change_date_time, change_event.user_email,
       change_event.change_resource_type, change_event.changed_fields,
       campaign.name
FROM change_event
WHERE change_event.change_date_time >= '2026-11-12'
  AND change_event.change_date_time <= '2026-11-27'
ORDER BY change_event.change_date_time DESC
LIMIT 200

The change event guide requires a date filter within the past 30 days and a LIMIT of at most 10,000 rows, and its samples set the upper bound to tomorrow. It warns that change events may omit some changes that the web client's Change History shows. The field reference lists campaign among the resources selectable with change_event, so campaign.name is valid here. A harness passes on what a tool returns, gaps included.

The sandbox that runs code on the data

Two weeks of daily rows per campaign is a lot to total in prose. LangChain gives the model a general-purpose tool such as bash, so that it solves problems by writing and executing code, and lists a sandbox among the infrastructure a harness bundles.

import pandas as pd

df = pd.DataFrame(rows)  # rows returned by the first query
df["period"] = (pd.to_datetime(df["date"]) >= "2026-11-19").map(
    {True: "last 7 days", False: "prior 7 days"}
)
by_campaign = (
    df.groupby(["campaign", "period"])[["clicks", "cost_micros", "conversions"]]
    .sum()
    .unstack("period")
)
by_campaign["conv_change"] = (
    by_campaign[("conversions", "last 7 days")]
    - by_campaign[("conversions", "prior 7 days")]
)
print(by_campaign.sort_values("conv_change").head(10))

The output shows which campaigns lost conversions and whether their clicks and cost fell with them. Clicks that held steady while conversions fell suggest tracking or the landing page. Clicks that fell suggest budgets, bids or ad approvals, which is where the change event query helps.

Context and memory before the question

Which campaigns are brand search, which conversion actions count, and that a sale ended on the 14th are facts the account does not return in a query. A harness supplies them through memory files. LangChain describes memory file standards such as AGENTS.md that are injected into context at the start of a session and that the agent can edit, so knowledge from one session reaches the next.

OpenAI's team tried one big AGENTS.md file, wrote that it failed because "Context is a scarce resource", and replaced it with a file of roughly 100 lines that points to a docs directory. Anthropic's context engineering post recommends the smallest possible set of high-signal tokens, describes context rot as recall falling as the window fills, and favors keeping lightweight identifiers such as stored queries that are loaded through tools when needed.

For work that outlasts one window, Anthropic's long-running agents post uses a progress file and git history so a fresh session can see what happened. Its later harness design post says models lose coherence as the window fills and that compaction leaves context anxiety in place. Context resets solve both, at the cost of orchestration complexity, token overhead and latency on each run.

Delegation to other agents

The conversion question spans Google Ads, Meta and Google Analytics. The Agent SDK's subagent documentation says a subagent runs in its own conversation, its intermediate tool calls stay inside it, and only its final message returns to the parent. Subagents can run in parallel, and Anthropic's context engineering post says a returned summary is often 1,000 to 2,000 tokens.

Anthropic's agents guide adds that autonomy means higher costs and the potential for compounding errors, and recommends extensive testing in sandboxed environments with guardrails.

Permissions and approval

Suppose the agent concludes that one campaign should be paused. Reading the account and changing it are different acts, and the harness decides which needs a person. The SDK's permissions page lists the order a tool call passes through, starting with hooks, then deny rules, then ask rules, and says a deny rule holds even in bypassPermissions mode. Microsoft's harness lists tool approval with standing approvals and auto-approval rules enabled by default.

The parts, on this question:

PartJob in the conversion questionWithout it
LoopRuns query, reads result, queries againThe person relays each result by hand
ToolsGAQL on performance and on change eventsThe model lists causes it cannot check
SandboxTotals two weeks of rows by campaignThe arithmetic happens in prose
Context and memoryBrand campaigns, counted conversion actions, last promotionThe agent flags a planned drop as a problem
DelegationOne subagent per data source, summaries returnedOne window fills with raw rows
PermissionsReads run freely, a pause needs a personOne wrong call changes live spend

Alpue Studio as a harness

Alpue Studio is a harness built for marketing. The agent writes its own GAQL against Google Ads and queries Meta, Sklik, Google Analytics 4, Search Console and Merchant Center, and each query opens under "See query". When a question needs more than a query, it writes Python and runs it in a cloud sandbox, and the code is shown with the result. It keeps notes between conversations and hands tasks to departments such as Performance and Analytics. The agents page has more.

The Python the agent ran in its sandbox, with the result

The agent has no tool that pushes changes to an ad account. A campaign reaches Google Ads, Meta or Sklik only when a person with the right role drags a slider, and the security page covers keys and workspaces. Its custom connections are read-only, it has no autopilot mode, and there is no self sign-up, so teams ask for access on the access page. The difference between a harness and a single agent is in AI agent vs harness, and the difference from an MCP server is in MCP server vs agent harness.

Questions

What is an agent harness?

It is the code and configuration around a model that is not the model itself. LangChain lists the system prompt, tools, a sandbox, orchestration and hooks, and Microsoft lists approval policies and conversation state.

Is a harness the same as an agent framework?

The sources disagree. Google Cloud treats a framework as the developer's code and a harness as the runtime, while Microsoft's harness is part of its Agent Framework.

What are examples of agent harnesses?

The Claude Agent SDK and Claude Managed Agents from Anthropic, the Harness in Microsoft's Agent Framework, and the Codex setup OpenAI describes in its harness engineering post.

Does the harness matter more than the model?

The documentation does not measure that. Anthropic says harness design has a substantial impact on the effectiveness of long-running agentic coding, and OpenAI wrote that early progress was slow because the environment was underspecified. Both describe software work, none of the sources above tests ad accounts, and neither company measures a harness change against a model upgrade, though Anthropic's later post says Opus 4.5 let it drop context resets from one harness.

Sources

Keep reading. Agents and harnesses

The posts on this topic →

Brief the agent. Approve what it builds.

Alpue Studio reads your ad accounts, runs code on the data and prepares campaigns and reports. Your accounts stay read-only until someone on your team slides.