# Agent harness engineering: the system around the model

Source: https://www.serverless.direct/agent-harness-engineering

The model writes the answer. The harness decides what it sees, what it may touch, when a person checks its work and how you know it did the job right. We build that harness for coding agents and for business agents.

## Signs that an agent needs a harness

- **Results depend on who started the run.** Two engineers give the same task to a coding agent and get very different code, because the context and rules live in their heads.
- **The agent has more access than the task needs.** It runs with a developer's full credentials or a service account that can write anywhere.
- **Review happens at the end, if at all.** A long run produces a large change, and the reviewer has to accept or reject all of it.
- **Failures are hard to explain.** When a run goes wrong there is no record of what the agent read, which tools it called or why it stopped.

## What goes into an agent harness

We build the parts your agent is missing, in your repositories and your cloud account.

### Context and memory

The agent starts every run with the knowledge it needs and keeps what it learns where the next run can find it.

- Project rules and CLAUDE.md files for each repository
- Skills for recurring tasks
- Notes and state stored between runs
- Context trimmed to what the task needs

### Tool permissions and sandboxing

The agent can only use the tools and data a task needs, and risky work runs in an isolated environment.

- Allow and deny lists for tools and commands
- Short-lived, narrowly scoped credentials
- Isolated environments for code execution
- Hooks that block actions your policy forbids

### Checkpoints and verification

Work is split into steps that a person or an automatic check can verify before the agent moves on.

- Human approval on the steps you mark as risky
- Tests, type checks and linters the agent must pass
- A second agent or script that checks the result
- Small changes that are easy to review

### Evals in CI and tracing

Every change to prompts, tools or models is tested before it merges, and every production run leaves a trace.

- An eval suite that runs in your CI pipeline
- Traces of each step, tool call and result
- Cost and duration per run
- Failed runs turned into new eval cases

## How we build a harness

We start from the agent you already run, or the one you plan, and look at how it fails.

1. **Observe.** We watch real runs, read the logs and list the failures and near misses.
2. **Set the boundaries.** With your security and engineering leads we agree on what the agent may read, change and decide alone.
3. **Build the harness.** We add context files, permissions, checkpoints, evals and tracing in your repositories and pipelines.
4. **Tighten over time.** Each failure becomes an eval case or a new rule, and approvals are relaxed only where the record supports it.

## What we build harnesses with

- Claude Code
- Claude Agent SDK
- Model Context Protocol (MCP)
- Claude Code hooks
- Claude Code subagents
- GitHub Actions
- AWS IAM
- AWS Step Functions
- Amazon CloudWatch

## Where the engineering habits come from

Access control, CI pipelines and monitoring are the same disciplines we have applied to AWS systems for more than 10 years. The projects below are AWS work.

- [Millnorway: New IoT solution to meet a growing customer demand](https://www.serverless.direct/works/millnorway.md)
  We helped a home appliances manufacturer overcome their IoT challenges with the help of AWS services like IoT Core and TimescaleDB. The new solution ensures efficient device management, optimized data processing, and improved security.
- [CampaignMeister: Building AWS Infrastructure](https://www.serverless.direct/works/campaignmeister.md)
  We created a robust and scalable AWS infrastructure for CampaignMeister, enabling fault tolerance, high availability, enhanced security, and cost optimization.
- [Thoughtful Automation: Architecture Improvements](https://www.serverless.direct/works/thoughtful-automation.md)
  We conducted an architecture audit for Thoughtful Automation, addressing backend and frontend challenges. Through backend refactoring, frontend reconstruction, and AWS architecture enhancements, we improved performance, reduced response times, and enhanced security.

> Great work on AWS project. Good addition to internal team
>
> Ade Akin-Aina, Senior Program Manager, GoDaddy

> Their technical skills and work ethics were very impressive.
>
> Mikko Mäki-Rahkola, CTO, MR Living Oy

## FAQ

### What is an agent harness?

Everything around the model that shapes an agent's work: the context it receives, the tools and permissions it has, the checks on its output, and the records of each run.

### Why does the harness matter as much as the model?

The same model gives very different results depending on what it can see and do. Many agent failures trace back to missing context, too much access or no verification step.

### Do you build harnesses for Claude Code?

Yes. For an engineering team we set up shared project rules, skills, hooks, permission settings and CI checks, so every engineer's Claude Code runs under the same rules.

### Do you build harnesses for business agents too?

Yes. For an agent that runs a business process, the harness covers its tools, approval steps, evals and tracing on your AWS account.

### Can you add a harness to an agent we already built?

Yes. We review how it runs today and add the missing parts without rewriting the agent itself.

### How do we know the harness works?

Its evals run in CI on every change, and its traces show each production run. You can see when a check caught a problem and when a run passed.

## Related

- [AI agent development](https://www.serverless.direct/ai-agent-development.md): An agent that runs one business process in your AWS account.
- [LLM development services](https://www.serverless.direct/llm-development.md): Prompts, evaluation, latency and cost for an LLM feature.
- [LLM evaluation services](https://www.serverless.direct/llm-evaluation.md): Tests that show an LLM feature is ready to ship and stays that way.

## Tell us about the agent you need to trust

Describe what the agent does today and where it goes wrong. Kyrylo replies with the next steps.

## Contact
- Email: hello@serverless.direct
- Book a call with Kyrylo Kozak, Founder and CEO: https://meetings-eu1.hubspot.com/kyrylo-kozak
- Website: https://www.serverless.direct
