This AI framework lets agents fix their own bugs and boosted performance by up to 60%

Researchers at the Shanghai Artificial Intelligence Laboratory have developed a framework called Self-Harness that allows AI agents to automatically rewrite the rules governing their own behavior. Ben Dickson reports for VentureBeat that the system delivered performance improvements of between 33 and 60 percent on a standard benchmark.

The key concept here is the “harness”: the layer of instructions, tools, memory settings, and recovery procedures that surrounds a language model and shapes how it behaves. Many agent failures stem from problems in this layer, not from the underlying model itself. Until now, engineers have fixed these problems manually, relying on intuition rather than systematic testing.

How the system improves itself

Self-Harness works through a repeating three-stage loop:

  • The agent runs tasks and analyzes where it fails, looking for recurring patterns.
  • It then proposes targeted changes to its own operating rules based on those patterns.
  • Each proposed change is tested. Only edits that improve performance without causing new problems are accepted.

In tests, one model kept getting stuck in endless loops until it timed out. Self-Harness identified the pattern and added a rule forcing the agent to stop and change its approach after 50 tool calls. Another model repeatedly retried failed commands until it accidentally deleted necessary files. The system introduced a rule forbidding duplicate commands and requiring immediate file recovery.

Lead author Hangfan Zhang notes that the system is best suited to environments where failures are measurable and where trial-and-error is relatively safe. Coding, internal workflow automation, and DevOps pipelines are ideal. Medical decision-making, legal work, or safety-critical infrastructure are not.

Zhang also points out that this does not eliminate the need for human engineers. Their role shifts from manually fixing individual prompts to designing the feedback systems that make automated improvement possible.

Stay up to date

AI for content creation: the latest tools, tips and trends. Every two weeks in your inbox:

More info …

About the author

Related posts:

Advertisement

×