Ask HN: Do you roll your own agent or use a framework?

8 points by break_the_bank a day ago

I am curious if people here roll their own agents from scratch or use frameworks. I am trying to what frameworks are really working, and why. I have so far hand-rolled all of my agents, some of this is because when I first tried LangChain I was intimidated by how complex/bloated it was. It felt like writing Java while I was actually writing Python. There is also a big element of wanting a lot more control on how my agent works compared to what a framework could provide us (around context management, compacting histories if the chat gets too big etc). Having said that I am curious

1. Do you use frameworks, if so which one?

2. If you used a framework but churned, which one did you churn from and why?

3. How has the process of rolling your own framework been? How is the experience of running it in production?

jamesbriggs 8 hours ago

We used frameworks in the past, tried langchain, langgraph, and Openai's agents SDK pretty extensively. Now we roll our own, generally a much better and cleaner experience. We essentially built our own internal framework for our own use-case, we liked the graph approach of langgraph - so we took elements of that. We write everything async, and added nice handling for streaming.

You can see our framework [here](https://github.com/aurelio-labs/graphai). I don't necessarily recommend it as it's built for our use-cases and I make no guarantees for others, but it might be interesting to see what rolling your own might look like

extasia 17 hours ago

I wrote my own agent state machine in pretty much pure async Python (no libs). Running successfully in prod with very few issues.

I use the OpenAI messages spec, and have the messages be an append only list, to make it easy to reason about.

Don’t bother compacting histories imo. worse case just summarise and spin up a new agent with the context.

good luck!

  • nbbaier 8 hours ago

    Is this code open source?

drakonka 6 hours ago

For my run training agent hobby project I'm just building my own, it's fun and lets me focus on building stuff rather than wrangling frameworks.

brazukadev 3 hours ago

Yes, I created my own AI framework but now on top of MCP so it can integrate with other servers and clients.

tag_coder 17 hours ago

I am enjoying langgraph.

Non-technical people have suggested using other tools like n8n or make.

Being able to write tests, use version control, and make full use of a programming language I am proficient with are perks.

It is also enshittification resistant unlike other platforms. I still might use them for something lightweight.

I have rolled my own solutions in previous roles and it worked well for very simple tasks (analyze this output and make sure it meets this criteria or try again...) I would be concerned about complexity if there were more steps, tool calls, or the need to compose multiple agents out of the same nodes, tools, state, etc...

Curious to hear more what you mean about compacting histories? Langgraph state management is simple enough and a custom reducer function gives you full control of context management...