Skip to content

Update LangGraph notebook dependencies and env-driven setup#117

Closed
dex-the-ai wants to merge 1 commit into
mainfrom
artifact/langgraph-couchbase-persistence-2026-04-29
Closed

Update LangGraph notebook dependencies and env-driven setup#117
dex-the-ai wants to merge 1 commit into
mainfrom
artifact/langgraph-couchbase-persistence-2026-04-29

Conversation

@dex-the-ai
Copy link
Copy Markdown
Contributor

@dex-the-ai dex-the-ai commented Apr 29, 2026

Summary

  • Update langgraph/couchbase_persistence_langgraph.ipynb dependencies from current main and keep the explicit langgraph==1.1.10 pin.
  • Add langchain-openai, switch the sample agent construction to create_agent, and move the notebook to env-driven local Couchbase/OpenAI configuration.
  • Clarify the notebook text around required environment variables and the local Couchbase bucket/scope/collections.

Verification

  • uv venv -p 3.12 --seed --clear .venv-fresh-pr-20260429
  • uv pip install papermill ipykernel pip-audit
  • papermill -k vsc-langgraph-fresh-20260429 langgraph/couchbase_persistence_langgraph.ipynb ...
  • pip-audit ✅ (No known vulnerabilities found)

Evidence

  • Fresh rerun from main executed the notebook end-to-end with papermill on a clean Python 3.12 environment.
  • The executed notebook artifact includes both sync and async checkpoint flows.
  • The notebook now relies on CB_* / OPENAI_API_KEY environment variables instead of hard-coded local values.
  • Visual evidence is included for the rendered notebook output used in review.

Rendered notebook screenshot

Rendered LangGraph notebook output

Papermill / audit summary
  • papermill completed all 27 cells successfully with kernel vsc-langgraph-fresh-20260429
  • pip-audit reported No known vulnerabilities found
  • the first rerun attempt only failed because OPENAI_API_KEY was not exported into the kernel environment; rerunning with exported env fixed it
  • tutorial-maintenance/runs/couchbase-examples__vector-search-cookbook/2026-04-29-langgraph-fresh-from-main/verification.md
  • tutorial-maintenance/runs/couchbase-examples__vector-search-cookbook/2026-04-29-langgraph-fresh-from-main/papermill.log
  • tutorial-maintenance/runs/couchbase-examples__vector-search-cookbook/2026-04-29-langgraph-fresh-from-main/dependency-freeze.txt
  • tutorial-maintenance/runs/couchbase-examples__vector-search-cookbook/2026-04-29-langgraph-fresh-from-main/screenshots/langgraph-executed-notebook.png

Notes

  • This stays artifact-scoped to langgraph/couchbase_persistence_langgraph.ipynb rather than bundling broader cookbook changes.
  • The PR title now reflects the actual work: dependency updates plus the env-driven notebook/runtime cleanup needed to keep the artifact executable.

@github-actions
Copy link
Copy Markdown

Caution

Notebooks or Frontmatter Files Have Been Modified

  • Please ensure that a frontmatter.md file is accompanying the notebook file, and that the frontmatter is up to date.
  • These changes will be published to the developer portal tutorials only if frontmatter.md is included.
  • Proofread all changes before merging, as changes to notebook and frontmatter content will update the developer tutorial.

1 Notebook Files Modified:

Notebook File Frontmatter Included?
langgraph/couchbase_persistence_langgraph.ipynb

0 Frontmatter Files Modified:

Frontmatter File
Note: frontmatter will be checked and tested in the Test Frontmatter workflow.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Couchbase persistence notebook for LangGraph to support environment-based configuration and adds the langchain-openai dependency. Several critical issues were identified: the langgraph package version was pinned to a non-existent version (1.1.10), and the code was changed to use create_agent from langchain.agents instead of create_react_agent from langgraph.prebuilt. The latter change is problematic because standard LangChain agents do not support the checkpointer parameter required for the persistence features demonstrated in this notebook.

"source": [
"%%capture --no-stderr\n",
"%pip install -U langgraph==0.3.22 langgraph-checkpointer-couchbase "
"%pip install -U langgraph==1.1.10 langgraph-checkpointer-couchbase langchain-openai\n"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The version langgraph==1.1.10 appears to be incorrect. As of the current release cycle, LangGraph versions are in the 0.x range (e.g., 0.2.x or 0.3.x). Pinning to a non-existent version will cause the %pip install command to fail. Additionally, the PR description mentions keeping the pin, but the diff shows a change from 0.3.22 to 1.1.10.

Suggested change
"%pip install -U langgraph==1.1.10 langgraph-checkpointer-couchbase langchain-openai\n"
"%pip install -U langgraph langgraph-checkpointer-couchbase langchain-openai\n"

"from langchain_core.tools import tool\n",
"from langchain_openai import ChatOpenAI\n",
"from langgraph.prebuilt import create_react_agent\n",
"from langchain.agents import create_agent\n",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The import create_agent from langchain.agents is likely incorrect for a LangGraph tutorial. LangGraph uses create_react_agent from langgraph.prebuilt to create compiled graphs that support persistence via checkpointers. langchain.agents does not provide a create_agent function that accepts a checkpointer argument, and using the legacy agent stack would break the persistence logic demonstrated in this notebook.

Suggested change
"from langchain.agents import create_agent\n",
"from langgraph.prebuilt import create_react_agent\n",

" scope_name=CB_SCOPE_NAME,\n",
") as checkpointer:\n",
" graph = create_react_agent(model, tools=tools, checkpointer=checkpointer)\n",
" graph = create_agent(model, tools=tools, checkpointer=checkpointer)\n",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using create_agent here is likely incorrect. Since this notebook demonstrates LangGraph persistence, you should use create_react_agent to ensure the resulting object is a LangGraph CompiledGraph that correctly utilizes the provided checkpointer. Standard LangChain agent factory functions do not support the checkpointer parameter.

Suggested change
" graph = create_agent(model, tools=tools, checkpointer=checkpointer)\n",
" graph = create_react_agent(model, tools=tools, checkpointer=checkpointer)\n",

" scope_name=CB_SCOPE_NAME,\n",
") as checkpointer:\n",
" graph = create_react_agent(model, tools=tools, checkpointer=checkpointer)\n",
" graph = create_agent(model, tools=tools, checkpointer=checkpointer)\n",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

As noted in the synchronous example, create_react_agent should be used instead of create_agent to maintain compatibility with LangGraph's checkpointer logic and ensure the graph is properly compiled for persistence.

Suggested change
" graph = create_agent(model, tools=tools, checkpointer=checkpointer)\n",
" graph = create_react_agent(model, tools=tools, checkpointer=checkpointer)\n",

@dex-the-ai dex-the-ai changed the title Refresh LangGraph notebook for fresh main Update LangGraph notebook dependencies and env-driven setup Apr 29, 2026
@ejscribner ejscribner closed this Apr 30, 2026
@ejscribner ejscribner deleted the artifact/langgraph-couchbase-persistence-2026-04-29 branch April 30, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants