Compare commits

...
Author SHA1 Message Date
Mason Daughertyandopen-swe[bot] 5328ca94f8 feat: support multiple extra LangSmith trace projects in SDK schema
Add an optional `project_names: list[str]` field to the `LangSmithTracing`
TypedDict so callers can request multiple extra trace replica projects on a
run, while keeping the singular `project_name` field working as before. The
Python SDK passes the tracing config straight through as `langsmith_tracer`,
so backward compatibility is preserved.

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
2026-06-17 01:28:48 +00:00
Connor Braa 1a9baae959 release(cli): 0.4.30 (#8101)
Bump langgraph-cli to 0.4.30 to cut a CLI release from
916025d2f6.

Also change the in-memory extra to require langgraph-api <0.12.0,
excluding 0.12.0.dev releases from normal pip resolution.

Refresh uv example lockfiles so they keep langchain-protocol compatible
with the stable API image used by CLI integration tests.

CI will verify the release change.
2026-06-16 12:43:04 -07:00
Connor Braa 916025d2f6 feat(cli): support compatible api version ranges (#8023)
Adds `api_version` ranges for LangGraph API base image tags.
`~=0.11.0.dev5` resolves to the newest matching compatible image while
freezing later dev prereleases until rc/final/patch tags exist;
`>~=0.11.0.dev5` uses the same floor but can also float to future stable
releases while ignoring future prereleases.

Verified with `make format`, `make lint`, and `make test` from
`libs/cli`.

---------

Signed-off-by: Connor Braa <cwlbraa@langchain.dev>
2026-06-15 20:24:31 -04:00
Mason Daugherty 97320843fe ci(deps): pin GitHub Actions to commit SHAs (#8065)
Every third-party GitHub Action in the workflows is now pinned to a full
commit SHA instead of a floating major tag, closing a supply-chain gap
where a mutable tag like `@v6` could be force-pushed to point at
malicious code. Seven actions were already SHA-pinned; this brings the
remaining first-party `actions/*` and `astral-sh/setup-uv` references in
line.

## Changes
- Pinned all previously tag-referenced actions to their current commit
SHA with the exact release as a trailing comment (the format Dependabot
reads and updates): `actions/checkout` → `v6.0.3`,
`actions/setup-python` → `v6.2.0`, `actions/github-script` → `v9.0.0`,
`actions/upload-artifact` → `v7.0.1`, `actions/download-artifact` →
`v8.0.1`, `actions/cache/{restore,save}` → `v5.0.5`,
`actions/configure-pages` → `v6.0.0`, `actions/deploy-pages` → `v5.0.0`,
`actions/upload-pages-artifact` → `v5.0.0`,
`actions/create-github-app-token` → `v3.2.0`, and `astral-sh/setup-uv` →
`v7.6.0`.
- Applied across all workflow files plus the `uv_setup` composite
action; local same-repo references (`./.github/workflows/_*.yml`,
`./.github/actions/uv_setup`) left as path refs since they resolve from
the same commit.
2026-06-12 21:29:40 -04:00
Mason Daugherty 8558481859 docs: standardize package README.md structure (#8064)
Aligns the repository's package READMEs around a shared documentation
shape so users see consistent install, positioning, docs, release, and
contribution guidance across LangGraph packages.
2026-06-12 19:32:10 -04:00
dependabot[bot] 4cf120df49 chore(deps): bump tornado from 6.5.5 to 6.5.6 in /libs/langgraph (#8063)
Bumps [tornado](https://github.com/tornadoweb/tornado) from 6.5.5 to
6.5.6.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/tornadoweb/tornado/blob/master/docs/releases.rst">tornado's
changelog</a>.</em></p>
<blockquote>
<h1>Release notes</h1>
<p>.. toctree::
:maxdepth: 2</p>
<p>releases/v6.5.7
releases/v6.5.6
releases/v6.5.5
releases/v6.5.4
releases/v6.5.3
releases/v6.5.2
releases/v6.5.1
releases/v6.5.0
releases/v6.4.2
releases/v6.4.1
releases/v6.4.0
releases/v6.3.3
releases/v6.3.2
releases/v6.3.1
releases/v6.3.0
releases/v6.2.0
releases/v6.1.0
releases/v6.0.4
releases/v6.0.3
releases/v6.0.2
releases/v6.0.1
releases/v6.0.0
releases/v5.1.1
releases/v5.1.0
releases/v5.0.2
releases/v5.0.1
releases/v5.0.0
releases/v4.5.3
releases/v4.5.2
releases/v4.5.1
releases/v4.5.0
releases/v4.4.3
releases/v4.4.2
releases/v4.4.1
releases/v4.4.0
releases/v4.3.0
releases/v4.2.1
releases/v4.2.0
releases/v4.1.0
releases/v4.0.2
releases/v4.0.1
releases/v4.0.0
releases/v3.2.2
releases/v3.2.1</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/tornadoweb/tornado/commit/aba2569f7ed7a6bdbef816658fb6b7182531b751"><code>aba2569</code></a>
Merge pull request <a
href="https://redirect.github.com/tornadoweb/tornado/issues/3626">#3626</a>
from bdarnell/fixes-656</li>
<li><a
href="https://github.com/tornadoweb/tornado/commit/a24b260e0d22fd48acea1a2635526c1700e7ac09"><code>a24b260</code></a>
httpclient_test: Accept an additional error message variant</li>
<li><a
href="https://github.com/tornadoweb/tornado/commit/a74240a70268fe5cb40a127951cb21549ab9ff24"><code>a74240a</code></a>
Release notes and version bump for 6.5.6.</li>
<li><a
href="https://github.com/tornadoweb/tornado/commit/e8fc7edb238f1022e39f9d0b9d297fc7c21fb0a5"><code>e8fc7ed</code></a>
simple_httpclient: Strip auth headers on cross-origin redirects</li>
<li><a
href="https://github.com/tornadoweb/tornado/commit/96dc88c2a05705287856b2cd6b4b4034f9a6aaac"><code>96dc88c</code></a>
speedups: validate mask length</li>
<li><a
href="https://github.com/tornadoweb/tornado/commit/ff808b33adc52d89a549376a5e3628e92abbc8ff"><code>ff808b3</code></a>
http1connection: Enforce max_body_size in _GzipMessageDelegate</li>
<li><a
href="https://github.com/tornadoweb/tornado/commit/ede4e37f93c1edbc0bf749e9a57c9db2501cd54b"><code>ede4e37</code></a>
auth: Correctly parse check_authentication response</li>
<li><a
href="https://github.com/tornadoweb/tornado/commit/1c178bef88bbd29907eb94a2a649a4a6675681de"><code>1c178be</code></a>
Remove obsolete curl force_timeout workaround</li>
<li><a
href="https://github.com/tornadoweb/tornado/commit/c99d55bb6cc0c9da2c6696545ed4ee1d20b7fcf0"><code>c99d55b</code></a>
Replace deprecated pycurl IOCTLFUNCTION callback with SEEKFUNCTION</li>
<li><a
href="https://github.com/tornadoweb/tornado/commit/27614316ef8ad125fe18725cf96e384560ba0e14"><code>2761431</code></a>
Merge pull request <a
href="https://redirect.github.com/tornadoweb/tornado/issues/3587">#3587</a>
from bdarnell/fix-link</li>
<li>Additional commits viewable in <a
href="https://github.com/tornadoweb/tornado/compare/v6.5.5...v6.5.6">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tornado&package-manager=uv&previous-version=6.5.5&new-version=6.5.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/langchain-ai/langgraph/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-12 17:24:58 -04:00
Mason Daugherty 7ab79f9f3e release(langgraph): 1.2.5 (#8062) 2026-06-12 16:26:18 -04:00
Mason Daugherty 385033fd9c fix(langgraph): merge lc_versions config metadata (#8052)
Preserve LangChain package-version trace metadata when graph-bound
config and invoke-time config both contribute `lc_versions`. The earlier
broad nested metadata merge has been narrowed to the LangChain-owned
`lc_versions` namespace, so arbitrary user metadata keeps the existing
last-writer-wins behavior.

## Changes

- Add a shared metadata merge path used by `merge_configs()` and
`ensure_config()` so top-level metadata keys are preserved across bound
and runtime configs.
- Special-case only `metadata["lc_versions"]` for one-level
package-version accumulation; duplicate package entries remain
last-writer-wins and non-mapping values still replace.
- Keep generic nested metadata maps, including user-owned
`metadata["versions"]`, as replacement-only to avoid changing arbitrary
metadata semantics.
- Raise the `langchain-core` lower bound to `>=1.4.7` so LangGraph’s
`lc_versions` handling aligns with the lc-core package-version
instrumentation.
- Cover both config merge helpers with tests for `lc_versions`
accumulation, non-recursive replacement within the package map, generic
nested metadata replacement, and defensive copying of mapping values.

## Test note

The stream event assertions for `test_imp_exception` now avoid depending
on leaked internal task-path metadata. With older `langchain-core`,
callback metadata could be mutated by later task runs, so every task
event in this test appeared to have the final task path index. That made
even the `task_with_exception` start event report
`metadata["langgraph_node"] == "my_task"`, which is inconsistent with
the event name.

`langchain-core>=1.4.6` preserves per-event metadata more accurately:
the first `my_task`, `task_with_exception`, and second `my_task` report
distinct task path indexes. The test now asserts the stable behavior
instead: event sequence, tags, required metadata, root stream payloads,
exception handling, and final outputs, without requiring the old leaked
task index.
2026-06-12 16:20:38 -04:00
David Duong 93307d6a42 release(cli): 0.4.29 (#8046)
https://github.com/langchain-ai/langgraph/pull/8031
2026-06-11 16:56:31 +02:00
David Duong e05ba2965d feat(cli): add support for passing certfile and cert key to run dev server under HTTPS (#8031)
This allows running the dev server under HTTPS, which is a requirement
for running local server under Safari.
2026-06-11 02:10:12 +02:00
Josh Rogers f0e814796b release(cli): 0.4.28 (#8041)
Bumping the version to support langgraph-api stable versions 0.10.0,
0.11.0rcX and 0.12.0.devY releases.
2026-06-10 14:15:19 -04:00
49 changed files with 1165 additions and 514 deletions

No files matched your search

+1 -1
View File
@@ -24,7 +24,7 @@ runs:
using: composite
steps:
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v7
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
with:
python-version: ${{ inputs.python-version }}
enable-cache: ${{ inputs.enable-cache }}
+1 -1
View File
@@ -37,7 +37,7 @@ jobs:
run:
working-directory: libs/cli
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Get changed files
id: changed-files
if: github.event_name != 'workflow_dispatch'
+1 -1
View File
@@ -31,7 +31,7 @@ jobs:
- "3.12"
name: "lint #${{ matrix.python-version }}"
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Get changed files
id: changed-files
if: github.event_name != 'workflow_dispatch'
+1 -1
View File
@@ -23,7 +23,7 @@ jobs:
env:
HAS_LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY != '' }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python
uses: ./.github/actions/uv_setup
+1 -1
View File
@@ -25,7 +25,7 @@ jobs:
name: "test #${{ matrix.python-version }}"
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/uv_setup
with:
+1 -1
View File
@@ -23,7 +23,7 @@ jobs:
working-directory: libs/langgraph
name: "test #${{ matrix.python-version }}"
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/uv_setup
with:
+4 -4
View File
@@ -23,7 +23,7 @@ jobs:
version: ${{ steps.check-version.outputs.version }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: ./.github/actions/uv_setup
@@ -48,7 +48,7 @@ jobs:
working-directory: ${{ inputs.working-directory }}
- name: Upload build
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test-dist
path: ${{ inputs.working-directory }}/dist/
@@ -74,9 +74,9 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/download-artifact@v8
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: test-dist
path: ${{ inputs.working-directory }}/dist/
+2 -2
View File
@@ -17,7 +17,7 @@ jobs:
run:
working-directory: libs/langgraph
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- run: SHA=$(git rev-parse HEAD) && echo "SHA=$SHA" >> $GITHUB_ENV
- name: Set up Python 3.11
uses: ./.github/actions/uv_setup
@@ -30,7 +30,7 @@ jobs:
- name: Run benchmarks
run: OUTPUT=out/benchmark-baseline.json make -s benchmark
- name: Save outputs
uses: actions/cache/save@v5
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
key: ${{ runner.os }}-benchmark-baseline-${{ env.SHA }}
path: |
+3 -3
View File
@@ -15,7 +15,7 @@ jobs:
run:
working-directory: libs/langgraph
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- id: files
name: Get changed files
uses: Ana06/get-changed-files@25f79e676e7ea1868813e21465014798211fad8c # v2.3.0
@@ -30,7 +30,7 @@ jobs:
- name: Install dependencies
run: uv sync --group test
- name: Download baseline
uses: actions/cache/restore@v5
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
key: ${{ runner.os }}-benchmark-baseline
restore-keys: |
@@ -57,7 +57,7 @@ jobs:
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Annotation
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
CHANGED_FILES: ${{ steps.files.outputs.added_modified_renamed }}
BENCHMARK_OUTPUT: ${{ steps.benchmark.outputs.OUTPUT }}
+4 -4
View File
@@ -30,7 +30,7 @@ jobs:
deps: ${{ steps.filter.outputs.deps || 'true' }}
sdk_py: ${{ steps.filter.outputs.sdk_py || 'true' }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4
if: github.event_name != 'workflow_dispatch'
id: filter
@@ -112,9 +112,9 @@ jobs:
name: "Check SDK methods matching"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.11"
- name: Run check_sdk_methods script
@@ -130,7 +130,7 @@ jobs:
python-version:
- "3.13"
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/uv_setup
with:
+5 -5
View File
@@ -26,10 +26,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Setup Python
uses: actions/setup-python@v6
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
@@ -37,13 +37,13 @@ jobs:
run: python docs/generate_redirects.py
- name: Setup Pages
uses: actions/configure-pages@v6
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: 'docs/_site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
+8 -8
View File
@@ -25,7 +25,7 @@ jobs:
tag: ${{ steps.check-version.outputs.tag }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python
uses: ./.github/actions/uv_setup
@@ -51,7 +51,7 @@ jobs:
working-directory: ${{ inputs.working-directory }}
- name: Upload build
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dist
path: ${{ inputs.working-directory }}/dist/
@@ -87,7 +87,7 @@ jobs:
outputs:
release-body: ${{ steps.generate-release-body.outputs.release-body }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
repository: langchain-ai/langgraph
path: langgraph
@@ -158,7 +158,7 @@ jobs:
- test-pypi-publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
# We explicitly *don't* set up caching here. This ensures our tests are
# maximally sensitive to catching breakage.
@@ -262,7 +262,7 @@ jobs:
working-directory: ${{ inputs.working-directory }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python
uses: ./.github/actions/uv_setup
@@ -272,7 +272,7 @@ jobs:
enable-cache: false
working-directory: ${{ inputs.working-directory }}
- uses: actions/download-artifact@v8
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: dist
path: ${{ inputs.working-directory }}/dist/
@@ -304,7 +304,7 @@ jobs:
working-directory: ${{ inputs.working-directory }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python
uses: ./.github/actions/uv_setup
@@ -314,7 +314,7 @@ jobs:
enable-cache: false
working-directory: ${{ inputs.working-directory }}
- uses: actions/download-artifact@v8
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: dist
path: ${{ inputs.working-directory }}/dist/
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
steps:
- name: Find and reopen matching PRs
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const { owner, repo } = context.repo;
+4 -4
View File
@@ -50,7 +50,7 @@ jobs:
steps:
- name: Check for issue link and assignee
id: check-link
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const { owner, repo } = context.repo;
@@ -283,7 +283,7 @@ jobs:
if: >-
env.ENFORCE_ISSUE_LINK == 'true' &&
(steps.check-link.outputs.has-link != 'true' || steps.check-link.outputs.is-assigned != 'true')
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const { owner, repo } = context.repo;
@@ -312,7 +312,7 @@ jobs:
if: >-
env.ENFORCE_ISSUE_LINK == 'true' &&
steps.check-link.outputs.has-link == 'true' && steps.check-link.outputs.is-assigned == 'true'
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const { owner, repo } = context.repo;
@@ -366,7 +366,7 @@ jobs:
if: >-
env.ENFORCE_ISSUE_LINK == 'true' &&
(steps.check-link.outputs.has-link != 'true' || steps.check-link.outputs.is-assigned != 'true')
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const { owner, repo } = context.repo;
+7 -7
View File
@@ -55,7 +55,7 @@ jobs:
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v3
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.ORG_MEMBERSHIP_APP_ID }}
private-key: ${{ secrets.ORG_MEMBERSHIP_APP_PRIVATE_KEY }}
@@ -63,7 +63,7 @@ jobs:
- name: Check if contributor is external
if: steps.app-token.outcome == 'success'
id: check-membership
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
@@ -102,7 +102,7 @@ jobs:
- name: Apply contributor tier label
if: steps.check-membership.outputs.is-external == 'true'
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
@@ -155,7 +155,7 @@ jobs:
- name: Add external label
if: steps.check-membership.outputs.is-external == 'true'
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
@@ -168,7 +168,7 @@ jobs:
- name: Add internal label
if: steps.check-membership.outputs.is-external == 'false'
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
@@ -190,13 +190,13 @@ jobs:
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v3
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.ORG_MEMBERSHIP_APP_ID }}
private-key: ${{ secrets.ORG_MEMBERSHIP_APP_PRIVATE_KEY }}
- name: Backfill labels
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
+5 -5
View File
@@ -40,7 +40,7 @@ jobs:
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v3
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.ORG_MEMBERSHIP_APP_ID }}
private-key: ${{ secrets.ORG_MEMBERSHIP_APP_PRIVATE_KEY }}
@@ -48,7 +48,7 @@ jobs:
- name: Check if contributor is external
if: steps.app-token.outcome == 'success'
id: check-membership
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
@@ -90,7 +90,7 @@ jobs:
# event fires and triggers require_issue_link.yml.
- name: Apply contributor tier label
if: steps.check-membership.outputs.is-external == 'true'
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
# Use App token so the "labeled" event propagates to downstream
# workflows (e.g. require_issue_link.yml).
@@ -145,7 +145,7 @@ jobs:
- name: Add external label
if: steps.check-membership.outputs.is-external == 'true'
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
# Use App token so the "labeled" event propagates to downstream
# workflows (e.g. require_issue_link.yml). Events created by the
@@ -161,7 +161,7 @@ jobs:
- name: Add internal label
if: steps.check-membership.outputs.is-external == 'false'
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
+1 -1
View File
@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up uv
uses: ./.github/actions/uv_setup
+9 -1
View File
@@ -1,3 +1,11 @@
# LangGraph examples
This directory is retained purely for archival purposes and is no longer updated. The examples previously found here have been moved to the newly [consolidated LangChain documentation](https://docs.langchain.com/oss/python/langgraph/overview). Please refer to the LangChain docs for the most up-to-date examples and usage guidelines for LangGraph.
This directory is retained purely for archival purposes and is no longer updated.
## 🤔 What is this?
The examples previously found here have been moved to the consolidated LangChain documentation. This directory remains available for historical reference, but new examples and usage guidance are published in the docs.
## 📖 Documentation
For up-to-date LangGraph examples, tutorials, and guides, see the [LangGraph Docs](https://docs.langchain.com/oss/python/langgraph/overview). Get started with the [LangGraph Quickstart](https://docs.langchain.com/oss/python/langgraph/quickstart).
+27 -5
View File
@@ -1,15 +1,27 @@
# langgraph-checkpoint-conformance
# LangGraph Checkpoint Conformance
Conformance test suite for [LangGraph](https://github.com/langchain-ai/langgraph) checkpointer implementations.
[![PyPI - Version](https://img.shields.io/pypi/v/langgraph-checkpoint-conformance?label=%20)](https://pypi.org/project/langgraph-checkpoint-conformance/#history)
[![PyPI - License](https://img.shields.io/pypi/l/langgraph-checkpoint-conformance)](https://opensource.org/licenses/MIT)
[![PyPI - Downloads](https://img.shields.io/pepy/dt/langgraph-checkpoint-conformance)](https://pypistats.org/packages/langgraph-checkpoint-conformance)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain_oss.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain_oss)
Validates that a `BaseCheckpointSaver` subclass correctly implements the checkpoint storage contract — blob round-trips, metadata preservation, namespace isolation, incremental channel updates, and more.
To help you ship LangGraph apps to production faster, check out [LangSmith](https://www.langchain.com/langsmith).
[LangSmith](https://www.langchain.com/langsmith) is a unified developer platform for building, testing, and monitoring LLM applications.
## Installation
## Quick Install
```bash
pip install langgraph-checkpoint-conformance
uv add langgraph-checkpoint-conformance
```
## 🤔 What is this?
This library provides a conformance test suite for [LangGraph](https://github.com/langchain-ai/langgraph) checkpointer implementations. It validates that a `BaseCheckpointSaver` subclass correctly implements the checkpoint storage contract — blob round-trips, metadata preservation, namespace isolation, incremental channel updates, and more.
## 📖 Documentation
For full documentation, see the [API reference](https://reference.langchain.com/python/langgraph/). For conceptual guides on persistence and memory, see the [LangGraph Docs](https://docs.langchain.com/oss/python/langgraph/overview).
## Quick start
Register your checkpointer with `@checkpointer_test` and run `validate()`:
@@ -110,3 +122,13 @@ async def pg_checkpointer():
async with PostgresSaver.from_conn_string(CONN_STRING) as saver:
yield saver
```
## 📕 Releases & Versioning
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
## 💁 Contributing
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
+33 -3
View File
@@ -1,10 +1,28 @@
# LangGraph Checkpoint Postgres
Implementation of LangGraph CheckpointSaver that uses Postgres.
[![PyPI - Version](https://img.shields.io/pypi/v/langgraph-checkpoint-postgres?label=%20)](https://pypi.org/project/langgraph-checkpoint-postgres/#history)
[![PyPI - License](https://img.shields.io/pypi/l/langgraph-checkpoint-postgres)](https://opensource.org/licenses/MIT)
[![PyPI - Downloads](https://img.shields.io/pepy/dt/langgraph-checkpoint-postgres)](https://pypistats.org/packages/langgraph-checkpoint-postgres)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain_oss.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain_oss)
## Dependencies
To help you ship LangGraph apps to production faster, check out [LangSmith](https://www.langchain.com/langsmith).
[LangSmith](https://www.langchain.com/langsmith) is a unified developer platform for building, testing, and monitoring LLM applications.
By default `langgraph-checkpoint-postgres` installs `psycopg` (Psycopg 3) without any extras. However, you can choose a specific installation that best suits your needs [here](https://www.psycopg.org/psycopg3/docs/basic/install.html) (for example, `psycopg[binary]`).
## Quick Install
```bash
uv add langgraph-checkpoint-postgres
```
## 🤔 What is this?
This library provides a Postgres implementation of LangGraph's checkpoint saver. Use it when you want LangGraph state persistence backed by Postgres for durable, long-running workflows and agents.
By default, `langgraph-checkpoint-postgres` installs `psycopg` (Psycopg 3) without any extras. You can choose a specific installation that best suits your needs in the [Psycopg installation docs](https://www.psycopg.org/psycopg3/docs/basic/install.html), for example `psycopg[binary]`.
## 📖 Documentation
For full documentation, see the [API reference](https://reference.langchain.com/python/langgraph.checkpoint.postgres). For conceptual guides on persistence and memory, see the [LangGraph Docs](https://docs.langchain.com/oss/python/langgraph/overview).
## Security
@@ -20,10 +38,12 @@ By default `langgraph-checkpoint-postgres` installs `psycopg` (Psycopg 3) withou
> When manually creating Postgres connections and passing them to `PostgresSaver` or `AsyncPostgresSaver`, make sure to include `autocommit=True` and `row_factory=dict_row` (`from psycopg.rows import dict_row`). See a full example in this [how-to guide](https://langchain-ai.github.io/langgraph/how-tos/persistence_postgres/).
>
> **Why these parameters are required:**
>
> - `autocommit=True`: Required for the `.setup()` method to properly commit the checkpoint tables to the database. Without this, table creation may not be persisted.
> - `row_factory=dict_row`: Required because the PostgresSaver implementation accesses database rows using dictionary-style syntax (e.g., `row["column_name"]`). The default `tuple_row` factory returns tuples that only support index-based access (e.g., `row[0]`), which will cause `TypeError` exceptions when the checkpointer tries to access columns by name.
>
> **Example of incorrect usage:**
>
> ```python
> # ❌ This will fail with TypeError during checkpointer operations
> with psycopg.connect(DB_URI) as conn: # Missing autocommit=True and row_factory=dict_row
@@ -118,3 +138,13 @@ async with AsyncPostgresSaver.from_conn_string(DB_URI) as checkpointer:
# list checkpoints
[c async for c in checkpointer.alist(read_config)]
```
## 📕 Releases & Versioning
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
## 💁 Contributing
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
+31 -1
View File
@@ -1,6 +1,26 @@
# LangGraph SQLite Checkpoint
Implementation of LangGraph CheckpointSaver that uses SQLite DB (both sync and async, via `aiosqlite`)
[![PyPI - Version](https://img.shields.io/pypi/v/langgraph-checkpoint-sqlite?label=%20)](https://pypi.org/project/langgraph-checkpoint-sqlite/#history)
[![PyPI - License](https://img.shields.io/pypi/l/langgraph-checkpoint-sqlite)](https://opensource.org/licenses/MIT)
[![PyPI - Downloads](https://img.shields.io/pepy/dt/langgraph-checkpoint-sqlite)](https://pypistats.org/packages/langgraph-checkpoint-sqlite)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain_oss.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain_oss)
To help you ship LangGraph apps to production faster, check out [LangSmith](https://www.langchain.com/langsmith).
[LangSmith](https://www.langchain.com/langsmith) is a unified developer platform for building, testing, and monitoring LLM applications.
## Quick Install
```bash
uv add langgraph-checkpoint-sqlite
```
## 🤔 What is this?
This library provides a SQLite implementation of LangGraph's checkpoint saver, with both sync and async support via `aiosqlite`. Use it when you want LangGraph state persistence backed by SQLite for local development, testing, or lightweight deployments.
## 📖 Documentation
For full documentation, see the [API reference](https://reference.langchain.com/python/langgraph.checkpoint.sqlite). For conceptual guides on persistence and memory, see the [LangGraph Docs](https://docs.langchain.com/oss/python/langgraph/overview).
## Security
@@ -91,3 +111,13 @@ async with AsyncSqliteSaver.from_conn_string(":memory:") as checkpointer:
# list checkpoints
[c async for c in checkpointer.alist(read_config)]
```
## 📕 Releases & Versioning
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
## 💁 Contributing
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
+32 -2
View File
@@ -1,6 +1,26 @@
# LangGraph Checkpoint
This library defines the base interface for LangGraph checkpointers. Checkpointers provide a persistence layer for LangGraph. They allow you to interact with and manage the graph's state. When you use a graph with a checkpointer, the checkpointer saves a _checkpoint_ of the graph state at every superstep, enabling several powerful capabilities like human-in-the-loop, "memory" between interactions and more.
[![PyPI - Version](https://img.shields.io/pypi/v/langgraph-checkpoint?label=%20)](https://pypi.org/project/langgraph-checkpoint/#history)
[![PyPI - License](https://img.shields.io/pypi/l/langgraph-checkpoint)](https://opensource.org/licenses/MIT)
[![PyPI - Downloads](https://img.shields.io/pepy/dt/langgraph-checkpoint)](https://pypistats.org/packages/langgraph-checkpoint)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain_oss.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain_oss)
To help you ship LangGraph apps to production faster, check out [LangSmith](https://www.langchain.com/langsmith).
[LangSmith](https://www.langchain.com/langsmith) is a unified developer platform for building, testing, and monitoring LLM applications.
## Quick Install
```bash
uv add langgraph-checkpoint
```
## 🤔 What is this?
This library defines the base interface for LangGraph checkpointers. Checkpointers provide a persistence layer for LangGraph: they save graph state at every superstep, enabling human-in-the-loop, memory between interactions, durable execution, and more.
## 📖 Documentation
For full documentation, see the [API reference](https://reference.langchain.com/python/langgraph.checkpoint). For conceptual guides on persistence and memory, see the [LangGraph Docs](https://docs.langchain.com/oss/python/langgraph/overview).
## Key concepts
@@ -24,7 +44,7 @@ You must pass these when invoking the graph as part of the configurable part of
### Serde
`langgraph_checkpoint` also defines protocol for serialization/deserialization (serde) and provides an default implementation (`langgraph.checkpoint.serde.jsonplus.JsonPlusSerializer`) that handles a wide variety of types, including LangChain and LangGraph primitives, datetimes, enums and more.
`langgraph-checkpoint` also defines protocol for serialization/deserialization (serde) and provides a default implementation (`langgraph.checkpoint.serde.jsonplus.JsonPlusSerializer`) that handles a wide variety of types, including LangChain and LangGraph primitives, datetimes, enums and more.
> [!IMPORTANT]
> **Checkpoint deserialization security:** By default the serializer allows any Python type found in checkpoint data. New applications should set the environment variable `LANGGRAPH_STRICT_MSGPACK=true` or pass an explicit `allowed_msgpack_modules` list to `JsonPlusSerializer` to restrict deserialization to known-safe types.
@@ -89,3 +109,13 @@ checkpointer.get(read_config)
# list checkpoints
list(checkpointer.list(read_config))
```
## 📕 Releases & Versioning
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
## 💁 Contributing
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
+60 -29
View File
@@ -1,29 +1,47 @@
# LangGraph CLI
The official command-line interface for LangGraph, providing tools to create, develop, and deploy LangGraph applications.
[![PyPI - Version](https://img.shields.io/pypi/v/langgraph-cli?label=%20)](https://pypi.org/project/langgraph-cli/#history)
[![PyPI - License](https://img.shields.io/pypi/l/langgraph-cli)](https://opensource.org/licenses/MIT)
[![PyPI - Downloads](https://img.shields.io/pepy/dt/langgraph-cli)](https://pypistats.org/packages/langgraph-cli)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain_oss.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain_oss)
## Installation
To help you ship LangGraph apps to production faster, check out [LangSmith](https://www.langchain.com/langsmith).
[LangSmith](https://www.langchain.com/langsmith) is a unified developer platform for building, testing, and monitoring LLM applications.
## Quick Install
Install via pip:
```bash
pip install langgraph-cli
uv add langgraph-cli
```
## 🤔 What is this?
The LangGraph CLI is the official command-line interface for LangGraph. It provides tools to create, develop, build, and run LangGraph applications locally or in Docker.
## 📖 Documentation
For full documentation, see the [LangGraph CLI reference](https://reference.langchain.com/python/langgraph-cli). For conceptual guides and tutorials, see the [LangGraph Docs](https://docs.langchain.com/oss/python/langgraph/overview).
For development mode with hot reloading:
```bash
pip install "langgraph-cli[inmem]"
uv add "langgraph-cli[inmem]"
```
## Commands
### `langgraph new` 🌱
Create a new LangGraph project from a template
Create a new LangGraph project from a template.
```bash
langgraph new [PATH] --template TEMPLATE_NAME
```
### `langgraph dev` 🏃‍♀️
Run LangGraph API server in development mode with hot reloading
Run LangGraph API server in development mode with hot reloading.
```bash
langgraph dev [OPTIONS]
--host TEXT Host to bind to (default: 127.0.0.1)
@@ -35,7 +53,9 @@ langgraph dev [OPTIONS]
```
### `langgraph up` 🚀
Launch LangGraph API server in Docker
Launch LangGraph API server in Docker.
```bash
langgraph up [OPTIONS]
-p, --port INTEGER Port to expose (default: 8123)
@@ -47,7 +67,9 @@ langgraph up [OPTIONS]
```
### `langgraph build`
Build a Docker image for your LangGraph application
Build a Docker image for your LangGraph application.
```bash
langgraph build -t IMAGE_TAG [OPTIONS]
--platform TEXT Target platforms (e.g., linux/amd64,linux/arm64)
@@ -56,7 +78,9 @@ langgraph build -t IMAGE_TAG [OPTIONS]
```
### `langgraph dockerfile`
Generate a Dockerfile for custom deployments
Generate a Dockerfile for custom deployments.
```bash
langgraph dockerfile SAVE_PATH [OPTIONS]
-c, --config FILE Config file path
@@ -68,18 +92,18 @@ The CLI uses a `langgraph.json` configuration file with these key settings:
```json
{
"dependencies": ["langchain_openai", "./your_package"], // Required: Package dependencies
"dependencies": ["langchain_openai", "./your_package"],
"graphs": {
"my_graph": "./your_package/file.py:graph" // Required: Graph definitions
"my_graph": "./your_package/file.py:graph"
},
"env": "./.env", // Optional: Environment variables
"python_version": "3.11", // Optional: Python version (3.11/3.12)
"pip_config_file": "./pip.conf", // Optional: pip configuration
"dockerfile_lines": [] // Optional: Additional Dockerfile commands
"env": "./.env",
"python_version": "3.11",
"pip_config_file": "./pip.conf",
"dockerfile_lines": []
}
```
See the [full documentation](https://langchain-ai.github.io/langgraph/cloud/reference/cli/) for detailed configuration options.
See the [full documentation](https://reference.langchain.com/python/langgraph-cli) for detailed configuration options.
## Development
@@ -87,19 +111,26 @@ To develop the CLI itself:
1. Clone the repository
2. Navigate to the CLI directory: `cd libs/cli`
3. Install development dependencies: `uv pip install`
3. Install development dependencies: `uv sync`
4. Make your changes to the CLI code
5. Test your changes:
```bash
# Run CLI commands directly
uv run langgraph --help
# Or use the examples
cd examples
uv pip install
uv run langgraph dev # or other commands
```
## License
```bash
# Run CLI commands directly
uv run langgraph --help
This project is licensed under the terms specified in the repository's LICENSE file.
# Or use the examples
cd examples
uv sync
uv run langgraph dev # or other commands
```
## 📕 Releases & Versioning
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
## 💁 Contributing
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
+5 -1
View File
@@ -10,7 +10,7 @@ This template demonstrates a simple chatbot implemented using [LangGraph.js](htt
The core logic, defined in `src/agent/graph.ts`, showcases a straightforward chatbot that responds to user queries while maintaining context from previous messages.
## What it does
## 🤔 What is this?
The simple chatbot:
@@ -20,6 +20,10 @@ The simple chatbot:
This template provides a foundation that can be easily customized and extended to create more complex conversational agents.
## 📖 Documentation
For JavaScript and TypeScript documentation, see the [LangGraph.js docs](https://docs.langchain.com/oss/javascript/langgraph/overview). LangGraph Studio also integrates with [LangSmith](https://smith.langchain.com/) for tracing and collaboration with teammates.
## Getting Started
Assuming you have already [installed LangGraph Studio](https://github.com/langchain-ai/langgraph-studio?tab=readme-ov-file#download), to set up:
+1 -1
View File
@@ -1 +1 @@
__version__ = "0.4.27"
__version__ = "0.4.30"
+46 -1
View File
@@ -159,7 +159,14 @@ OPT_POSTGRES_URI = click.option(
OPT_API_VERSION = click.option(
"--api-version",
type=str,
help="API server version to use for the base image. If unspecified, the latest version will be used.",
help=(
"API server version to use for the base image. If unspecified, the "
"latest stable version will be used. Compatible ranges like "
"~=0.11.0.dev5 stay on 0.11.0.dev5 while only newer dev builds exist, "
"then resolve to the newest matching rc or stable release, for example "
"0.11.0rc1 or 0.11.0. Stable-floating ranges like >~=0.11.0.dev5 "
"can also pick up future stable releases, for example 0.12.0."
),
)
OPT_ENGINE_RUNTIME_MODE = click.option(
@@ -724,6 +731,30 @@ def dockerfile(
default="WARNING",
help="Set the log level for the API server.",
)
@click.option(
"--ssl-certfile",
type=click.Path(
exists=True,
file_okay=True,
dir_okay=False,
resolve_path=True,
path_type=pathlib.Path,
),
default=None,
help="Path to an SSL certificate file for serving the development server over HTTPS.",
)
@click.option(
"--ssl-keyfile",
type=click.Path(
exists=True,
file_okay=True,
dir_okay=False,
resolve_path=True,
path_type=pathlib.Path,
),
default=None,
help="Path to an SSL key file for serving the development server over HTTPS.",
)
@cli.command(
"dev",
help="🏃‍♀️‍➡️ Run LangGraph API server in development mode with hot reloading and debugging support",
@@ -742,8 +773,20 @@ def dev(
allow_blocking: bool,
tunnel: bool,
server_log_level: str,
ssl_certfile: pathlib.Path | None,
ssl_keyfile: pathlib.Path | None,
):
"""CLI entrypoint for running the LangGraph API server."""
if (ssl_certfile is None) != (ssl_keyfile is None):
raise click.UsageError(
"Both --ssl-certfile and --ssl-keyfile must be provided to enable HTTPS."
)
if ssl_certfile and ssl_keyfile and tunnel:
raise click.UsageError(
"Cannot use --tunnel with SSL options. Please choose either to serve over HTTPS or to expose via a tunnel, but not both."
)
try:
from langgraph_api.cli import run_server # type: ignore
except ImportError:
@@ -814,6 +857,8 @@ def dev(
server_level=server_log_level,
checkpointer=config_json.get("checkpointer"),
disable_persistence=config_json.get("disable_persistence", False),
ssl_certfile=ssl_certfile,
ssl_keyfile=ssl_keyfile,
)
+162 -1
View File
@@ -9,6 +9,7 @@ from collections import Counter
from typing import Literal, NamedTuple
import click
import httpx
from langgraph_cli.schemas import Config, Distros
from langgraph_cli.uv_lock import python_config_to_docker_uv_lock
@@ -41,6 +42,31 @@ _API_VERSION_PATTERN = re.compile(
r"(?:\.(?P<patch>\d+))?"
r"(?:(?:\.|)(?:[A-Za-z][0-9A-Za-z]*))?$"
)
_API_VERSION_RANGE_PATTERN = re.compile(r"^(?P<operator>~=|>~=)\s*(?P<version>.+)$")
_API_VERSION_PART_PATTERN = re.compile(
r"^(?P<major>\d+)"
r"(?:\.(?P<minor>\d+))?"
r"(?:\.(?P<patch>\d+))?"
r"(?:(?:\.|)(?P<pre>dev|rc)(?P<pre_n>\d+))?$"
)
class _ParsedApiVersion(NamedTuple):
release: tuple[int, ...]
prerelease: str | None
prerelease_number: int
class _ApiVersionRange(NamedTuple):
floor: _ParsedApiVersion
allow_future_stable: bool
_PRERELEASE_ORDER = {
"dev": 0,
"rc": 1,
None: 2,
}
def has_disallowed_build_command_content(command: str) -> bool:
@@ -141,6 +167,133 @@ def _parse_api_version_parts(version_str: str) -> tuple[int, ...]:
return tuple(int(part) for part in match.groups() if part is not None)
def _parse_api_version(version_str: str) -> _ParsedApiVersion:
match = _API_VERSION_PART_PATTERN.fullmatch(version_str)
if not match:
raise ValueError("Version must be major or major.minor or major.minor.patch.")
release = tuple(
int(part)
for part in (
match.group("major"),
match.group("minor"),
match.group("patch"),
)
if part is not None
)
prerelease = match.group("pre")
prerelease_number = int(match.group("pre_n") or 0)
return _ParsedApiVersion(release, prerelease, prerelease_number)
def _api_version_sort_key(
version: _ParsedApiVersion,
) -> tuple[tuple[int, ...], int, int]:
return (
version.release,
_PRERELEASE_ORDER[version.prerelease],
version.prerelease_number,
)
def _api_version_upper_bound(version: _ParsedApiVersion) -> tuple[int, ...]:
release = version.release
if len(release) <= 2:
return (release[0] + 1,)
return (release[0], release[1] + 1)
def _is_compatible_api_version_candidate(
candidate: _ParsedApiVersion,
version_range: _ApiVersionRange,
upper_bound: tuple[int, ...],
) -> bool:
floor = version_range.floor
if _api_version_sort_key(candidate) < _api_version_sort_key(floor):
return False
outside_compatible_range = candidate.release[: len(upper_bound)] >= upper_bound
if outside_compatible_range and not version_range.allow_future_stable:
return False
if outside_compatible_range and candidate.prerelease is not None:
return False
if floor.prerelease == "dev" and candidate.prerelease == "dev":
return candidate == floor
return True
def _ensure_compatible_api_version_base_image(base_image: str) -> None:
if ":" in base_image:
raise click.UsageError(
"Compatible api_version ranges cannot be used with a tagged base_image."
)
def _get_pypi_versions(package_name: str) -> list[str]:
try:
response = httpx.get(
f"https://pypi.org/pypi/{package_name}/json",
timeout=10,
)
response.raise_for_status()
except httpx.HTTPError as exc:
raise click.UsageError(
f"Failed to fetch PyPI versions for {package_name}: {exc}"
) from None
payload = response.json()
releases = payload.get("releases", {})
if not isinstance(releases, dict):
raise click.UsageError(
f"Failed to fetch PyPI versions for {package_name}: invalid response."
)
return [version for version in releases if isinstance(version, str)]
def _resolve_compatible_api_version(
api_version: str,
base_image: str,
version_distro_tag: str,
) -> str:
match = _API_VERSION_RANGE_PATTERN.fullmatch(api_version)
if not match:
return api_version
floor_str = match.group("version").strip()
try:
floor = _parse_api_version(floor_str)
except ValueError:
raise click.UsageError(
f"Invalid compatible api_version range: {api_version}.\n\n"
"Use a compatible version range, e.g.:\n"
' "api_version": "~=0.11.0.dev5"\n'
"or a stable-floating range, e.g.:\n"
' "api_version": ">~=0.11.0.dev5"'
) from None
version_range = _ApiVersionRange(
floor=floor,
allow_future_stable=match.group("operator") == ">~=",
)
_ensure_compatible_api_version_base_image(base_image)
pypi_versions = _get_pypi_versions("langgraph-api")
candidates: list[tuple[_ParsedApiVersion, str]] = []
upper_bound = _api_version_upper_bound(floor)
for candidate_str in pypi_versions:
try:
candidate = _parse_api_version(candidate_str)
except ValueError:
continue
if _is_compatible_api_version_candidate(candidate, version_range, upper_bound):
candidates.append((candidate, candidate_str))
if not candidates:
raise click.UsageError(
f"No PyPI releases match compatible api_version range {api_version!r} "
f"for {base_image} with {version_distro_tag!r}."
)
return max(candidates, key=lambda item: _api_version_sort_key(item[0]))[1]
def _is_node_graph(spec: str | dict) -> bool:
"""Check if a graph is a Node.js graph based on the file extension."""
if isinstance(spec, dict):
@@ -194,7 +347,12 @@ def validate_config(config: Config) -> Config:
)
if api_version:
try:
parts = _parse_api_version_parts(api_version)
compatible_match = _API_VERSION_RANGE_PATTERN.fullmatch(api_version)
parts = _parse_api_version_parts(
compatible_match.group("version").strip()
if compatible_match
else api_version
)
if len(parts) > 3:
raise ValueError(
"Version must be major or major.minor or major.minor.patch."
@@ -1430,6 +1588,9 @@ def docker_tag(
# Prepend API version if provided
if api_version:
api_version = _resolve_compatible_api_version(
api_version, base_image, f"{language}{version_distro_tag}"
)
full_tag = f"{api_version}-{language}{version_distro_tag}"
elif "/langgraph-server" in base_image and version_distro_tag not in base_image:
return f"{base_image}-{language}{version_distro_tag}"
+1 -1
View File
@@ -23,7 +23,7 @@ dependencies = [
path = "langgraph_cli/__init__.py"
[project.optional-dependencies]
inmem = [
"langgraph-api>=0.5.35,<0.10.0 ; python_version >= '3.11'",
"langgraph-api>=0.5.35,<0.12.0 ; python_version >= '3.11'",
"langgraph-runtime-inmem>=0.7 ; python_version >= '3.11'",
]
+25
View File
@@ -320,6 +320,31 @@ def test_top_level_help_truncates_command_descriptions_to_single_line() -> None:
assert "[Beta] List LangSmith Deployments." in deploy_list_line
def test_dev_command_requires_ssl_certfile_and_keyfile_together(tmp_path) -> None:
config_path = tmp_path / "langgraph.json"
config_path.write_text(
json.dumps({"dependencies": [], "graphs": {"agent": "./agent.py:graph"}}),
encoding="utf-8",
)
certfile = tmp_path / "cert.pem"
certfile.write_text("cert", encoding="utf-8")
runner = CliRunner()
result = runner.invoke(
cli,
[
"dev",
"--config",
str(config_path),
"--ssl-certfile",
str(certfile),
],
)
assert result.exit_code != 0
assert "Both --ssl-certfile and --ssl-keyfile must be provided" in result.output
def test_deploy_list_command(monkeypatch) -> None:
runner = CliRunner()
captured: dict[str, str] = {}
+157
View File
@@ -2961,6 +2961,163 @@ def test_docker_tag_with_prerelease_api_version(version: str, in_config: bool):
assert tag == f"langchain/langgraph-api:{version}-py3.11"
def test_docker_tag_with_compatible_api_version_promotes_to_latest_patch():
config = validate_config(
{
"python_version": "3.12",
"dependencies": ["."],
"graphs": {"agent": "./agent.py:graph"},
"image_distro": "wolfi",
"api_version": "~=0.11.0.dev5",
}
)
with patch(
"langgraph_cli.config._get_pypi_versions",
return_value=[
"0.11.0.dev5",
"0.11.0.dev6",
"0.11.0rc1",
"0.11.0",
"0.11.1rc1",
"0.11.1",
"0.12.0rc1",
],
) as get_versions:
tag = docker_tag(config)
get_versions.assert_called_once_with("langgraph-api")
assert tag == "langchain/langgraph-api:0.11.1-py3.12-wolfi"
def test_docker_tag_with_compatible_api_version_freezes_dev_until_rc():
config = validate_config(
{
"python_version": "3.12",
"dependencies": ["."],
"graphs": {"agent": "./agent.py:graph"},
"api_version": "~=0.11.0.dev5",
}
)
with patch(
"langgraph_cli.config._get_pypi_versions",
return_value=[
"0.11.0.dev5",
"0.11.0.dev6",
"0.11.0.dev7",
],
):
tag = docker_tag(config)
assert tag == "langchain/langgraph-api:0.11.0.dev5-py3.12"
def test_docker_tag_with_stable_floating_api_version_promotes_to_future_stable():
config = validate_config(
{
"python_version": "3.12",
"dependencies": ["."],
"graphs": {"agent": "./agent.py:graph"},
"image_distro": "wolfi",
"api_version": ">~=0.11.0.dev5",
}
)
with patch(
"langgraph_cli.config._get_pypi_versions",
return_value=[
"0.11.0.dev5",
"0.11.0.dev6",
"0.11.0rc1",
"0.11.0",
"0.11.1",
"0.12.0rc1",
"0.12.0",
"0.13.0.dev1",
"0.13.0",
],
) as get_versions:
tag = docker_tag(config)
get_versions.assert_called_once_with("langgraph-api")
assert tag == "langchain/langgraph-api:0.13.0-py3.12-wolfi"
def test_docker_tag_with_stable_floating_api_version_ignores_future_prereleases():
config = validate_config(
{
"python_version": "3.12",
"dependencies": ["."],
"graphs": {"agent": "./agent.py:graph"},
"api_version": ">~=0.11.0.dev5",
}
)
with patch(
"langgraph_cli.config._get_pypi_versions",
return_value=[
"0.11.0.dev5",
"0.11.0",
"0.12.0rc1",
"0.12.0.dev1",
],
):
tag = docker_tag(config)
assert tag == "langchain/langgraph-api:0.11.0-py3.12"
def test_validate_config_rejects_unrecognized_api_version_range_operator():
with pytest.raises(click.UsageError, match="Invalid version format"):
validate_config(
{
"python_version": "3.12",
"dependencies": ["."],
"graphs": {"agent": "./agent.py:graph"},
"api_version": "~>=0.11.0.dev5",
}
)
def test_docker_tag_with_compatible_api_version_supports_node_images():
config = validate_config(
{
"node_version": "20",
"graphs": {"agent": "./agent.js:graph"},
"image_distro": "wolfi",
"api_version": "~=1.2.4",
}
)
with patch(
"langgraph_cli.config._get_pypi_versions",
return_value=[
"1.2.4",
"1.2.5",
"1.3.0",
],
) as get_versions:
tag = docker_tag(config)
get_versions.assert_called_once_with("langgraph-api")
assert tag == "langchain/langgraphjs-api:1.2.5-node20-wolfi"
def test_docker_tag_with_compatible_api_version_rejects_tagged_base_image():
config = validate_config(
{
"python_version": "3.11",
"dependencies": ["."],
"graphs": {"agent": "./agent.py:graph"},
"api_version": "~=0.11.0.dev5",
}
)
with pytest.raises(click.UsageError, match="tagged base_image"):
docker_tag(config, base_image="langchain/langgraph-api:0.11.0")
def test_config_to_docker_with_api_version():
"""Test config_to_docker function with api_version parameter."""
+3 -3
View File
@@ -237,14 +237,14 @@ wheels = [
[[package]]
name = "langchain-protocol"
version = "0.0.15"
version = "0.0.17"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/4f/24/9777489d6fbbee64af0c8f96d4f840239c408cf694f3394672807dafc490/langchain_protocol-0.0.15.tar.gz", hash = "sha256:9ab2d11ee73944754f10e037e717098d3a6796f0e58afa9cadda6154e7655ade", size = 5862, upload-time = "2026-05-01T22:30:04.748Z" }
sdist = { url = "https://files.pythonhosted.org/packages/44/b3/4e2429876c7a35585618caa2b9f9089f7162a6b50562b614ad82ac11c17e/langchain_protocol-0.0.17.tar.gz", hash = "sha256:e7cbe58c205df4b4fd87dc6d5bb23f10e13b236d0e2e1b0b9d05bc2b648f3eea", size = 6026, upload-time = "2026-06-12T18:39:51.923Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/1d/7a/9c97a7b9cbe4c5dc6a44cdb1545450c28f0c8ce89b9c1f0ee7fbad896263/langchain_protocol-0.0.15-py3-none-any.whl", hash = "sha256:461eb794358f83d5e42635a5797799ffec7b4702314e34edf73ac21e75d3ef79", size = 6982, upload-time = "2026-05-01T22:30:03.877Z" },
{ url = "https://files.pythonhosted.org/packages/13/0a/a1bfe72c6ec856e99773bbd96c8086421e554b3693d0142b9ea009c6ac92/langchain_protocol-0.0.17-py3-none-any.whl", hash = "sha256:982a08fe152586ed10d4ff3d538c2e0b5766e5f307cdea325e10be3f2c17cae6", size = 7096, upload-time = "2026-06-12T18:39:50.973Z" },
]
[[package]]
+3 -3
View File
@@ -211,14 +211,14 @@ wheels = [
[[package]]
name = "langchain-protocol"
version = "0.0.15"
version = "0.0.17"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/4f/24/9777489d6fbbee64af0c8f96d4f840239c408cf694f3394672807dafc490/langchain_protocol-0.0.15.tar.gz", hash = "sha256:9ab2d11ee73944754f10e037e717098d3a6796f0e58afa9cadda6154e7655ade", size = 5862, upload-time = "2026-05-01T22:30:04.748Z" }
sdist = { url = "https://files.pythonhosted.org/packages/44/b3/4e2429876c7a35585618caa2b9f9089f7162a6b50562b614ad82ac11c17e/langchain_protocol-0.0.17.tar.gz", hash = "sha256:e7cbe58c205df4b4fd87dc6d5bb23f10e13b236d0e2e1b0b9d05bc2b648f3eea", size = 6026, upload-time = "2026-06-12T18:39:51.923Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/1d/7a/9c97a7b9cbe4c5dc6a44cdb1545450c28f0c8ce89b9c1f0ee7fbad896263/langchain_protocol-0.0.15-py3-none-any.whl", hash = "sha256:461eb794358f83d5e42635a5797799ffec7b4702314e34edf73ac21e75d3ef79", size = 6982, upload-time = "2026-05-01T22:30:03.877Z" },
{ url = "https://files.pythonhosted.org/packages/13/0a/a1bfe72c6ec856e99773bbd96c8086421e554b3693d0142b9ea009c6ac92/langchain_protocol-0.0.17-py3-none-any.whl", hash = "sha256:982a08fe152586ed10d4ff3d538c2e0b5766e5f307cdea325e10be3f2c17cae6", size = 7096, upload-time = "2026-06-12T18:39:50.973Z" },
]
[[package]]
+1 -1
View File
@@ -1094,7 +1094,7 @@ test = [
requires-dist = [
{ name = "click", specifier = ">=8.1.7" },
{ name = "httpx", specifier = ">=0.24.0" },
{ name = "langgraph-api", marker = "python_full_version >= '3.11' and extra == 'inmem'", specifier = ">=0.5.35,<0.10.0" },
{ name = "langgraph-api", marker = "python_full_version >= '3.11' and extra == 'inmem'", specifier = ">=0.5.35,<0.12.0" },
{ name = "langgraph-runtime-inmem", marker = "python_full_version >= '3.11' and extra == 'inmem'", specifier = ">=0.7" },
{ name = "langgraph-sdk", marker = "python_full_version >= '3.11'", specifier = ">=0.1.0" },
{ name = "pathspec", specifier = ">=0.11.0" },
+24 -79
View File
@@ -1,100 +1,45 @@
<div align="center">
<a href="https://www.langchain.com/langgraph">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="../../.github/images/logo-dark.svg">
<source media="(prefers-color-scheme: light)" srcset="../../.github/images/logo-light.svg">
<img alt="LangGraph Logo" src=".github/images/logo-dark.svg" width="50%">
</picture>
</a>
</div>
# 🦜🕸️ LangGraph
<div align="center">
<h3>Low-level orchestration framework for building stateful agents.</h3>
</div>
[![PyPI - Version](https://img.shields.io/pypi/v/langgraph?label=%20)](https://pypi.org/project/langgraph/#history)
[![PyPI - License](https://img.shields.io/pypi/l/langgraph)](https://opensource.org/licenses/MIT)
[![PyPI - Downloads](https://img.shields.io/pepy/dt/langgraph)](https://pypistats.org/packages/langgraph)
[![Open Issues](https://img.shields.io/github/issues-raw/langchain-ai/langgraph)](https://github.com/langchain-ai/langgraph/issues)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain_oss.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain_oss)
<div align="center">
<a href="https://opensource.org/licenses/MIT" target="_blank"><img src="https://img.shields.io/pypi/l/langgraph" alt="PyPI - License"></a>
<a href="https://pypistats.org/packages/langgraph" target="_blank"><img src="https://img.shields.io/pepy/dt/langgraph" alt="PyPI - Downloads"></a>
<a href="https://pypi.org/project/langgraph/" target="_blank"><img src="https://img.shields.io/pypi/v/langgraph.svg?label=%20" alt="Version"></a>
<a href="https://github.com/langchain-ai/langgraph/issues" target="_blank"><img src="https://img.shields.io/github/issues-raw/langchain-ai/langgraph" alt="Open Issues"></a>
<a href="https://docs.langchain.com/oss/python/langgraph/overview" target="_blank"><img src="https://img.shields.io/badge/docs-latest-blue" alt="Docs"></a>
<a href="https://x.com/langchain_oss" target="_blank"><img src="https://img.shields.io/twitter/url/https/twitter.com/langchain_oss.svg?style=social&label=Follow%20%40LangChain" alt="Twitter / X"></a>
</div>
Looking for the JS/TS version? Check out [LangGraph.js](https://github.com/langchain-ai/langgraphjs).
<br>
To help you ship LangGraph apps to production faster, check out [LangSmith](https://www.langchain.com/langsmith).
[LangSmith](https://www.langchain.com/langsmith) is a unified developer platform for building, testing, and monitoring LLM applications.
Trusted by companies shaping the future of agents – including Klarna, Replit, Elastic, and more – LangGraph is a low-level orchestration framework for building, managing, and deploying long-running, stateful agents.
## Quick Install
## Get started
Install LangGraph:
```
pip install -U langgraph
```bash
uv add langgraph
```
Create a simple workflow:
## 🤔 What is this?
```python
from langgraph.graph import START, StateGraph
from typing_extensions import TypedDict
LangGraph is a low-level orchestration framework for building, managing, and deploying long-running, stateful agents. LangGraph provides the infrastructure for durable execution, streaming, human-in-the-loop, persistence, memory, and more.
We recommend you use LangGraph when you have advanced needs that require a combination of deterministic and agentic workflows, heavy customization, and carefully controlled latency. Use [LangChain](https://docs.langchain.com/oss/python/langchain/overview) when you want to quickly build agents and applications powered by LLMs using pre-built agent architectures and model integrations.
class State(TypedDict):
text: str
LangChain [agents](https://docs.langchain.com/oss/python/langchain/agents) are built on top of LangGraph in order to provide durable execution, streaming, human-in-the-loop, persistence, and more. (You do not need to know LangGraph for basic LangChain agent usage.)
Trusted by companies shaping the future of agents – including Klarna, Replit, Elastic, and more – LangGraph is used to ship AI applications at scale.
def node_a(state: State) -> dict:
return {"text": state["text"] + "a"}
## 📖 Documentation
For full documentation, see the [API reference](https://reference.langchain.com/python/langgraph/). For conceptual guides, tutorials, and examples on using LangGraph, see the [LangGraph Docs](https://docs.langchain.com/oss/python/langgraph/overview). Get started with the [LangGraph Quickstart](https://docs.langchain.com/oss/python/langgraph/quickstart).
def node_b(state: State) -> dict:
return {"text": state["text"] + "b"}
## 📕 Releases & Versioning
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
graph = StateGraph(State)
graph.add_node("node_a", node_a)
graph.add_node("node_b", node_b)
graph.add_edge(START, "node_a")
graph.add_edge("node_a", "node_b")
## 💁 Contributing
print(graph.compile().invoke({"text": ""}))
# {'text': 'ab'}
```
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
Get started with the [LangGraph Quickstart](https://docs.langchain.com/oss/python/langgraph/quickstart).
To quickly build agents with LangChain's `create_agent` (built on LangGraph), see the [LangChain Agents documentation](https://docs.langchain.com/oss/python/langchain/agents).
## Core benefits
LangGraph provides low-level supporting infrastructure for *any* long-running, stateful workflow or agent. LangGraph does not abstract prompts or architecture, and provides the following central benefits:
- [Durable execution](https://docs.langchain.com/oss/python/langgraph/durable-execution): Build agents that persist through failures and can run for extended periods, automatically resuming from exactly where they left off.
- [Human-in-the-loop](https://docs.langchain.com/oss/python/langgraph/interrupts): Seamlessly incorporate human oversight by inspecting and modifying agent state at any point during execution.
- [Comprehensive memory](https://docs.langchain.com/oss/python/langgraph/memory): Create truly stateful agents with both short-term working memory for ongoing reasoning and long-term persistent memory across sessions.
- [Debugging with LangSmith](http://www.langchain.com/langsmith): Gain deep visibility into complex agent behavior with visualization tools that trace execution paths, capture state transitions, and provide detailed runtime metrics.
- [Production-ready deployment](https://docs.langchain.com/langsmith/app-development): Deploy sophisticated agent systems confidently with scalable infrastructure designed to handle the unique challenges of stateful, long-running workflows.
## LangGraph’s ecosystem
While LangGraph can be used standalone, it also integrates seamlessly with any LangChain product, giving developers a full suite of tools for building agents. To improve your LLM application development, pair LangGraph with:
- [LangSmith](http://www.langchain.com/langsmith) — Helpful for agent evals and observability. Debug poor-performing LLM app runs, evaluate agent trajectories, gain visibility in production, and improve performance over time.
- [LangSmith Deployment](https://docs.langchain.com/langsmith/deployments) — Deploy and scale agents effortlessly with a purpose-built deployment platform for long running, stateful workflows. Discover, reuse, configure, and share agents across teams — and iterate quickly with visual prototyping in [LangGraph Studio](https://docs.langchain.com/oss/python/langgraph/studio).
- [LangChain](https://docs.langchain.com/oss/python/langchain/overview) – Provides integrations and composable components to streamline LLM application development.
> [!NOTE]
> Looking for the JS version of LangGraph? See the [JS repo](https://github.com/langchain-ai/langgraphjs) and the [JS docs](https://docs.langchain.com/oss/javascript/langgraph/overview).
## Additional resources
- [Guides](https://docs.langchain.com/oss/python/langgraph/guides): Quick, actionable code snippets for topics such as streaming, adding memory & persistence, and design patterns (e.g. branching, subgraphs, etc.).
- [Reference](https://reference.langchain.com/python/langgraph/): Detailed reference on core classes, methods, how to use the graph and checkpointing APIs, and higher-level prebuilt components.
- [Examples](https://docs.langchain.com/oss/python/langgraph/agentic-rag): Guided examples on getting started with LangGraph.
- [LangChain Forum](https://forum.langchain.com/): Connect with the community and share all of your technical questions, ideas, and feedback.
- [LangChain Academy](https://academy.langchain.com/courses/intro-to-langgraph): Learn the basics of LangGraph in our free, structured course.
- [Case studies](https://www.langchain.com/built-with-langgraph): Hear how industry leaders use LangGraph to ship AI applications at scale.
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
## Acknowledgements
+46 -13
View File
@@ -1,7 +1,7 @@
from __future__ import annotations
from collections import ChainMap
from collections.abc import Sequence
from collections.abc import Mapping, Sequence
from os import getenv
from typing import Any, cast
@@ -79,6 +79,42 @@ def patch_checkpoint_map(
return config
def _copy_mapping_value(value: Any) -> Any:
return dict(value) if isinstance(value, Mapping) else value
def _merge_metadata(
base: Mapping[str, Any] | None, new: Mapping[str, Any] | None
) -> dict[str, Any]:
"""Merge metadata without mutating inputs.
Top-level keys merge with newer values winning. `lc_versions` is the only
mapping-valued key that merges one level deeper, so independent LangChain
packages can contribute package versions without changing generic metadata
semantics. Mapping values are copied one level, so deeper nested objects
remain shared. `None` inputs are treated as empty metadata.
Mirrors `langchain_core.runnables.config._merge_metadata_dicts` so configs
that pass through LangGraph's merge keep the same `lc_versions` semantics;
keep the two in sync. Unlike lc-core, this copies mapping values one level
(intentionally more defensive — do not "simplify" back to a shared ref).
"""
merged = {key: _copy_mapping_value(value) for key, value in (base or {}).items()}
for key, value in (new or {}).items():
if (
key == "lc_versions"
and isinstance(merged.get(key), Mapping)
and isinstance(value, Mapping)
):
merged[key] = {
**cast(Mapping[str, Any], merged[key]),
**value,
}
else:
merged[key] = _copy_mapping_value(value)
return merged
def _merge_callbacks(base: Callbacks, new: Callbacks) -> Callbacks:
"""Merge two callbacks values (None / list / BaseCallbackManager).
@@ -126,10 +162,10 @@ def merge_configs(*configs: RunnableConfig | None) -> RunnableConfig:
if not value:
continue
if key == "metadata":
if base_value := base.get(key):
base[key] = {**base_value, **value} # type: ignore
else:
base[key] = value # type: ignore[literal-required]
base[key] = _merge_metadata(
cast(Mapping[str, Any] | None, base.get(key)),
cast(Mapping[str, Any], value),
)
elif key == "tags":
if base_value := base.get(key):
base[key] = [*base_value, *value] # type: ignore
@@ -327,14 +363,11 @@ def ensure_config(*configs: RunnableConfig | None) -> RunnableConfig:
empty.get("callbacks"), cast(Callbacks, v)
)
elif k == "metadata":
# Shallow-merge metadata dicts across configs so values
# bound via with_config(...) (e.g. user_id) are preserved
# when later configs supply other metadata keys.
existing = empty.get("metadata")
empty["metadata"] = (
{**cast(dict, existing), **cast(dict, v)}
if existing
else cast(dict, v).copy()
# Matches merge_configs: top-level metadata keys merge, and
# only `lc_versions` merges one level deeper.
empty["metadata"] = _merge_metadata(
cast(Mapping[str, Any] | None, empty.get("metadata")),
cast(Mapping[str, Any], v),
)
elif k == "tags":
# Concatenate tags across configs so values bound via
+2 -2
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "langgraph"
version = "1.2.4"
version = "1.2.5"
description = "Building stateful, multi-actor applications with LLMs"
authors = []
requires-python = ">=3.10"
@@ -24,7 +24,7 @@ classifiers = [
'Programming Language :: Python :: 3.13',
]
dependencies = [
"langchain-core>=1.4.0,<2",
"langchain-core>=1.4.7,<2",
"langgraph-checkpoint>=4.1.0,<5.0.0",
"langgraph-sdk>=0.4.2,<0.5.0",
"langgraph-prebuilt>=1.1.0,<1.2.0",
+7
View File
@@ -9,6 +9,7 @@ import pytest
from langchain_core.messages import AIMessage, AnyMessage, ToolCall
from langchain_core.runnables import RunnableConfig, RunnableMap, RunnablePick
from langchain_core.tools import tool
from langchain_core.version import VERSION as LANGCHAIN_CORE_VERSION
from langgraph.checkpoint.base import BaseCheckpointSaver
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.prebuilt.chat_agent_executor import create_react_agent
@@ -1399,6 +1400,7 @@ def test_prebuilt_tool_chat(snapshot: SnapshotAssertion) -> None:
"ls_provider": "fakechatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
(
@@ -1461,6 +1463,7 @@ def test_prebuilt_tool_chat(snapshot: SnapshotAssertion) -> None:
"ls_provider": "fakechatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
]
@@ -1513,6 +1516,7 @@ def test_prebuilt_tool_chat(snapshot: SnapshotAssertion) -> None:
"ls_provider": "fakechatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
]
@@ -6884,6 +6888,7 @@ def test_weather_subgraph(
"ls_provider": "fakemessageslistchatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
),
@@ -6911,6 +6916,7 @@ def test_weather_subgraph(
"ls_provider": "fakemessageslistchatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
),
@@ -6947,6 +6953,7 @@ def test_weather_subgraph(
"ls_provider": "fakemessageslistchatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
]
@@ -11,6 +11,7 @@ from typing import (
import pytest
from langchain_core.messages import AnyMessage, ToolCall
from langchain_core.runnables import RunnableConfig, RunnablePick
from langchain_core.version import VERSION as LANGCHAIN_CORE_VERSION
from langgraph.checkpoint.base import BaseCheckpointSaver
from langgraph.prebuilt.chat_agent_executor import create_react_agent
from langgraph.prebuilt.tool_node import ToolNode
@@ -1150,6 +1151,7 @@ async def test_prebuilt_tool_chat() -> None:
"ls_provider": "fakechatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
(
@@ -1212,6 +1214,7 @@ async def test_prebuilt_tool_chat() -> None:
"ls_provider": "fakechatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
]
@@ -1264,6 +1267,7 @@ async def test_prebuilt_tool_chat() -> None:
"ls_provider": "fakechatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
]
@@ -3981,6 +3985,7 @@ async def test_weather_subgraph(
"ls_provider": "fakemessageslistchatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
),
@@ -4008,6 +4013,7 @@ async def test_weather_subgraph(
"ls_provider": "fakemessageslistchatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
),
@@ -4044,6 +4050,7 @@ async def test_weather_subgraph(
"ls_provider": "fakemessageslistchatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
},
),
]
+2
View File
@@ -23,6 +23,7 @@ from langchain_core.runnables import (
RunnablePassthrough,
)
from langchain_core.runnables.graph import Edge
from langchain_core.version import VERSION as LANGCHAIN_CORE_VERSION
from langgraph.cache.base import BaseCache
from langgraph.checkpoint.base import (
BaseCheckpointSaver,
@@ -6923,6 +6924,7 @@ def test_tags_stream_mode_messages() -> None:
"ls_provider": "genericfakechatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
"tags": ["meow"],
},
)
+111 -272
View File
@@ -24,6 +24,7 @@ from langchain_core.language_models import GenericFakeChatModel
from langchain_core.messages import HumanMessage
from langchain_core.runnables import RunnableConfig, RunnableLambda, RunnablePassthrough
from langchain_core.utils.aiter import aclosing
from langchain_core.version import VERSION as LANGCHAIN_CORE_VERSION
from langgraph.cache.base import BaseCache
from langgraph.checkpoint.base import (
BaseCheckpointSaver,
@@ -7604,6 +7605,7 @@ async def test_tags_stream_mode_messages() -> None:
"ls_provider": "genericfakechatmodel",
"ls_model_type": "chat",
"ls_integration": "langchain_chat_model",
"lc_versions": {"langchain-core": LANGCHAIN_CORE_VERSION},
"tags": ["meow"],
},
)
@@ -8761,280 +8763,117 @@ async def test_imp_exception(
{"my_workflow": "done"},
]
assert [c async for c in my_workflow.astream_events(1, thread1)] == [
{
"event": "on_chain_start",
"data": {"input": 1},
"name": "LangGraph",
"tags": [],
"run_id": AnyStr(),
"metadata": {"thread_id": "1", "ls_integration": "langgraph"},
"parent_ids": [],
},
{
"event": "on_chain_start",
"data": {"input": 1},
"name": "my_workflow",
"tags": ["graph:step:4"],
"run_id": AnyStr(),
"metadata": {
"thread_id": "1",
"ls_integration": "langgraph",
"langgraph_step": 4,
"langgraph_node": "my_workflow",
"langgraph_triggers": ("__start__",),
"langgraph_path": ("__pregel_pull", "my_workflow"),
"langgraph_checkpoint_ns": AnyStr(),
},
"parent_ids": [AnyStr()],
},
{
"event": "on_chain_start",
"data": {"input": {"number": 1}},
"name": "my_task",
"tags": ["seq:step:1"],
"run_id": AnyStr(),
"metadata": {
"thread_id": "1",
"ls_integration": "langgraph",
"langgraph_step": 4,
"langgraph_node": "my_task",
"langgraph_triggers": ("__pregel_push",),
"langgraph_path": (
"__pregel_push",
("__pregel_pull", "my_workflow"),
2,
True,
),
"langgraph_checkpoint_ns": AnyStr(),
},
"parent_ids": [
AnyStr(),
AnyStr(),
],
},
{
"event": "on_chain_stream",
"run_id": AnyStr(),
"name": "my_task",
"tags": ["seq:step:1"],
"metadata": {
"thread_id": "1",
"ls_integration": "langgraph",
"langgraph_step": 4,
"langgraph_node": "my_task",
"langgraph_triggers": ("__pregel_push",),
"langgraph_path": (
"__pregel_push",
("__pregel_pull", "my_workflow"),
2,
True,
),
"langgraph_checkpoint_ns": AnyStr(),
},
"data": {"chunk": 2},
"parent_ids": [
AnyStr(),
AnyStr(),
],
},
{
"event": "on_chain_end",
"data": {"output": 2, "input": {"number": 1}},
"run_id": AnyStr(),
"name": "my_task",
"tags": ["seq:step:1"],
"metadata": {
"thread_id": "1",
"ls_integration": "langgraph",
"langgraph_step": 4,
"langgraph_node": "my_task",
"langgraph_triggers": ("__pregel_push",),
"langgraph_path": (
"__pregel_push",
("__pregel_pull", "my_workflow"),
2,
True,
),
"langgraph_checkpoint_ns": AnyStr(),
},
"parent_ids": [
AnyStr(),
AnyStr(),
],
},
{
"event": "on_chain_stream",
"run_id": AnyStr(),
"name": "LangGraph",
"tags": [],
"metadata": {"thread_id": "1", "ls_integration": "langgraph"},
"data": {"chunk": {"my_task": 2}},
"parent_ids": [],
},
{
"event": "on_chain_start",
"data": {"input": {"number": 1}},
"name": "task_with_exception",
"tags": ["seq:step:1"],
"run_id": AnyStr(),
"metadata": {
"thread_id": "1",
"ls_integration": "langgraph",
"langgraph_step": 4,
"langgraph_node": "my_task",
"langgraph_triggers": ("__pregel_push",),
"langgraph_path": (
"__pregel_push",
("__pregel_pull", "my_workflow"),
2,
True,
),
"langgraph_checkpoint_ns": AnyStr(),
},
"parent_ids": [
AnyStr(),
AnyStr(),
],
},
{
"event": "on_chain_start",
"data": {"input": {"number": 1}},
"name": "my_task",
"tags": ["seq:step:1"],
"run_id": AnyStr(),
"metadata": {
"thread_id": "1",
"ls_integration": "langgraph",
"langgraph_step": 4,
"langgraph_node": "my_task",
"langgraph_triggers": ("__pregel_push",),
"langgraph_path": (
"__pregel_push",
("__pregel_pull", "my_workflow"),
2,
True,
),
"langgraph_checkpoint_ns": AnyStr(),
},
"parent_ids": [
AnyStr(),
AnyStr(),
],
},
{
"event": "on_chain_stream",
"run_id": AnyStr(),
"name": "my_task",
"tags": ["seq:step:1"],
"metadata": {
"thread_id": "1",
"ls_integration": "langgraph",
"langgraph_step": 4,
"langgraph_node": "my_task",
"langgraph_triggers": ("__pregel_push",),
"langgraph_path": (
"__pregel_push",
("__pregel_pull", "my_workflow"),
2,
True,
),
"langgraph_checkpoint_ns": AnyStr(),
},
"data": {"chunk": 2},
"parent_ids": [
AnyStr(),
AnyStr(),
],
},
{
"event": "on_chain_end",
"data": {"output": 2, "input": {"number": 1}},
"run_id": AnyStr(),
"name": "my_task",
"tags": ["seq:step:1"],
"metadata": {
"thread_id": "1",
"ls_integration": "langgraph",
"langgraph_step": 4,
"langgraph_node": "my_task",
"langgraph_triggers": ("__pregel_push",),
"langgraph_path": (
"__pregel_push",
("__pregel_pull", "my_workflow"),
2,
True,
),
"langgraph_checkpoint_ns": AnyStr(),
},
"parent_ids": [
AnyStr(),
AnyStr(),
],
},
{
"event": "on_chain_stream",
"run_id": AnyStr(),
"name": "my_workflow",
"tags": ["graph:step:4"],
"metadata": {
"thread_id": "1",
"ls_integration": "langgraph",
"langgraph_step": 4,
"langgraph_node": "my_workflow",
"langgraph_triggers": ("__start__",),
"langgraph_path": ("__pregel_pull", "my_workflow"),
"langgraph_checkpoint_ns": AnyStr(),
},
"data": {"chunk": "done"},
"parent_ids": [AnyStr()],
},
{
"event": "on_chain_stream",
"run_id": AnyStr(),
"name": "LangGraph",
"tags": [],
"metadata": {"thread_id": "1", "ls_integration": "langgraph"},
"data": {"chunk": {"my_task": 2}},
"parent_ids": [],
},
{
"event": "on_chain_end",
"data": {"output": "done", "input": 1},
"run_id": AnyStr(),
"name": "my_workflow",
"tags": ["graph:step:4"],
"metadata": {
"thread_id": "1",
"ls_integration": "langgraph",
"langgraph_step": 4,
"langgraph_node": "my_workflow",
"langgraph_triggers": ("__start__",),
"langgraph_path": ("__pregel_pull", "my_workflow"),
"langgraph_checkpoint_ns": AnyStr(),
},
"parent_ids": [AnyStr()],
},
{
"event": "on_chain_stream",
"run_id": AnyStr(),
"name": "LangGraph",
"tags": [],
"metadata": {"thread_id": "1", "ls_integration": "langgraph"},
"data": {"chunk": {"my_workflow": "done"}},
"parent_ids": [],
},
{
"event": "on_chain_end",
"data": {"output": "done"},
"run_id": AnyStr(),
"name": "LangGraph",
"tags": [],
"metadata": {"thread_id": "1", "ls_integration": "langgraph"},
"parent_ids": [],
},
events = [c async for c in my_workflow.astream_events(1, thread1)]
assert [(event["event"], event["name"]) for event in events] == [
("on_chain_start", "LangGraph"),
("on_chain_start", "my_workflow"),
("on_chain_start", "my_task"),
("on_chain_stream", "my_task"),
("on_chain_end", "my_task"),
("on_chain_stream", "LangGraph"),
("on_chain_start", "task_with_exception"),
("on_chain_start", "my_task"),
("on_chain_stream", "my_task"),
("on_chain_end", "my_task"),
("on_chain_stream", "my_workflow"),
("on_chain_stream", "LangGraph"),
("on_chain_end", "my_workflow"),
("on_chain_stream", "LangGraph"),
("on_chain_end", "LangGraph"),
]
root_events = [event for event in events if event["name"] == "LangGraph"]
for event in root_events:
assert event["tags"] == []
assert event["metadata"]["thread_id"] == "1"
assert event["metadata"]["ls_integration"] == "langgraph"
assert event["parent_ids"] == []
workflow_events = [event for event in events if event["name"] == "my_workflow"]
for event in workflow_events:
assert event["tags"] == ["graph:step:4"]
metadata = event["metadata"]
assert metadata["thread_id"] == "1"
assert metadata["ls_integration"] == "langgraph"
assert metadata["langgraph_step"] == 4
assert metadata["langgraph_node"] == "my_workflow"
assert metadata["langgraph_triggers"] == ("__start__",)
assert metadata["langgraph_path"] == ("__pregel_pull", "my_workflow")
assert isinstance(metadata["langgraph_checkpoint_ns"], str)
assert len(event["parent_ids"]) == 1
task_events = [event for event in events if event["name"] == "my_task"]
assert len(task_events) == 6
for event in task_events:
assert event["tags"] == ["seq:step:1"]
metadata = event["metadata"]
assert metadata["thread_id"] == "1"
assert metadata["ls_integration"] == "langgraph"
assert metadata["langgraph_step"] == 4
assert metadata["langgraph_node"] == "my_task"
assert metadata["langgraph_triggers"] == ("__pregel_push",)
assert metadata["langgraph_path"][:2] == (
"__pregel_push",
("__pregel_pull", "my_workflow"),
)
assert metadata["langgraph_path"][-1] is True
assert isinstance(metadata["langgraph_checkpoint_ns"], str)
assert len(event["parent_ids"]) == 2
task_with_exception_event = next(
event for event in events if event["name"] == "task_with_exception"
)
assert task_with_exception_event["event"] == "on_chain_start"
assert task_with_exception_event["data"] == {"input": {"number": 1}}
assert task_with_exception_event["tags"] == ["seq:step:1"]
metadata = task_with_exception_event["metadata"]
assert metadata["thread_id"] == "1"
assert metadata["ls_integration"] == "langgraph"
assert metadata["langgraph_step"] == 4
assert metadata["langgraph_node"] == "task_with_exception"
assert metadata["langgraph_triggers"] == ("__pregel_push",)
assert metadata["langgraph_path"][:2] == (
"__pregel_push",
("__pregel_pull", "my_workflow"),
)
assert metadata["langgraph_path"][-1] is True
assert isinstance(metadata["langgraph_checkpoint_ns"], str)
assert len(task_with_exception_event["parent_ids"]) == 2
assert [
event["data"]
for event in events
if event["event"] == "on_chain_stream" and event["name"] == "LangGraph"
] == [
{"chunk": {"my_task": 2}},
{"chunk": {"my_task": 2}},
{"chunk": {"my_workflow": "done"}},
]
assert [
event["data"]
for event in events
if event["event"] == "on_chain_stream" and event["name"] == "my_task"
] == [{"chunk": 2}, {"chunk": 2}]
assert [
event["data"]
for event in events
if event["event"] == "on_chain_end" and event["name"] == "my_task"
] == [
{"output": 2, "input": {"number": 1}},
{"output": 2, "input": {"number": 1}},
]
assert [
event["data"]
for event in events
if event["event"] == "on_chain_stream" and event["name"] == "my_workflow"
] == [{"chunk": "done"}]
assert [
event["data"]
for event in events
if event["event"] == "on_chain_end" and event["name"] == "my_workflow"
] == [{"output": "done", "input": 1}]
assert events[-1]["data"] == {"output": "done"}
@pytest.mark.parametrize("with_timeout", [False, "inner", "outer", "both"])
@pytest.mark.parametrize("subgraph_persist", [True, False])
+154
View File
@@ -25,6 +25,7 @@ from langgraph._internal._config import (
_merge_callbacks,
ensure_config,
get_callback_manager_for_config,
merge_configs,
)
from langgraph._internal._fields import (
_is_optional_type,
@@ -520,6 +521,159 @@ def test_ensure_config_metadata_later_wins_per_key() -> None:
assert merged["metadata"]["shared"] == "from_b"
def test_merge_configs_merges_metadata_lc_versions() -> None:
a = {
"metadata": {
"lc_versions": {"langgraph": "1.2.4"},
"lc_agent_name": "agent",
}
}
b = {"metadata": {"lc_versions": {"langchain-core": "1.2.0"}}}
merged = merge_configs(a, b)
assert merged["metadata"]["lc_versions"] == {
"langgraph": "1.2.4",
"langchain-core": "1.2.0",
}
assert merged["metadata"]["lc_agent_name"] == "agent"
def test_ensure_config_merges_metadata_lc_versions() -> None:
a = {
"metadata": {
"lc_versions": {"langgraph": "1.2.4"},
"lc_agent_name": "agent",
}
}
b = {"metadata": {"lc_versions": {"langchain-core": "1.2.0"}}}
merged = ensure_config(a, b)
assert merged["metadata"]["lc_versions"] == {
"langgraph": "1.2.4",
"langchain-core": "1.2.0",
}
assert merged["metadata"]["lc_agent_name"] == "agent"
@pytest.mark.parametrize("merge", [merge_configs, ensure_config])
def test_metadata_lc_versions_later_values_win_without_recursive_merge(
merge: Callable[..., RunnableConfig],
) -> None:
a = {
"metadata": {
"lc_versions": {
"langgraph": "1.2.4",
"nested": {"only_a": "A", "shared": "from_a"},
}
}
}
b = {
"metadata": {
"lc_versions": {
"langchain-core": "1.2.0",
"nested": {"only_b": "B", "shared": "from_b"},
}
}
}
merged = merge(a, b)
assert merged["metadata"]["lc_versions"] == {
"langgraph": "1.2.4",
"langchain-core": "1.2.0",
"nested": {"only_b": "B", "shared": "from_b"},
}
@pytest.mark.parametrize("merge", [merge_configs, ensure_config])
def test_metadata_nested_mappings_other_than_lc_versions_are_replaced(
merge: Callable[..., RunnableConfig],
) -> None:
a = {"metadata": {"versions": {"langgraph": "1.2.4"}, "mode": "bound"}}
b = {
"metadata": {
"versions": {"langchain-core": "1.2.0"},
"mode": {"source": "runtime"},
}
}
merged = merge(a, b)
assert merged["metadata"]["versions"] == {"langchain-core": "1.2.0"}
assert merged["metadata"]["mode"] == {"source": "runtime"}
@pytest.mark.parametrize("merge", [merge_configs, ensure_config])
def test_metadata_non_mapping_values_later_wins(
merge: Callable[..., RunnableConfig],
) -> None:
a = {"metadata": {"lc_versions": {"langgraph": "1.2.4"}, "mode": "bound"}}
b = {"metadata": {"lc_versions": "runtime", "mode": {"source": "runtime"}}}
merged = merge(a, b)
assert merged["metadata"]["lc_versions"] == "runtime"
assert merged["metadata"]["mode"] == {"source": "runtime"}
@pytest.mark.parametrize("merge", [merge_configs, ensure_config])
def test_metadata_lc_versions_merge_does_not_mutate_inputs(
merge: Callable[..., RunnableConfig],
) -> None:
a_versions = {"langgraph": "1.2.4"}
b_versions = {"langchain-core": "1.2.0"}
a = {"metadata": {"lc_versions": a_versions}}
b = {"metadata": {"lc_versions": b_versions}}
merged = merge(a, b)
assert a == {"metadata": {"lc_versions": {"langgraph": "1.2.4"}}}
assert b == {"metadata": {"lc_versions": {"langchain-core": "1.2.0"}}}
assert merged["metadata"]["lc_versions"] is not a_versions
assert merged["metadata"]["lc_versions"] is not b_versions
merged["metadata"]["lc_versions"]["langgraph"] = "changed"
assert a_versions == {"langgraph": "1.2.4"}
assert b_versions == {"langchain-core": "1.2.0"}
@pytest.mark.parametrize("merge", [merge_configs, ensure_config])
def test_metadata_single_sided_mapping_values_are_copied(
merge: Callable[..., RunnableConfig],
) -> None:
base_versions = {"langgraph": "1.2.4"}
new_versions = {"langchain-core": "1.2.0"}
merged_base_only = merge({"metadata": {"lc_versions": base_versions}})
merged_new_only = merge(
{"metadata": {}},
{"metadata": {"lc_versions": new_versions}},
)
assert merged_base_only["metadata"]["lc_versions"] is not base_versions
assert merged_new_only["metadata"]["lc_versions"] is not new_versions
merged_base_only["metadata"]["lc_versions"]["langgraph"] = "changed"
merged_new_only["metadata"]["lc_versions"]["langchain-core"] = "changed"
assert base_versions == {"langgraph": "1.2.4"}
assert new_versions == {"langchain-core": "1.2.0"}
@pytest.mark.parametrize("merge", [merge_configs, ensure_config])
def test_metadata_empty_incoming_preserves_base_lc_versions(
merge: Callable[..., RunnableConfig],
) -> None:
a = {"metadata": {"lc_versions": {"langgraph": "1.2.4"}}}
b = {"metadata": {"lc_versions": {}}}
merged = merge(a, b)
assert merged["metadata"]["lc_versions"] == {"langgraph": "1.2.4"}
@pytest.mark.parametrize("merge", [merge_configs, ensure_config])
def test_metadata_lc_versions_accumulate_across_more_than_two_configs(
merge: Callable[..., RunnableConfig],
) -> None:
a = {"metadata": {"lc_versions": {"langgraph": "1.2.4"}}}
b = {"metadata": {"lc_versions": {"langchain-core": "1.2.0"}}}
c = {"metadata": {"lc_versions": {"langchain": "1.1.0"}}}
merged = merge(a, b, c)
assert merged["metadata"]["lc_versions"] == {
"langgraph": "1.2.4",
"langchain-core": "1.2.0",
"langchain": "1.1.0",
}
def test_ensure_config_merges_tags_across_configs() -> None:
a = {"tags": ["alpha"]}
b = {"tags": ["beta"]}
+17 -17
View File
@@ -1350,7 +1350,7 @@ wheels = [
[[package]]
name = "langchain-core"
version = "1.4.0"
version = "1.4.7"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "jsonpatch" },
@@ -1363,9 +1363,9 @@ dependencies = [
{ name = "typing-extensions" },
{ name = "uuid-utils" },
]
sdist = { url = "https://files.pythonhosted.org/packages/59/de/679a53472c25860837e32c0442c962fa86e95317a36460e2c9d5c91b17c2/langchain_core-1.4.0.tar.gz", hash = "sha256:1dc341eed802ed9c117c0df3923c991e5e9e226571e5725c194eeb5bd93d1a7f", size = 920260, upload-time = "2026-05-11T18:42:35.919Z" }
sdist = { url = "https://files.pythonhosted.org/packages/ee/2b/fffaff399d20a56d40b9562fa19701e91abd72d8c9d9bc8c2673077b56b6/langchain_core-1.4.7.tar.gz", hash = "sha256:7a825d77de0a3f39adbd9d09612a75e85527e14a52c1601089bcc062972d9f2b", size = 952522, upload-time = "2026-06-12T19:23:57.588Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/0f/1a/86c38c27b81913a1c6c12448cab55defb5a1097c7dc9a4cea83f55477a2d/langchain_core-1.4.0-py3-none-any.whl", hash = "sha256:23cbbdb46e38ddd1dd5247e6167e96013eae74bea4c5949c550809970a9e565c", size = 548120, upload-time = "2026-05-11T18:42:33.992Z" },
{ url = "https://files.pythonhosted.org/packages/de/3e/dcdffa60078ae7b3a00ebb4cbbf1a204a14c3609983c604886523a7d4418/langchain_core-1.4.7-py3-none-any.whl", hash = "sha256:bcadd51951140ecdcba98311dbd931ba5de02a5ba8a2288dad5069c1eea2a13d", size = 554941, upload-time = "2026-06-12T19:23:55.826Z" },
]
[[package]]
@@ -1382,7 +1382,7 @@ wheels = [
[[package]]
name = "langgraph"
version = "1.2.4"
version = "1.2.5"
source = { editable = "." }
dependencies = [
{ name = "langchain-core" },
@@ -1454,7 +1454,7 @@ test = [
[package.metadata]
requires-dist = [
{ name = "langchain-core", specifier = ">=1.4.0,<2" },
{ name = "langchain-core", specifier = ">=1.4.7,<2" },
{ name = "langgraph-checkpoint", editable = "../checkpoint" },
{ name = "langgraph-prebuilt", editable = "../prebuilt" },
{ name = "langgraph-sdk", editable = "../sdk-py" },
@@ -1721,7 +1721,7 @@ inmem = [
requires-dist = [
{ name = "click", specifier = ">=8.1.7" },
{ name = "httpx", specifier = ">=0.24.0" },
{ name = "langgraph-api", marker = "python_full_version >= '3.11' and extra == 'inmem'", specifier = ">=0.5.35,<0.10.0" },
{ name = "langgraph-api", marker = "python_full_version >= '3.11' and extra == 'inmem'", specifier = ">=0.5.35,<0.12.0" },
{ name = "langgraph-runtime-inmem", marker = "python_full_version >= '3.11' and extra == 'inmem'", specifier = ">=0.7" },
{ name = "langgraph-sdk", marker = "python_full_version >= '3.11'", specifier = ">=0.1.0" },
{ name = "pathspec", specifier = ">=0.11.0" },
@@ -3510,19 +3510,19 @@ wheels = [
[[package]]
name = "tornado"
version = "6.5.5"
version = "6.5.6"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/f8/f1/3173dfa4a18db4a9b03e5d55325559dab51ee653763bb8745a75af491286/tornado-6.5.5.tar.gz", hash = "sha256:192b8f3ea91bd7f1f50c06955416ed76c6b72f96779b962f07f911b91e8d30e9", size = 516006, upload-time = "2026-03-10T21:31:02.067Z" }
sdist = { url = "https://files.pythonhosted.org/packages/50/57/6d7303a77ae439d9189108f76c0c4fd89ee5e2cc8387bffb55232565c4ed/tornado-6.5.6.tar.gz", hash = "sha256:9a365179fe8ff6b8766f602c0f67c185d778193e9bdd828b19f0b6ed7764177d", size = 518139, upload-time = "2026-05-27T15:35:54.646Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/59/8c/77f5097695f4dd8255ecbd08b2a1ed8ba8b953d337804dd7080f199e12bf/tornado-6.5.5-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:487dc9cc380e29f58c7ab88f9e27cdeef04b2140862e5076a66fb6bb68bb1bfa", size = 445983, upload-time = "2026-03-10T21:30:44.28Z" },
{ url = "https://files.pythonhosted.org/packages/ab/5e/7625b76cd10f98f1516c36ce0346de62061156352353ef2da44e5c21523c/tornado-6.5.5-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:65a7f1d46d4bb41df1ac99f5fcb685fb25c7e61613742d5108b010975a9a6521", size = 444246, upload-time = "2026-03-10T21:30:46.571Z" },
{ url = "https://files.pythonhosted.org/packages/b2/04/7b5705d5b3c0fab088f434f9c83edac1573830ca49ccf29fb83bf7178eec/tornado-6.5.5-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:e74c92e8e65086b338fd56333fb9a68b9f6f2fe7ad532645a290a464bcf46be5", size = 447229, upload-time = "2026-03-10T21:30:48.273Z" },
{ url = "https://files.pythonhosted.org/packages/34/01/74e034a30ef59afb4097ef8659515e96a39d910b712a89af76f5e4e1f93c/tornado-6.5.5-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:435319e9e340276428bbdb4e7fa732c2d399386d1de5686cb331ec8eee754f07", size = 448192, upload-time = "2026-03-10T21:30:51.22Z" },
{ url = "https://files.pythonhosted.org/packages/be/00/fe9e02c5a96429fce1a1d15a517f5d8444f9c412e0bb9eadfbe3b0fc55bf/tornado-6.5.5-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:3f54aa540bdbfee7b9eb268ead60e7d199de5021facd276819c193c0fb28ea4e", size = 448039, upload-time = "2026-03-10T21:30:53.52Z" },
{ url = "https://files.pythonhosted.org/packages/82/9e/656ee4cec0398b1d18d0f1eb6372c41c6b889722641d84948351ae19556d/tornado-6.5.5-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:36abed1754faeb80fbd6e64db2758091e1320f6bba74a4cf8c09cd18ccce8aca", size = 447445, upload-time = "2026-03-10T21:30:55.541Z" },
{ url = "https://files.pythonhosted.org/packages/5a/76/4921c00511f88af86a33de770d64141170f1cfd9c00311aea689949e274e/tornado-6.5.5-cp39-abi3-win32.whl", hash = "sha256:dd3eafaaeec1c7f2f8fdcd5f964e8907ad788fe8a5a32c4426fbbdda621223b7", size = 448582, upload-time = "2026-03-10T21:30:57.142Z" },
{ url = "https://files.pythonhosted.org/packages/2c/23/f6c6112a04d28eed765e374435fb1a9198f73e1ec4b4024184f21faeb1ad/tornado-6.5.5-cp39-abi3-win_amd64.whl", hash = "sha256:6443a794ba961a9f619b1ae926a2e900ac20c34483eea67be4ed8f1e58d3ef7b", size = 448990, upload-time = "2026-03-10T21:30:58.857Z" },
{ url = "https://files.pythonhosted.org/packages/b7/c8/876602cbc96469911f0939f703453c1157b0c826ecb05bdd32e023397d4e/tornado-6.5.5-cp39-abi3-win_arm64.whl", hash = "sha256:2c9a876e094109333f888539ddb2de4361743e5d21eece20688e3e351e4990a6", size = 448016, upload-time = "2026-03-10T21:31:00.43Z" },
{ url = "https://files.pythonhosted.org/packages/1b/0d/b4f481e18c5a51864e6d12b9a05ecf72919696680b747c958c3fc1f4fbae/tornado-6.5.6-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:65fcfaafb079435c2c19dc9e07c0f1cf0fa9051759ed0a7d0a3ba7ea7f64919c", size = 447737, upload-time = "2026-05-27T15:35:38.122Z" },
{ url = "https://files.pythonhosted.org/packages/9e/9c/5430c39fcab1144d35860f457b15e9c08b4bc7ac86764354204e983d6183/tornado-6.5.6-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:38bc01b4acacded2de63ae78023548e41ebe6fbed3ec05a796d7ae3ad893887e", size = 445899, upload-time = "2026-05-27T15:35:40.519Z" },
{ url = "https://files.pythonhosted.org/packages/8b/79/fa7e14a2f939c807a8d30619b4eb604eab219601b78792516ebe22d40cf9/tornado-6.5.6-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:b942e6a137fda31ff54bf8e6e2c8d1c37f1f50583f3ed53fb840b53b9601d104", size = 448964, upload-time = "2026-05-27T15:35:42.106Z" },
{ url = "https://files.pythonhosted.org/packages/a7/71/bd67d5f5199f937dafe03a49a37989f60f600ff6fef34c79412a829d97bd/tornado-6.5.6-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8666946e70171b8c3f1fc9b7876fac492e84822c4c7f3746f4e8f8bc9ac92a79", size = 449935, upload-time = "2026-05-27T15:35:43.906Z" },
{ url = "https://files.pythonhosted.org/packages/cc/a4/c24388c9cf5b3c3a513b56a158af9f23092c9a2810d789e294310797df21/tornado-6.5.6-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:1c34cfab7ad6d104f052f55de06d39bbafc5885cfeb4da688803308dbcfa90b7", size = 449767, upload-time = "2026-05-27T15:35:45.793Z" },
{ url = "https://files.pythonhosted.org/packages/a5/eb/6a07ad550c3f7b37244bd0becdf293ec3d3e961783d8b720a97df50de1b2/tornado-6.5.6-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:385f35e4e22fb52551dfcda4cdc8c30c61c2c001aef5ddad99cdfe116952efd3", size = 449174, upload-time = "2026-05-27T15:35:47.485Z" },
{ url = "https://files.pythonhosted.org/packages/bb/84/3469e098dccdb6763130e06aacd786bb4363fca7b590a55c101ddf34ed30/tornado-6.5.6-cp39-abi3-win32.whl", hash = "sha256:db475f1b67b2809b10bb16264829087724ca8d24fe4ed47f7b8675cae453ef86", size = 450230, upload-time = "2026-05-27T15:35:49.322Z" },
{ url = "https://files.pythonhosted.org/packages/d2/3c/273a04e0b9dd9016f1685cca0c1c8795a71ac88a34a8c889a0b443483226/tornado-6.5.6-cp39-abi3-win_amd64.whl", hash = "sha256:6739bf1e8eb09230f1280ddbd3236f0309db70f2c551a8dbc40f62babdf82f79", size = 450667, upload-time = "2026-05-27T15:35:51.194Z" },
{ url = "https://files.pythonhosted.org/packages/02/98/0cffe22a224f60c5fb1e3aa0b76f9da2e1ca78b0e9545e3d077c68ce60a7/tornado-6.5.6-cp39-abi3-win_arm64.whl", hash = "sha256:2543597b24a695d72338a9a77818362d72387c03ae173f1f169eadc5c91466ac", size = 449690, upload-time = "2026-05-27T15:35:52.902Z" },
]
[[package]]
+37 -7
View File
@@ -1,16 +1,36 @@
# LangGraph Prebuilt
This library defines high-level APIs for creating and executing LangGraph agents and tools.
[![PyPI - Version](https://img.shields.io/pypi/v/langgraph-prebuilt?label=%20)](https://pypi.org/project/langgraph-prebuilt/#history)
[![PyPI - License](https://img.shields.io/pypi/l/langgraph-prebuilt)](https://opensource.org/licenses/MIT)
[![PyPI - Downloads](https://img.shields.io/pepy/dt/langgraph-prebuilt)](https://pypistats.org/packages/langgraph-prebuilt)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain_oss.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain_oss)
To help you ship LangGraph apps to production faster, check out [LangSmith](https://www.langchain.com/langsmith).
[LangSmith](https://www.langchain.com/langsmith) is a unified developer platform for building, testing, and monitoring LLM applications.
## Quick Install
```bash
uv add langgraph
```
## 🤔 What is this?
This library defines high-level APIs for creating and executing LangGraph agents and tools. It includes prebuilt components such as `create_react_agent`, `ToolNode`, validation helpers, and Agent Inbox schemas.
## 📖 Documentation
For full documentation, see the [API reference](https://reference.langchain.com/python/langgraph.prebuilt/). For conceptual guides and tutorials, see the [LangGraph Docs](https://docs.langchain.com/oss/python/langgraph/overview).
> [!IMPORTANT]
> This library is meant to be bundled with `langgraph`, don't install it directly
> This library is bundled with `langgraph`; most users should install `langgraph` instead of installing `langgraph-prebuilt` directly.
## Agents
`langgraph-prebuilt` provides an [implementation](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent) of a tool-calling [ReAct-style](https://langchain-ai.github.io/langgraph/concepts/agentic_concepts/#react-implementation) agent - `create_react_agent`:
`langgraph-prebuilt` provides an [implementation](https://reference.langchain.com/python/langgraph.prebuilt/chat_agent_executor/create_react_agent) of a tool-calling ReAct-style agent - `create_react_agent`:
```bash
pip install langchain-anthropic
uv add langchain-anthropic
```
```python
@@ -39,7 +59,7 @@ app.invoke(
### ToolNode
`langgraph-prebuilt` provides an [implementation](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.tool_node.ToolNode) of a node that executes tool calls - `ToolNode`:
`langgraph-prebuilt` provides an [implementation](https://reference.langchain.com/python/langgraph.prebuilt/tool_node/ToolNode) of a node that executes tool calls - `ToolNode`:
```python
from langgraph.prebuilt import ToolNode
@@ -61,7 +81,7 @@ tool_node.invoke({"messages": [ai_message]})
### ValidationNode
`langgraph-prebuilt` provides an [implementation](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.tool_validator.ValidationNode) of a node that validates tool calls against a pydantic schema - `ValidationNode`:
`langgraph-prebuilt` provides an [implementation](https://reference.langchain.com/python/langgraph.prebuilt/tool_validator/ValidationNode) of a node that validates tool calls against a pydantic schema - `ValidationNode`:
```python
from pydantic import BaseModel, field_validator
@@ -114,4 +134,14 @@ def my_graph_function():
if response['type'] == "response":
# Do something with the response
...
```
```
## 📕 Releases & Versioning
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
## 💁 Contributing
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
+5 -5
View File
@@ -253,7 +253,7 @@ wheels = [
[[package]]
name = "langchain-core"
version = "1.4.0"
version = "1.4.7"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "jsonpatch" },
@@ -266,9 +266,9 @@ dependencies = [
{ name = "typing-extensions" },
{ name = "uuid-utils" },
]
sdist = { url = "https://files.pythonhosted.org/packages/59/de/679a53472c25860837e32c0442c962fa86e95317a36460e2c9d5c91b17c2/langchain_core-1.4.0.tar.gz", hash = "sha256:1dc341eed802ed9c117c0df3923c991e5e9e226571e5725c194eeb5bd93d1a7f", size = 920260, upload-time = "2026-05-11T18:42:35.919Z" }
sdist = { url = "https://files.pythonhosted.org/packages/ee/2b/fffaff399d20a56d40b9562fa19701e91abd72d8c9d9bc8c2673077b56b6/langchain_core-1.4.7.tar.gz", hash = "sha256:7a825d77de0a3f39adbd9d09612a75e85527e14a52c1601089bcc062972d9f2b", size = 952522, upload-time = "2026-06-12T19:23:57.588Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/0f/1a/86c38c27b81913a1c6c12448cab55defb5a1097c7dc9a4cea83f55477a2d/langchain_core-1.4.0-py3-none-any.whl", hash = "sha256:23cbbdb46e38ddd1dd5247e6167e96013eae74bea4c5949c550809970a9e565c", size = 548120, upload-time = "2026-05-11T18:42:33.992Z" },
{ url = "https://files.pythonhosted.org/packages/de/3e/dcdffa60078ae7b3a00ebb4cbbf1a204a14c3609983c604886523a7d4418/langchain_core-1.4.7-py3-none-any.whl", hash = "sha256:bcadd51951140ecdcba98311dbd931ba5de02a5ba8a2288dad5069c1eea2a13d", size = 554941, upload-time = "2026-06-12T19:23:55.826Z" },
]
[[package]]
@@ -285,7 +285,7 @@ wheels = [
[[package]]
name = "langgraph"
version = "1.2.4"
version = "1.2.5"
source = { editable = "../langgraph" }
dependencies = [
{ name = "langchain-core" },
@@ -298,7 +298,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "langchain-core", specifier = ">=1.4.0,<2" },
{ name = "langchain-core", specifier = ">=1.4.7,<2" },
{ name = "langgraph-checkpoint", editable = "../checkpoint" },
{ name = "langgraph-prebuilt", editable = "." },
{ name = "langgraph-sdk", editable = "../sdk-py" },
+11 -1
View File
@@ -1 +1,11 @@
This repository has been moved to [langchain-ai/langgraphjs](https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk).
# LangGraph JavaScript SDK
Looking for the JS/TS version? Check out [LangGraph.js](https://github.com/langchain-ai/langgraphjs).
## 🤔 What is this?
This package has moved to [langchain-ai/langgraphjs](https://github.com/langchain-ai/langgraphjs/tree/main/libs/sdk).
## 📖 Documentation
For JavaScript and TypeScript documentation, see the [LangGraph.js docs](https://docs.langchain.com/oss/javascript/langgraph/overview).
+30 -9
View File
@@ -1,17 +1,30 @@
# LangGraph Python SDK
This repository contains the Python SDK for interacting with the LangSmith Deployment REST API.
[![PyPI - Version](https://img.shields.io/pypi/v/langgraph-sdk?label=%20)](https://pypi.org/project/langgraph-sdk/#history)
[![PyPI - License](https://img.shields.io/pypi/l/langgraph-sdk)](https://opensource.org/licenses/MIT)
[![PyPI - Downloads](https://img.shields.io/pepy/dt/langgraph-sdk)](https://pypistats.org/packages/langgraph-sdk)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchain_oss.svg?style=social&label=Follow%20%40LangChain)](https://x.com/langchain_oss)
## Quick Start
To help you ship LangGraph apps to production faster, check out [LangSmith](https://www.langchain.com/langsmith).
[LangSmith](https://www.langchain.com/langsmith) is a unified developer platform for building, testing, and monitoring LLM applications.
To get started with the Python SDK, [install the package](https://pypi.org/project/langgraph-sdk/)
## Quick Install
```bash
pip install -U langgraph-sdk
uv add langgraph-sdk
```
You will need a running LangGraph API server. If you're running a server locally using `langgraph-cli`, SDK will automatically point at `http://localhost:8123`, otherwise
you would need to specify the server URL when creating a client.
## 🤔 What is this?
This library provides the Python SDK for interacting with the LangGraph API. Use it to connect to a running LangGraph API server, manage assistants and threads, and stream runs from Python applications.
You will need a running LangGraph API server. If you're running a server locally using `langgraph-cli`, the SDK will automatically point at `http://localhost:8123`; otherwise, specify the server URL when creating a client.
## 📖 Documentation
For full documentation, see the [API reference](https://reference.langchain.com/python/langgraph-sdk/). For conceptual guides and tutorials, see the [LangGraph Docs](https://docs.langchain.com/oss/python/langgraph/overview).
## Quick Start
```python
from langgraph_sdk import get_client
@@ -43,9 +56,7 @@ async for chunk in client.runs.stream(thread['thread_id'], agent['assistant_id']
## Thread-Centric Streaming (v3)
`client.threads.stream()` returns a context manager that owns the SSE session for one
thread. Typed projections — values snapshots, message streams, tool calls, custom
events — all share the same underlying connection.
`client.threads.stream()` returns a context manager that owns the SSE session for one thread. Typed projections — values snapshots, message streams, tool calls, custom events — all share the same underlying connection.
```python
from langgraph_sdk import get_client
@@ -73,3 +84,13 @@ async with client.threads.stream(
final = await thread.output # terminal state values
```
## 📕 Releases & Versioning
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
## 💁 Contributing
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
+7 -1
View File
@@ -112,7 +112,13 @@ class LangSmithTracing(TypedDict, total=False):
"""Configuration for LangSmith tracing."""
project_name: str
"""The LangSmith project name to trace to."""
"""A single extra LangSmith project name to trace to."""
project_names: list[str]
"""Multiple extra LangSmith project names to trace to.
Combined with `project_name` (if both are provided) to form the full set of
extra projects. The server also traces to its primary tracing project.
"""
example_id: str
"""The LangSmith example/dataset ID to associate with the trace."""
@@ -144,3 +144,57 @@ class TestLangSmithTracingPayload:
assert captured["json"]["langsmith_tracer"] == {
"project_name": "my-project",
}
def test_langsmith_tracing_project_names_only(self):
"""Test that langsmith_tracing works with multiple project_names."""
from langgraph_sdk._sync.runs import SyncRunsClient
captured: dict[str, Any] = {}
def mock_post(_path, *, json=None, **_kwargs):
captured["json"] = json
return {"run_id": "r1", "status": "pending"}
http = MagicMock()
http.post = MagicMock(side_effect=mock_post)
client = SyncRunsClient(http)
client.create(
thread_id="t1",
assistant_id="a1",
langsmith_tracing={"project_names": ["first", "second"]},
)
assert captured["json"]["langsmith_tracer"] == {
"project_names": ["first", "second"],
}
def test_langsmith_tracing_project_name_and_project_names(self):
"""Test that langsmith_tracing passes both project_name and project_names."""
from langgraph_sdk._sync.runs import SyncRunsClient
captured: dict[str, Any] = {}
def mock_post(_path, *, json=None, **_kwargs):
captured["json"] = json
return {"run_id": "r1", "status": "pending"}
http = MagicMock()
http.post = MagicMock(side_effect=mock_post)
client = SyncRunsClient(http)
client.create(
thread_id="t1",
assistant_id="a1",
langsmith_tracing={
"project_name": "first",
"project_names": ["second", "third"],
"example_id": "example-123",
},
)
assert captured["json"]["langsmith_tracer"] == {
"project_name": "first",
"project_names": ["second", "third"],
"example_id": "example-123",
}
+5 -5
View File
@@ -266,7 +266,7 @@ wheels = [
[[package]]
name = "langchain-core"
version = "1.4.0"
version = "1.4.7"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "jsonpatch" },
@@ -279,9 +279,9 @@ dependencies = [
{ name = "typing-extensions" },
{ name = "uuid-utils" },
]
sdist = { url = "https://files.pythonhosted.org/packages/59/de/679a53472c25860837e32c0442c962fa86e95317a36460e2c9d5c91b17c2/langchain_core-1.4.0.tar.gz", hash = "sha256:1dc341eed802ed9c117c0df3923c991e5e9e226571e5725c194eeb5bd93d1a7f", size = 920260, upload-time = "2026-05-11T18:42:35.919Z" }
sdist = { url = "https://files.pythonhosted.org/packages/ee/2b/fffaff399d20a56d40b9562fa19701e91abd72d8c9d9bc8c2673077b56b6/langchain_core-1.4.7.tar.gz", hash = "sha256:7a825d77de0a3f39adbd9d09612a75e85527e14a52c1601089bcc062972d9f2b", size = 952522, upload-time = "2026-06-12T19:23:57.588Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/0f/1a/86c38c27b81913a1c6c12448cab55defb5a1097c7dc9a4cea83f55477a2d/langchain_core-1.4.0-py3-none-any.whl", hash = "sha256:23cbbdb46e38ddd1dd5247e6167e96013eae74bea4c5949c550809970a9e565c", size = 548120, upload-time = "2026-05-11T18:42:33.992Z" },
{ url = "https://files.pythonhosted.org/packages/de/3e/dcdffa60078ae7b3a00ebb4cbbf1a204a14c3609983c604886523a7d4418/langchain_core-1.4.7-py3-none-any.whl", hash = "sha256:bcadd51951140ecdcba98311dbd931ba5de02a5ba8a2288dad5069c1eea2a13d", size = 554941, upload-time = "2026-06-12T19:23:55.826Z" },
]
[[package]]
@@ -298,7 +298,7 @@ wheels = [
[[package]]
name = "langgraph"
version = "1.2.4"
version = "1.2.5"
source = { editable = "../langgraph" }
dependencies = [
{ name = "langchain-core" },
@@ -311,7 +311,7 @@ dependencies = [
[package.metadata]
requires-dist = [
{ name = "langchain-core", specifier = ">=1.4.0,<2" },
{ name = "langchain-core", specifier = ">=1.4.7,<2" },
{ name = "langgraph-checkpoint", editable = "../checkpoint" },
{ name = "langgraph-prebuilt", editable = "../prebuilt" },
{ name = "langgraph-sdk", editable = "." },