Skip to content

Instantly share code, notes, and snippets.

@larkintuckerllc
Created December 26, 2025 14:16
Show Gist options
  • Select an option

  • Save larkintuckerllc/aad394d86808e5dbf761f3816e7b9ed8 to your computer and use it in GitHub Desktop.

Select an option

Save larkintuckerllc/aad394d86808e5dbf761f3816e7b9ed8 to your computer and use it in GitHub Desktop.
from langchain.agents import create_agent
from langgraph.checkpoint.memory import InMemorySaver
from langchain.messages import HumanMessage
from langchain.tools import tool
CONFIG = {"configurable": {"thread_id": "1"}}
QUESTION_1 = HumanMessage(content="Hello my name is Sean and my favorite color is green.")
QUESTION_2 = HumanMessage(content="What is my favorite color?")
agent = create_agent(
model="gpt-5-nano",
checkpointer=InMemorySaver(),
)
response = agent.invoke(
{"messages": [QUESTION_1],},
config=CONFIG
)
print(response["messages"][-1].content)
response = agent.invoke(
{"messages": [QUESTION_2],},
config=CONFIG
)
print(response["messages"][-1].content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment