| ▲ | pantulis 6 hours ago | |
> IMHO you should just write your own harness Can you point to some online resources to achieve this? I'm not very sure where I'd begin with. | ||
| ▲ | arjie 6 hours ago | parent | next [-] | |
Ah, I just started with the basic idea. They're super trivial. You want a loop, but the loop can't be infinite so you need to tell the agent to tell you when to stop and to backstop it you add a max_turns. Then to start with just pick a single API, easiest is OpenAI Responses API with OpenAI function calling syntax https://developers.openai.com/api/docs/guides/function-calli... You will naturally find the need to add more tools. You'll start with read_file (and then one day you'll read large file and blow context and you'll modify this tool), update_file (can just be an explicit sed to start with), and write_file (fopen . write), and shell. It's not hard, but if you want a quick start go download the source code for pi (it's minimal) and tell an existing agent harness to make a minimal copy you can read. As you build more with the agent you'll suddenly realize it's just normal engineering: you'll want to abstract completions APIs so you'll move that to a separate module, you'll want to support arbitrary runtime tools so you'll reimplement skills, you'll want to support subagents because you don't want to blow your main context, you'll see that prefixes are more useful than using a moving window because of caching, etc. With a modern Claude Code or Codex harness you can have it walk through from the beginning onwards and you'll encounter all the problems yourself and see why harnesses have what they do. It's super easy to learn by doing because you have the best tool to show you if you're one of those who finds code easier to read that text about code. | ||
| ▲ | wild_egg 6 hours ago | parent | prev | next [-] | |
At the core, they're really very simple [1]. Run LLM API calls in a loop with some tools. From there, you can get much fancier with any aspect of it that interests you. Here's one in Bash [2] that is fully extensible at runtime through dynamic discovery of plugins/hooks. | ||
| ▲ | vidarh 4 hours ago | parent | prev | next [-] | |
Here's a starting point in 93 lines of Ruby, but that one is already bigger than necessary: https://radan.dev/articles/coding-agent-in-ruby Really, of the tools that one implements, you only need the ability to run a shell command - all of the agents know full well how to use cat to read, and sed to edit. (The main reason to implement more is that it can make it easier to implement optimizations and safeguards, e.g. limit the file reading tool to return a certain length instead of having the agent cat a MB of data into context, or force it to read a file before overwriting it) | ||
| ▲ | stavros 4 hours ago | parent | prev | next [-] | |
Just use Pi core, no need to reinvent the wheel. | ||
| ▲ | tonyarkles 6 hours ago | parent | prev [-] | |
[dead] | ||