AI Agents with LangGraph

Nov 12 2024 · Python 3.12, LangGraph 0.2.x, JupyterLab 4.2.4

Lesson 02: Fundamentals of LangGraph

Graphs Demo

Episode complete

Play next episode

Next

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Graphs Demo

Open the empty graphs-demo.ipynb notebook in the Starter folder. If you haven’t already, install LangGraph by running:

!pip install langgraph
def greet(name):
  return f"Hello, {name}"

def enthusiastic(message):
  return f"{message}!"
from langgraph.graph import Graph

graph = Graph()
graph.add_node("greeting", greet)
graph.add_node("enthusiastic", enthusiastic)
graph.add_edge("greeting", "enthusiastic")
from langgraph.graph import START, END

graph.add_edge(START, "greeting")
graph.add_edge("enthusiastic", END)
graph.set_entry_point("greeting")
graph.set_finish_point("enthusiastic")
app = graph.compile()
app.invoke("World")
See forum comments
Cinema mode Download course materials from Github
Previous: Graphs Next: State