LangGraph is a special LangChain-built library that builds intelligent AI Agents using graphs. Ie, agentic state machines. It allows us to build more powerful and flexible AI agents than what we can build using just the core library, LangChain.
In this video, we'll see how to build agents with LangGraph and OpenAI.
📌 Code:
github.com/pinecone-io/exampl...
🌲 Subscribe for Latest Articles and Videos:
www.pinecone.io/newsletter-si...
👋🏼 AI Consulting:
aurelio.ai
👾 Discord:
/ discord
Twitter: / jamescalam
LinkedIn: / jamescalam
#ai #langchain #artificialintelligence #nlp #chatbot #openai
00:00 Intro to LangGraph
00:52 Graphs in LangGraph
03:00 More Complex LangGraph Agent
08:12 LangGraph Graph State
14:00 LangGraph Agent Node
17:08 Forcing a Specific LLM Output
20:00 Building the Graph
23:23 Using our Agent Graph
28:32 LangGraph vs LangChain
Hi James, thanks for the great content. I’m curious about why you went down the road of having the graph playing with the agent state and tools rather than just doing things directly in the langgraph nodes ? I’m seeing less and less examples from langchain using so called « agent » with langgraph and also tools, they only use it for Tavily because they have a langchain prebuilt tool, and i wonder what is your opinion on agents being soon obsolete ? And tools just used for built-in tools wrappers from langchain rather than custom tools
Thank you for being thorough with very simple and less simple examples. It made it easy to understand and allowed me to run with the knowledge. 💜
We have this on 2x watchlist. Thanks for making this. Still getting our heads around graph vs chain.
Hi James, thanks for the content. I'm trying to use langgraph with Vertex AI with the Gemini-pro model. Do you have any suggestions on how to tackle this task? I'm trying to adapt the code you made.
I have been patiently waiting for your video on langgaraph James. Thanks😊
sorry for making you wait so long 😅
Great video James! Motivates me to learn more about langgraph now after hearing about it's release a few months back.
Thank you for the video. I have a question about how "query_agent_runnable" decide is an error message or not? What's the criteria of the decision?
God bless your soul for doing this tutorial in Colab!! I'm using Crew AI in colab and my only hardware atm is a Ipad pro 2020 and a Samsung s23 ultra. Seriously: this is a boon for finding a solution for my...solution 💀
I agree Graphs are excellent choice for Agents and also good for the cost reduction policy. Langgraph is quite complex though. If you want to play with easier solution you can check autogen graph, it is (for now) more generic in use, at least for a fast prototyping.Thanks for this video.
Question: If I have a data preprocessing agent that has access to around 20 preprocessing tools, what is the best way to go about executing them on a pandas data frame? Do I have the data frame in the State and then pass that input in the function? Does the agent need to have access to that data frame or can we abstract that?
i am really struggling to find a single example that doesn't use open ai function calling (llm.bind, convert_to_openai_ helper functions). can you PLEASE help me out. I specifically am looking for a single agent and multi agent architecture with detailed explanation on the state, interactions with runnables like chat history, geared towards RAG
Great content, as always. Very random note: ive been to bali so many times (i work in tech in Singapore) and id recognise a bali villa door handle anywhere! 😂😂😂 Enjoy!
haha I am impressed
Does llama3 support these functional calling in LangGraph?
Can you use the OpenAI() API in LangGraph to specify Ollama models?
my q now is: does it still make sense to learn (theory, modify existing apps, experiment with, write new apps with) langchain? or rather just ignore and just start w/ langgraph? from a beginner's perspective (no prior langchain exp). what's the recommendation and its justification?
This is very interesting. Is there a tool to reverse engineer this Agent solution ? Can Nodes and Edges be mathematically defined like a enforced index for a DB? Appreciate any feedback and Thank you for sharing.
Thanks for the video! As a noob, I’m lost between whether I should learn langgraph or autogen or agency swarm. I learned to use autogen but it seems to lack the minimum control I need to build something reliable. To learn everything…takes to much time for me as I’m totally new to the computer language, and want to build something that I need rather than learning the basics for multiple libraries. Will langgraph the go-to library for the time being? What would you recommend for people like me?
Don't forget CrewAI
thanks for this video ! not related to this but while using langchain agent where it is invoking a function which makes openai call as an api in django application getting timeout error in production env . any inputs on how this can be fixed
if you're streaming maybe you are not closing the stream correctly? Otherwise I'm not sure to be honest - it does sounds like a codebase-specific issue rather than any particular behavior exclusive to using django+openai api together
Someone may correct me but I think LangGraph's potential resides mainly in the cyclical graphs. For instance for making, self-reflective agent. When making Directed acyclic graph (DAG) pipelines (like you did), it's better to use chains (Langchain).
Nice video!" What do you think about DSPy? Do you think it makes langchain and similar obsolete?
No they don't serve the same purpose
Does ```@tool("final_answer") def final_answer_tool( answer: str, source: str ): """Returns a natural language response to the user in `answer`, and a `source` which provides citations for where this information came from. """ return ""``` help in parse my answer?. What if the client wants in some other format, how to use within LangGraph?
I like the additional flexibility of langchart. This is just crying out for a gui builder using Graphviz or tikzit - or more even node red. I can see an ecosystem growing around something like that with people submitting nodes and structures.
What do you think about Microsoft's Semantic Kernel and PromptFlow?
James, have you already put any projects using LangChain into production in your consultancy? If so, was the experience positive?
yes we've done a few - all good so far earlier langchain was troublesome, but most of the issues we had back then have been resolved (primarily stability + excessive dependencies)
Awesome! Also, what do you mean when you say that agents are the short-term future? What about the long term?
long term: en.wikipedia.org/wiki/The_Terminator
but fr, I have no idea on long term - I don't think it's possible to predict where things are going, so anything beyond the next 1-2 years (or even earlier) would be pure guesswork from me
AI is moving so fast, it's become impossible to follow
@@jamesbriggs 🤣
@@jamesbriggs Yes I agree. I have no idea where things are headed, but one thing is certain: agents enable intelligence to act. What that will look like, I don't know. I'm also not sure if we'll call them "agents" in the future. My dad probably won't. :)
Have not finished but this dude is legit
Is this similar to dspy?
Why did you say agents are short-term leaders of AI? What is your definition of an agent? Is an agent a thing or is agentic workflow an approach to building intelligent systems?
What do you prefer between Llamaindex and Lagchain? I'm beginning in this topic and I want some advice
I've never had any need to go beyond the langchain ecosystem, but I also haven't used llama-index enough to know if I'm missing out on anything big there
Thank you James :)
thanks to you :)
I found this mixture of langchain (agents & tools) and langgraph quite confusing. The documentation is more straightforward.
off topic - but have you noticed you write ESE than add an "l" -> ELSE SEARH, then add a "c" -> SEARCH how's your brain working to do that? I analyze human language production as if it were ML.. so I'm curious how this is happening...
Can I go straight to learning Langgraph than learning Langchain first?
Semantic router for conditional edges is OP
💯
The volume of your videos is way lower than standard youtube videos, would be good if you could up the levels some more next time.
did you have a good night out yesterday?
yes, night out, socializing, getting plenty of sleep and not trying to keep up with ai - all things I do frequently
similar to agent pilot
There is no such thing as a graph with a conditional edge. What you are describing is normal conditional programming. Maybe a state machine if all the transitions are rigorously set.
yeah that syntax is probably my least favorite part of langgraph, and it feels overly complex, ie you must define tools + router + "conditional edge" (using LangChain syntax)
Bro, please imcrease your audio. I have to use chrome extensions for your videos to improve audio amplitude
This video is proof that developers dont get half.
im sorry but this is unnecessarily complicated, i've used the graphs on haystack, and their api looks way cleaner
I’m very open to jumping back into the haystack ecosystem
@@jamesbriggs check haystack pipelines
damn their APIs are so bad
Stop saying it's pretty simple. It's not simple for those people who are seeing this for the first time. I Like your content but be mindful of newbies because you will discourage them.
Hey not simple at all i try to understand but i couldn't
It’s all relative. He can’t explain every concept at every level in every video. Sometimes you need to assume some level of audience understanding or you’ll never discuss anything. What’s simple for you won’t be for someone else, and that’s ok.
It is simple if someone already knows langchain.
Ask a programmer what hes able to do, he will say: not much, a little here, a little there. In reality that programmer learned so much that he forgot how much he learned and how complicated it was. When that programmer learns something new it funds on that gigantic, mostly unconciouse base, built before, which is expressed by "thats pretty simple".
Good point, I have been using langchain and related libraries for well over a year now. For anyone reading who doesn’t find it simple, it’s not (my bad) and it takes some time to learn. However, don’t be discouraged - after using the tools for a while, you’ll end up looking back at this eventually and thinking of it as “simple” too, but to get there it requires time and practice, my advice would be to try building with it, the more you build the more you will learn and understand If anyone has feedback on what they find most confusing I’d love to hear it and I’d be happy to put together some more content to focus on what you all struggle with most
LangGraph is not better than LangChain, it extends LangChain...
Watch at 1.25 speed. This guy speaks too slow.
1.5 for me 😂