mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-25 09:02:25 +02:00
In langgraph-api, custom-encrypted JSONs need to continue to be SQL-json-mergable after encryption. Previous WIP docs advocated for custom encryption impls where all encrypted kv pairs were shoved into a `__encrypted__: $encrypted_kvs` meta-key. Turns out that pattern causes data loss when running PATCH-style partial updates or in the many places langgraph-api json-SQL-merges across model types. This PR contains 2 SDK fixes: 1. remove model-type specific custom json encryption annotations - these cause surprising behavior as config and context data propagates across model types, specifically because today we can't guarantee that data encrypted as one model-type will be decrypted as the same model-type because kv pairs move across model-types in pure SQL 2. document limitations and validation around "key preservation" in custom json encryption functions. langgraph-api now validates that custom JSON encryption fns don't change keys. That validation prevents customizers from writing custom encryption functions that cause data loss through patch endpoints and x-model merge propagation. --------- Signed-off-by: Connor Braa <cwlbraa@langchain.dev>
LangGraph Python SDK
This repository contains the Python SDK for interacting with the LangSmith Deployment REST API.
Quick Start
To get started with the Python SDK, install the package
pip install -U 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.
from langgraph_sdk import get_client
# If you're using a remote server, initialize the client with `get_client(url=REMOTE_URL)`
client = get_client()
# List all assistants
assistants = await client.assistants.search()
# We auto-create an assistant for each graph you register in config.
agent = assistants[0]
# Start a new thread
thread = await client.threads.create()
# Start a streaming run
input = {"messages": [{"role": "human", "content": "what's the weather in la"}]}
async for chunk in client.runs.stream(thread['thread_id'], agent['assistant_id'], input=input):
print(chunk)