Prompt, Context, Harness and Loop Engineering
Since the rise of frontier large language models (LLMs), a new branch of software engineering has emerged around a simple idea: how can we build better AI systems without changing the model itself? Unlike fine-tuning or reinforcement learning, these techniques are non-destructive. They leave the model's weights untouched and instead focus on how we interact with it. What began as prompt engineering has gradually evolved into a broader set of engineering practices that I think of as prompt engineering, context engineering, harness engineering, and loop engineering. Prompt engineering is about asking the right question. Context engineering is about providing the right information. Harness engineering is about defining the boundaries within which an LLM or agent can operate. And loop engineering is about designing feedback loops that automate as much work as possible while involving humans only when they add real value. This blog explores these four layers and how they come together to build AI systems that are reliable, predictable, and practical.
Prompt engineering is the practice of designing prompts that guide a language model toward the desired behavior without changing the model itself. The objective is to produce the best possible response with as few interactions as possible by giving clear instructions, defining the model's role, specifying the desired output, and placing important information where the model is most likely to attend to it, typically near the beginning or the end of the prompt. For more complex tasks, few-shot prompting provides examples of successful outputs, allowing the model to infer the expected pattern instead of relying on ambiguous instructions. Finally, asking the model to verify or critique its own response before producing the final answer often improves reliability, especially for reasoning models. Ultimately, the quality of a prompt is measured not by its complexity, but by how consistently it produces accurate, reliable, and repeatable results across a wide range of inputs.
Context engineering is the practice of carefully selecting and managing the information provided to a language model during inference. While prompt engineering focuses on how we ask a question, context engineering focuses on what information the model receives to answer it effectively. This becomes especially important in RAG systems, where retrieving the most relevant chunks directly impacts the quality of the final response. Adding unnecessary or irrelevant context can increase confusion and hallucination. A perfectly designed prompt can still fail if the underlying context is incomplete, inaccurate, or poorly selected. The same principle extends to agentic systems, where each agent should receive only the information required for its specific role rather than being exposed to the entire workflow state. Effective context engineering is therefore about providing the right information, to the right component, at the right time.
Harness engineering is the practice of defining the boundaries of what an LLM or agent is allowed to do. While prompt and context engineering focus on guiding the model's behavior through instructions and information, harness engineering focuses on controlling its capabilities, tools, and permissions. For example, a coding agent may need access to modify code files, run tests, and debug applications, but it should not have unrestricted ability to delete files or make irreversible changes without approval. The goal is not to limit the agent's usefulness, but to provide the right tools while preventing unintended actions. A well-designed harness defines both what an agent can do and what it should never do, often incorporating human oversight for critical decisions. Ultimately, harness engineering is about creating a safe and reliable boundary around an agent's capabilities.
Loop engineering is the practice of designing iterative workflows where LLMs, tools, and humans interact efficiently to accomplish complex tasks. Unlike prompt and context engineering, which focus on improving the quality of individual model outputs, loop engineering focuses on optimizing the overall process, deciding when an agent should plan, execute, evaluate, retry, or request human input. As agentic systems become more capable, constant human involvement becomes a bottleneck, making it important to design loops that bring humans into the process only when their judgment adds meaningful value. While harness engineering defines what an agent can do, loop engineering defines how the agent should operate over time. The goal is not only better answers, but scalable systems that can handle thousands of personalized tasks with minimal intervention while maintaining reliability and control.
Looking at the evolution of AI engineering, each stage has focused on a different form of information management. Prompt and context engineering focus on what information a model receives, harness engineering defines what an agent can do, and loop engineering optimizes how these systems operate over time. As these systems become more capable, I believe the next frontier will be interaction engineering: designing how humans and agents, as well as multiple agents, collaborate effectively. The future challenge will not only be building smarter models, but creating better ways for these systems to communicate, coordinate, and adapt to different environments. Just as every industry has unique workflows, there may not be a universal interaction pattern. Instead, we will need personalized approaches that define how humans and AI systems work together.