I keep seeing the same gaps in AI engineering project repos. Having them really makes candidates stand out:
1. A README that explains the problem and how the project solves it
2. Deterministic code where an LLM isn't needed with the reasoning written down
3. Structured outputs on model responses
4. Fallbacks for when a step fails or the model gets it wrong
5. An eval suite with a dataset that shows thought about what's being tested and why
6. Cost and latency considered and documented
What would you add?
Subgraphs in LangGraph
What it is: a subgraph is a regular graph used as a node inside another graph. It has the same nodes, edges and state as any other graph.
Benefits:
1. Reusability: use the same graph in multiple nodes.
2. Separation of state: the subgraph can have its own state and you control which keys pass between it and the parent.
3. Memory handling: you can control how long short-term memory persists separately from the parent.
@mdancho84 When people ask what they should do next after learning and building their first agent, it’s shouldn’t be another type of agent. It should be this.
@businessbarista Also, splitting out a regression eval dataset when your project becomes stable really helps with future iterations. It allows you to evaluate what was working well previously and check that adding new features hasn’t degraded this.
Every time I think I need to handle LangChain tool calls manually, an agent plus middleware or switching to LangGraph covers it.
I haven't found a case where manual is clearly better. Is anyone still manually handling tool calls?
"Write evals before writing prompts" - This one is crucial. It's important to define you expect each step of your solution to do and writing evals before anything else helps to do that.
I'd also add in to split out your eval dataset into a regression set for examples that succeed and another for ones that need improvement. Therefore you can work to improve your solution while ensuring it's doesn't degrade what already works well.
This should be talked about more than it is. Many agent based projects seem to not be surviving beyond proof of concept and I suspect unsuitable development lifecycles are part of the reason. The challenge is that good practice doesn't seem to have fully matured and is shifting fast.
@mdancho84 The big differentiator that I think can be layered on top of this is how to ship robust projects especially in the agent space. There seems to be a growing issue with many projects not surviving beyond proof of concept.
LangGraph subgraphs aren’t just useful for reusability. They also enable enforcement of state boundaries.
By defining a subgraph state along with input and output schemas, we can control what gets passed between the subgraph and the parent along with what state keys are kept private within the subgraph.
Good breakdown on the importance and implementation of reranking. You briefly touched on it but query rewriting / expansion is generally helpful but can be both a blessing and curse as it allows you to provide additional context and optimise for downstream retrieval which is ultimately isn't an intelligent process. However, this needs to be done well as poor performance here pollutes everything else downstream.
Two LangGraph nodes writing to the same state key in one step will throw an InvalidUpdateError.
LangGraph won't guess which value you meant so it fails instead of picking one.
As a rule of thumb always use a reducer when two nodes write to the same state key in parallel.
LangGraph add_messages should be used far more often than operator.add as a message history reducer.
With operator.add there’s more chance of duplicate messages in message history especially when working with subgraphs and tools.
@e_opore Good roadmap. I'd maybe argue that frameworks could be learnt in parallel, picking up the relevant implementation in the framework for each step of the roadmap.
Input and output schemas in LangGraph subgraphs are an interface, not internal state.
They define what state keys are passed from the parent to subgraph and which can be returned from subgraph to parent.
@techyoutbe Nice way to visualise this. I'd also throw out that considering how much latency steps 4 and 5 will add versus how they improve response quality is important. Maybe step 5 can mostly be handled by Jen though now.
@_vmlops I've found this works well. It also signals how much authority a chunk has if it's from a document dedicated to the topic vs a side note in something more general.