An AI agent can work perfectly in a demo and fail as soon as it encounters real users. In an article published on the Analytics Vidhya blog, the author introduces the concept of a “harness” and explains how the open-source platform Opik, developed by Comet, aims to automate the correction of failures in production.
The harness is all the code surrounding the model
The harness refers to all the code surrounding a large language model (LLM). According to the article, the LLM is the engine and the harness is the rest of the car. It organizes prompts, calls tools, manages the context passed to the model, and controls execution. The harness typically consists of instructions, tools, context and memory, a control loop, and checks.
The author states that the harness, not the model alone, determines an agent’s quality. With the same model, simply modifying the harness can produce significant performance gains. In most cases, however, these harnesses remain static: they are written once, deployed to production, and then only changed manually by an engineer. Errors are then reported on dashboards without feeding back into the code.
According to the article, each repair step thus relies on a human: spotting the problem, analyzing the trace, correcting the prompt or tool, verifying, and then preventing the case from recurring. A fix for one case can cause three others to fail, and adding a test case is often overlooked. Each new model introduces new failure modes, causing the harness to grow faster than teams can keep up.
Opik and its four-step loop
Opik is published under the Apache-2.0 license. It is used to trace, evaluate, and optimize LLM-based applications and agents. The first step, tracing, relies on the @opik.track decorator, which records each model call, tool call, and retrieval as a tree of spans. The article states that the tool works with LangGraph, CrewAI, the OpenAI Agents SDK, and over 50 other frameworks.
The second step is Ollie, a code assistant integrated into Opik’s interface. It analyzes a failing trace, explains the root cause, reads the code, proposes a diff, and re-runs the original input. Nothing is modified on disk without user validation. The third step, test suites, replaces annotated datasets with rules written in plain language, verified by an LLM judge. Finally, the Agent Playground runs the full agent from the interface, with the code remaining on the user’s machine.
An example with a support agent
The author builds a small support agent based on the gpt-4o-mini model. Its system prompt requests responses “as detailed as possible.” When asked about a deployment on Kubernetes, the agent claims the solution is supported, whereas the retrieved context does not mention Kubernetes. In the interface, the trace shows the two spans, the retrieval and the model call.
The test written in plain language requires that “the response does not claim that Kubernetes is supported.” When Ollie analyzes the trace, it identifies the system prompt pushing for precision, then proposes a modification to answer only from the context and to signal when the information is missing. The author validates the change, and the case is then added to the suite as a regression test. Executions are recorded as separate experiments, allowing comparison of success rates before and after the fix.
The comparison table published in the article positions Opik against Langfuse and LangSmith. It notably distinguishes licenses: Apache-2.0 for Opik, MIT for Langfuse’s core, proprietary software for LangSmith. The author specifies that Opik is the only one of the three to offer an agent that transforms a failing trace into a correction, and that human validation remains essential for each modification.
