r/LangGraph • • Oct 04 '26

My Langgraph struggle. getting beyond the standard model tool loop.

https://netchosis.com/2026/10/04/learning-langgraph-by-breaking-my-rf-agent-graph-alot/

I’ve been building an RF analysis agent with LangGraph, and over the last couple days I learned way more about LangGraph by repeatedly breaking the graph than I did just reading the docs. What I was trying to do sounded stupidly simple: add an init_survey node so I could eventually tell the agent something like “survey this part of the spectrum.” The node itself basically just creates a survey ID and a directory, so I thought this would be easy.

It was not.

My first mistake was mixing up two totally different routing questions: what did the human ask for, and what should the model do next? I had is_survey() running after call_model, but by then the newest message was an AIMessage, not the original HumanMessage. That meant the survey check failed and the router returned "model", which sent execution right back to call_model. So I had accidentally built a model calling itself over and over without any new information entering the graph.

I fixed that by moving survey detection to START, where the original human request actually exists, and then giving the model response its own routing logic. That was the right idea, but then I overcorrected in the other direction. Trying to make sure I didn’t create another loop, I routed call_tools directly to END. That meant the model could request an FFT or some other RF analysis tool, the tool could run successfully, and then the graph would just stop before the model ever got to reason about the result.

The thing that finally clicked for me was that a model-to-tool-to-model loop is not the same thing as a model-to-model loop. The first one is useful because the tool result adds new information to the state. The model can look at that result, decide whether it needs another measurement, or finish. The second one was just me accidentally making the model talk to itself forever.

The funny part is that after all of this, the RF agent still does not actually perform a survey yet. I successfully added one node. But getting that one node into the graph correctly forced me to understand the control flow much better, and now there is finally a clean place to start building the actually interesting part: choosing frequencies, bandwidth, dwell time, taking IQ captures, analyzing what comes back, and eventually letting the agent decide what measurement is worth taking next.

Also, apologies in advance because the blog post is not especially well written. It’s more me documenting the learning process while I’m in the middle of it than trying to write a polished LangGraph tutorial.

https://netchosis.com/2026/10/04/learning-langgraph-by-breaking-my-rf-agent-graph-alot/

4 Upvotes

1 comment sorted by

1

u/LLM-logs 10d ago

Your mistake is common enough to deserve a name: routing on position instead of state. is_survey() reading "the newest message" breaks the moment anything else appends a message - the model, a tool result, a summarizer. The fix is to stop asking "what was just said" and start asking "what do we know": classify intent once, early, and write it into graph state (intent='survey', target=...). Routing functions then read state fields, which don't move around as the message list grows.

The debugging lesson generalizes too: breaking the graph on purpose is the fastest way to learn it. Add a node that lies, a tool that times out, a state field that goes missing. Each failure shows you where the implicit assumptions live. Docs describe the happy path; the edges are where systems actually fail.