How to Build an Agent Harness in One Prompt: Build agent harnesses for any LLM using the open source OpenWorker Agent Harness SDK

Building an agent harness has been a rapidly growing method to build an AI agent.

Share
Cartoon of a smiling man driving a carriage pulled by cheerful robots on a dirt road with blue sky.

Dear friends,

Building an agent harness has been a rapidly growing method to build an AI agent. The OpenWorker project just released the open source OpenWorker Agent Harness SDK, which I invite you to check out. If you have not built an agent harness before, I encourage you to do so. (This skill is reflected in the AI Engineering Skills Map, and job interviews increasingly ask people if they’ve done this.) This letter describes how to steer coding agents to quickly build an agent harness.

An agent harness is the code that wraps around an LLM and provides it with context, tools, and guardrails to turn it into an application. Since late last year, LLMs have become powerful enough that it’s practical to build many applications by repeatedly calling an LLM and letting it decide what to do next. For example, you might build your own coding agent by giving it tools (functions) to read/save files, run shell commands, execute code the agent has written, and read output of the executed code. Given these tools, you can build a simple coding agent that can save code to a file, run it, see if there are any errors, and iterate to improve the code. 

To take a second example, here’s how you can build a simple demo agent that organizes files. First, in a new/empty project directory, run in bash: 

npx @openworkerai/openworker-harness-builder --agent claude --project.  

Replace “claude” above with “codex” if your coding agent is Codex. This should install OpenWorker’s openworker-harness-builder in the current directory. Then, prompt your coding agent with a prompt like:

Use the openworker-harness-builder skill to build a small local file-organizing agent using the OpenWorker Harness SDK. Generate 10 sample text files in a dedicated demo directory. The app should have an agent that has tools to list and read files, create/delete subdirectories, and move files. Configure the harness such that all of these tools are restricted to only the demo directory. Use OPENAI_API_KEY in ~/.env and gpt-6.1-terra [or ANTHROPIC_API_KEY and claude-sonnet-5-5]. Prompt the agent to organize files, create subdirectories, and move files into appropriate subdirectories to organize the files. Require user approval before each subdirectory creation and file move, showing the proposed operation. Display tool activity so the user can see what happens at each step of the demo. As it is running, also display a succinct description of the status of the agent loop so the user can see what’s happening.

Building an agent harness requires managing LLM context. For long-running agents, this requires building a memory architecture (such as memory compaction when the context gets too long). A harness may also need guardrails (such as input/output checking), a mechanism for approvals, security controls (for example, keeping credentials away from the LLM), and sandboxing. OpenWorker Desktop is finding usage in many security workflows, and Rohit Prsad and I built the OpenWorker Harness SDK to make it easier to improve OpenWorker Desktop. But we were delighted to hear that several other groups found the Harness SDK useful for building other agents, which is why we’re releasing it as open source. You can use it to build agents that run locally or are deployed online.

If you have not yet built an agent harness, please follow the steps above and give it a shot. Unlike the agent harness tools offered by model providers, OpenWorker’s Harness SDK is open source and not beholden to any model, so you can easily build agents that run with any model provider and on any cloud.

Keep building!

Andrew