<- all tokdocs

HALO: The Open-Source Framework That Lets AI Agents Optimize Themselves

Watch on TikTok

View on TikTok ->

HALO (Hierarchical Agent Loop Optimizer) is an open-source tool from Context Labs that watches your AI agents run, analyzes their execution traces, and then recursively suggests improvements. The concept is straightforward: instead of manually tuning your agent prompts and workflows, you let a system observe what the agent actually does and feed back targeted optimizations. The benchmarks shown in the video suggest meaningful gains across multiple models and evaluation conditions.

What HALO Actually Does

HALO is built on RLM (Reinforcement Learning from Machines), a technique where agent behavior is analyzed after execution rather than during it. The system captures full execution traces from any agent run, identifies where the agent made poor decisions or wasted steps, and produces concrete optimization suggestions. Those suggestions are then applied, and the loop repeats. Each cycle of observation and adjustment compounds the improvements from the last.

The key feature is that HALO is model-agnostic. It works on top of any existing agent, regardless of the underlying LLM. You do not need to retrain the model or change your agent architecture. You point HALO at your agent, let it run, and review the suggested changes.

The Benchmark Numbers

The video includes a bar chart comparing Baseline SGC (Scenario Goal Completion) against Peak SGC after HALO across four test conditions:

  • Gemini 3 Flash (dev): 36.8% baseline to 52.6% after HALO (+15.8 points)
  • Gemini 3 Flash (test_normal): 37.5% baseline to 48.2% after HALO (+10.7 points)
  • Claude Sonnet 4.6 (dev): 73.7% baseline to 89.5% after HALO (+15.8 points)
  • Claude Sonnet 4.6 (test_normal): 62.5% baseline to 73.2% after HALO (+10.7 points)

The dev set improvements are larger than test_normal in both cases, which is expected. The test_normal numbers are the more credible signal because they measure generalization to scenarios the optimizer did not directly train on. Even there, both models gained over 10 percentage points in goal completion rate.

Why This Matters for Agent Builders

Most teams building AI agents today rely on manual prompt engineering and ad hoc testing to improve performance. You run the agent, read the output, tweak the prompt, and repeat. That process is slow and does not scale across dozens of agent tasks or tool-calling chains.

HALO automates that feedback loop. It treats the agent's execution trace as structured data, runs analysis on where the agent failed or deviated from optimal behavior, and produces changes that can be applied programmatically. For teams running agents in production across many tasks, this kind of automated optimization layer could save significant engineering time.

The recursive aspect is the most interesting part. Because each optimization pass produces a measurably better agent, you can run multiple passes and stack the gains. The system is literally an agent that improves other agents.

Key Takeaways

  • HALO is a post-hoc optimization framework. It analyzes execution traces after the agent runs and suggests improvements for the next iteration.
  • It works with any model. The benchmarks cover both Gemini and Claude, showing gains on each without model-specific tuning.
  • Test set gains of 10+ percentage points are meaningful. The test_normal results show the optimizations generalize beyond the specific scenarios used during the optimization loop.
  • The recursive loop is the core differentiator. Each optimization pass feeds into the next, compounding improvements over multiple iterations.
  • It ships with datasets and a PyPI package. The project includes evaluation datasets and is installable via pip for quick experimentation.

Resources

Published June 11, 2026. Writeup generated from a favorited TikTok.