技巧

自定义代理框架能提升代码质量和效率

Build and own your harness, folks. Very few people understand the magic behind customizing and opt...

精选理由

老哥说,自己动手做代理框架,能更好地控制输出,让代码更高效,和那些现成的框架比,能解决很多实际问题。

作者通过构建自己的代理框架,发现可以快速优化输出,解决开箱即用框架的冗长问题。使用系统提示词优化后,能更好地控制代理行为,提升代码质量、覆盖率和测试通过率。

原文 · elvis

Build and own your harness, folks. Very few people understand the magic behind customizing and opt...

Build and own your harness, folks. Very few people understand the magic behind customizing and optimizing an agent harness for your work. You can start seeing incredible results quickly, even with a minimal harness. Just better code, better outputs, better costs, better writing, and so on. As an example, I see way too many people complain that they are tired of their out-of-the-box agent harness producing verbose outputs. If you built a harness, that's easier to fix with a system prompt optimized for you. This is why Pi is getting insane adoption these days. You want to control your harness. I agree that it's hard to optimize where things stand, but self-improving algorithms will make it easier to learn from trajectories. And if you use local models, you can tune all of that end-to-end (through a co-evolution of the harness and the models) as you work with them. Look into open-source projects like Eve, Exo, and Prime Agent, and you will see what I mean. Uncle Bob Martin @unclebobmartin OK. It's time to rethink this. I've spend the last several weeks working on a harness that tightly constrains the agents to work the way that I want them to work. I set up all kinds of gates, and tests, and tools, and protocols, and ... And while I was heads-down getting that to work, the agents got a LOT better. So much so that when I came up for air, the need for my harness was obviated. Indeed, the need for _any_ but the most liberal of harnesses may be obviated. Just how good these things have gotten blows me away. I have had long debates with grok and codex about the structure of systems -- as if they were senior engineers. They often disagree with me and have their own perspectives. I have, more than once, found myself agreeing with their views. I have not given up on constraints and tooling. Unit testing is still important. So is CRAP and Mutation testing. These tools still find bugs and offer useful constraints, though they can leave scars. However, the agents have gotten so good that I can now give one a very significant task with a few guidelines and it will faithfully implement it. I can walk away for 40 minutes and when I return it will be done. CRAP will be satisfied, Coverage will be high, and Mutation testing complete. The architecture will be clean, and the code will be very good. The end result may not behave perfectly, but it's so close that a couple of tweaks usually puts it into place. What does this mean going forward? I'm not sure. But I'm beginning to think that harnesses should not treat agents as components within a software design. 🔗 View Quoted Tweet 💬 3 🔄 1 ❤️ 7 👀 951 📊 4 ⚡