Unofficial Hacker News companion — get notified on comment replies, and more.

A Visual Guide to Agent Harnesses (opens external site)

451 points by mariuz 2 days ago | newsletter.maartengrootendorst.com | 80 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (31)

  1. Pi's main super power is that it gives the agent the ability to edit the harness, the harness provides skills and tools as the user adds them, which they can do manually from outside pi, within pi or ask the agent to build something and it then accesses the guides to do so. It comes with no skills but it has the ability to use existing ones and that seems absent on the image.

    The harness choice can actually have a massive impact on the performance of the LLM. Not just the context burnt on the system prompt but the prompt and tools themselves can considerably change how much a task costs and the chance of success. Pi is basically never first for any individual model, but its usually top 3 because of how minimal it is.

    Replies (6)
    1. How does pi let the agent edit the harness?
      Replies (2)
      1. There is pretty much no sandbox behaviour at all, so it can read and write files across the entire system. What pi does in its system prompt is tell the agent where it can find markdown files that explain skills and extensions alongside examples. If you prompt it to make a new skill or extension it will then go about doing so and inserts them into either ~/.pi/ or the current directory .pi depending on what makes most sense on what you asked.

        I have made one extension called globalstats which iterates over all the sessions and costs up everything across various agents (with locals being negative price of the most common used cloud option, sort of money saved) and I have some skills about accessing dev servers and where to find the docker settings and up/down aliases so it can add things.

        Replies (2)
        1. I use pi extensions liberally, but I also used claude config for similar extensions. For sure, pi is way more extensible and I prefer it. I just don't think it's so mind blowing as people think. It's basically the simplest harness you can get, with well defined extension mechanisms.
        2. > There is pretty much no sandbox behaviour at all, so it can read and write files across the entire system.

          It does provide hooks, so tool calls can be intercepted/gated/etc. The first thing I did with pi was have it write an extension that asks for permission for each Bash invocation. I've extended that with a simple Python script which auto-denies known-bad things (e.g. running find on /), auto-allows known-safe things (e.g. non-destructive text processing pipelines), and asks me for anything else.

          Its tools can also be switched-out; e.g. I've replaced its read/write/edit tools with alternatives which invoke emacsclient. There's no reason you couldn't replace its tools with sandboxed alternatives, if you wanted.

      2. pi injects docs for extending itself into the system prompt. You just tell the agent what features you want, and it knows how to do the rest.
        Replies (1)
        1. Do you have an example of how you'd use this?
          Replies (2)
          1. I use pi from Emacs, via its RPC interface (I hate TUIs). I've replaced pi's reading/writing tools with alternatives which invoke emacsclient. That way:

            - Emacs buffers remain up to date (rather than the on-disk content changing underneath it).

            - I can use ordinary undo, etc. on changes made by pi.

            - Various editor conveniences are automatically applied, e.g. auto-formatting of code; showing the contents of compressed files; etc.

            - The LLM is given extra metadata, like warnings from linters/compilers/LSP/etc.

            - The same tools work for buffers which aren't files (e.g. shells, Web browser, etc.)

            Replies (2)
            1. I for one would love this!
            2. Clever. So pi drives emacs via emacsclient, and you use emacs.

              So it's pair programming with the machine in the best sense.

              Though I don't understand how read/write works with emacsclient and pi. Care to share?

              Continue this thread (1 replies) →

          2. I said I want it to support voice dictation. It downloaded whisper, cursed at ALSA, and eventually gave me a button to press to talk.

            ...and 20 features later I realized I just need to download omp.sh

            Replies (1)
            1. Great... New rabbit hole.
    2. pi allowing an LLM access to renewing itself was why i chose it for tabichat.dev (my multi-agent chat system). nearly everything i do is long-running, spanning multiple sessions. tabichat includes allowing chat members to renew themselves and keep going. mTLS MQTT broker, so everything stays local and private.
    3. Tbf you can do this with any harness if a MCP is the thing providing the tools, and the agent can make plugins for the software that supplies the MCP. My orchestrator has worked this way for months.
      Replies (2)
      1. Pi’s strengths is making changes beyond MCP. You can have the harness behave exactly like you’d prefer. It’s incredibly satisfying to think “I wish it would do x!” And then have it do x.
        Replies (2)
        1. I am using PI. Do you have an inspiring example?
          Replies (2)
          1. I recently noticed that claude code tui has a button at the top of the screen to go to the last user message instead of having to scroll back through all the output to find it. I just prompted pi that I wanted this feature and it wrote an extension for me and I only had to `/reload`. Not super complicated, but maybe inspiring all the same.
          2. I have a lot of qol little things like a /quiet that only output chat output and hides all tool use/thinking so it is easier to go back and read what was outputted. Made a little pinboard so I can have it put whatever on screen and it doesn’t scroll away. Made a sub-process that runs a fast agent to search through my context files and generate instructions and inject them into the system prompt but only if I asked it to do something - this alone solved almost all my “first attempt at certain mcp or commands get an error” issues.
        2. People like to say this about pi but it’s only really extensible in a handful of ways. If you want to go beyond that then either you’re completely rewriting core parts of it or you’re stuck with what they’re doing.
          Replies (2)
          1. What is an example of what you can't do in pi
            Replies (2)
            1. Low level TUI behavior changes (important for accessibility). E.g. disabling status line refreshes to reduce screen reader output spam when the harness is working, replace the menu component for all menus with one that uses a hardware cursor instead of Unicode and colors for highlighting, replace the rendering system with one that is character based and not line based (so that screen readers don't re-read the whole line on every single keystroke in the prompt field).
            2. The other commenter has some examples but just off the top of my head when I was working with I had stuff like the find and grep tools being hardcoded to shell out to their own binary with no way to really intercept them, also a bunch of APIs are just kind of limited (for example you can get the first message in a session but not the last for whatever reason). You can't override the default commands, a bunch of stuff just does things exactly how pi does it and is not flexible at all (e.g. there is a MIME sniffer but it needs a file on disk, not bytes). Basically if you push it hard you will constantly run into issues where the interfaces that are provided are clearly not being tested–the core design is quite good but it's not being extended and I am sure all their feedback is just people slopping so I doubt they really listen to it much.

              Continue this thread (1 replies) →

          2. Yeah, I wish we had a Shadcn-style composable harness (Pi is configurable but not composable).

            Give me a top-level ~1000loc harness.py that just connects the major components together, letting me replace any of them as I see fit. No settings or configurability whatsoever, configuration just means asking the LLM to edit the harness.

            Also, I think at this point, it's clear what a harness architecture should be. You should have four components, the UI (TUI, GUI, web, nothing for automated workflows like CI reviews) which runs on the users' actual machine, the "brain" (the LLM itself), the "hands" (the actual tools, running on the machine that the work happens on, which could be a remote server, and the "nerves" (the part which owns the actual loop, skills, transcript store and memory), preferably running on some persistent server that can be accessed through multiple machines.

            Many harnesses conflate these to their detriment.

            Replies (1)
            1. Yes, I think they just made it too early. Their "pi durable" thing which is new kind of fixes it but they haven't cleaned up pi to use it yet :(
      2. You can do this with any harness, the plugin system, and running a new/different instance. I was doing this for the last ~6months, but am now going back to my own personal harness development.

        I still hold the opinion that harness engineering is an important thing to try in the age of Ai - and that there is a lot to still unlock a this layer (which merges prompt, context, tool, workflows, and more from related * engineering)

    4. OpenCode>= 2.0.0 is hardly plugins based so also allows you to edit itself very easy

      Also OoenCode go is top, that can be used with pi too of course

    5. Yeah, without a proper structure set up for work in the harness you might as well burn your cash haha For a long time I struggled to find a way to stop my agents from clobbering each others work and I feel like claude codes hooks work well but its not exactly the most token efficient harness...
    6. Yet another harness-writer here (https://github.com/juggler-ai/juggler)..

      I had an interesting circular journey when it comes to plugins. When I started, I went all-in on the everything-is-a-plugin mindset, so every aspect of Juggler is a plugin: the LLM loop strategies, every type of item in a context, their UIs, even helper UIs like file viewers, and loads more things are all extensions.

      Everything works great, but over the last year building it, the models grew so capable that those custom plugins I thought I would write just aren't needed. The models just don't need extra tools for specific projects or tasks. I've created loads of great built-in extensions, but these could just as well have been part of the app.

      However, plugins were the right choice, if for the wrong reason: harnesses are surprisingly huge beasts, and enforcing plugin APIs ("seams" as I'm sure claude would call them) is a great barrier to prevent slop-creep across the app as these new features are added. So.. I'm very happy with the architecture I built, but not for the reason I expected!