mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-10-04 15:35:07 +02:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91bca2ea1d |
@@ -50,7 +50,6 @@ The LangGraph CLI requires a JSON configuration file that follows this [schema](
|
||||
| <span style="white-space: nowrap;">`python_version`</span> | `3.11`, `3.12`, or `3.13`. Defaults to `3.11`. |
|
||||
| <span style="white-space: nowrap;">`node_version`</span> | Specify `node_version: 20` to use LangGraph.js. |
|
||||
| <span style="white-space: nowrap;">`pip_config_file`</span> | Path to `pip` config file. |
|
||||
| <span style="white-space: nowrap;">`pip_installer`</span> | _(Added in v0.3)_ Optional. Python package installer selector. It can be set to `"auto"`, `"pip"`, or `"uv"`. From version 0.3 onward the default strategy is to run `uv pip`, which typically delivers faster builds while remaining a drop-in replacement. In the uncommon situation where `uv` cannot handle your dependency graph or the structure of your `pyproject.toml`, specify `"pip"` here to revert to the earlier behaviour. |
|
||||
| <span style="white-space: nowrap;">`dockerfile_lines`</span> | Array of additional lines to add to Dockerfile following the import from parent image. |
|
||||
| <span style="white-space: nowrap;">`checkpointer`</span> | Configuration for the checkpointer. Contains a `ttl` field which is an object with the following keys: <ul><li>`strategy`: How to handle expired checkpoints (e.g., `"delete"`).</li><li>`sweep_interval_minutes`: How often to check for expired checkpoints (integer).</li><li>`default_ttl`: Default time-to-live for checkpoints in **minutes** (integer). Defines how long checkpoints are kept before the specified strategy is applied.</li></ul> |
|
||||
| <span style="white-space: nowrap;">`http`</span> | HTTP server configuration with the following fields: <ul><li>`app`: Path to custom Starlette/FastAPI app (e.g., `"./src/agent/webapp.py:app"`). See [custom routes guide](../../how-tos/http/custom_routes.md).</li><li>`disable_assistants`: Disable `/assistants` routes</li><li>`disable_threads`: Disable `/threads` routes</li><li>`disable_runs`: Disable `/runs` routes</li><li>`disable_store`: Disable `/store` routes</li><li>`disable_meta`: Disable `/ok`, `/info`, `/metrics`, and `/docs` routes</li><li>`cors`: CORS configuration with fields for `allow_origins`, `allow_methods`, `allow_headers`, etc.</li><li>`configurable_headers`: Define which request headers to exclude or include as a run's configurable values.</li></ul> |
|
||||
@@ -129,7 +128,7 @@ The LangGraph CLI requires a JSON configuration file that follows this [schema](
|
||||
- `cohere:embed-english-v3.0`: 1024
|
||||
- `cohere:embed-english-light-v3.0`: 384
|
||||
- `cohere:embed-multilingual-v3.0`: 1024
|
||||
- `cohere:embed-multilingual-light-v3.0`: 384
|
||||
- `cohere:embed-multilingual-light-v3.0`: 384
|
||||
|
||||
#### Semantic search with a custom embedding function
|
||||
|
||||
@@ -362,8 +361,8 @@ The LangGraph CLI requires a JSON configuration file that follows this [schema](
|
||||
|
||||
**Options**
|
||||
|
||||
| Option | Default | Description |
|
||||
| -------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------- |
|
||||
| Option | Default | Description |
|
||||
| -------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `--platform TEXT` | | Target platform(s) to build the Docker image for. Example: `langgraph build --platform linux/amd64,linux/arm64` |
|
||||
| `-t, --tag TEXT` | | **Required**. Tag for the Docker image. Example: `langgraph build -t my-image` |
|
||||
| `--pull / --no-pull` | `--pull` | Build with latest remote Docker image. Use `--no-pull` for running the LangGraph Platform API server with locally built images. |
|
||||
@@ -382,8 +381,8 @@ The LangGraph CLI requires a JSON configuration file that follows this [schema](
|
||||
|
||||
**Options**
|
||||
|
||||
| Option | Default | Description |
|
||||
| -------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------- |
|
||||
| Option | Default | Description |
|
||||
| -------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `--platform TEXT` | | Target platform(s) to build the Docker image for. Example: `langgraph build --platform linux/amd64,linux/arm64` |
|
||||
| `-t, --tag TEXT` | | **Required**. Tag for the Docker image. Example: `langgraph build -t my-image` |
|
||||
| `--no-pull` | | Use locally built images. Defaults to `false` to build with latest remote Docker image. |
|
||||
|
||||
@@ -124,18 +124,6 @@ Set `REDIS_CLUSTER` to `True` to enable Redis Cluster mode. When enabled, the sy
|
||||
|
||||
Defaults to `False`.
|
||||
|
||||
|
||||
## `MAX_STREAM_CHUNK_SIZE_BYTES`
|
||||
|
||||
!!! info "Available in API Server version 0.2.44+"
|
||||
This environment variable is supported in API Server version 0.2.44 and above.
|
||||
|
||||
Configure the maximum size of a chunk of data that can be added to Redis for streaming events to the client. This is meant to prevent run failure from data that is above the size supported by your redis instance. Default is 128MB (1024 * 1024 * 128).
|
||||
|
||||
Set `MAX_STREAM_CHUNK_SIZE_BYTES` to specify the maximum size of a chunk of data that can be sent in a stream. This is useful when connecting to a Redis Cluster deployment.
|
||||
|
||||
Defaults to `1024 * 1024`.
|
||||
|
||||
## `MOUNT_PREFIX`
|
||||
|
||||
!!! info "Only Allowed in Self-Hosted Deployments"
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
# Data Storage and Privacy
|
||||
|
||||
This document provides a comprehensive overview of what data is stored, collected, and processed when using LangGraph, particularly with the CLI tools like `langgraph dev`.
|
||||
|
||||
## What Data is Stored
|
||||
|
||||
### CLI Telemetry (Opt-out)
|
||||
|
||||
By default, the LangGraph CLI collects minimal analytics data to help improve the tool:
|
||||
|
||||
**Data Collected:**
|
||||
- CLI command used (e.g., `dev`, `up`, `build`)
|
||||
- CLI version
|
||||
- Operating system type and version
|
||||
- Python version
|
||||
- Anonymized parameter usage (boolean flags indicating non-default options were used)
|
||||
|
||||
**Data NOT Collected:**
|
||||
- Actual parameter values
|
||||
- File contents or paths
|
||||
- Personal information
|
||||
- Code or graph implementations
|
||||
- API keys or sensitive data
|
||||
|
||||
**How to Opt Out:**
|
||||
Set the environment variable `LANGGRAPH_CLI_NO_ANALYTICS=1` to disable all CLI analytics collection.
|
||||
|
||||
### LangSmith Integration (Opt-in)
|
||||
|
||||
When a `LANGSMITH_API_KEY` is provided (not required):
|
||||
- Metadata on number of runs executed
|
||||
- Current API version being run
|
||||
- Trace data (if tracing is enabled)
|
||||
|
||||
This data is only sent when explicitly configured with LangSmith credentials.
|
||||
|
||||
### Tracing Data (Opt-in)
|
||||
|
||||
When tracing is enabled:
|
||||
- Execution traces are logged to the configured tracing backend
|
||||
- This requires explicit configuration and is not enabled by default
|
||||
|
||||
## What Data is NOT Stored Remotely
|
||||
|
||||
- **Checkpoints**: Stored locally in your development environment
|
||||
- **Memory store data**: Persisted locally, not transmitted
|
||||
- **Graph state**: Remains in your local environment
|
||||
- **Application data**: Your actual application logic and data stay local
|
||||
|
||||
## Local Data Storage
|
||||
|
||||
### Development Mode (`langgraph dev`)
|
||||
|
||||
When using `langgraph dev`:
|
||||
- State is persisted to a local directory
|
||||
- Checkpoints are stored locally for debugging and development
|
||||
- No remote storage or transmission of your application data
|
||||
|
||||
### Checkpoints and State Persistence
|
||||
|
||||
LangGraph automatically persists:
|
||||
- **Checkpoints**: Snapshots of graph state at each execution step
|
||||
- **Thread data**: Conversation/execution history organized by thread IDs
|
||||
- **Graph state**: Node outputs, intermediate results, and execution metadata
|
||||
- **Memory/Store data**: Information that persists across multiple threads
|
||||
|
||||
**Storage Locations:**
|
||||
- **Local development**: Local directory (configurable)
|
||||
- **Docker deployment**: Local Docker volumes
|
||||
- **LangGraph Platform**: Managed database infrastructure
|
||||
|
||||
## Security and Encryption
|
||||
|
||||
### Data Encryption
|
||||
|
||||
- Checkpointers can optionally encrypt all persisted state
|
||||
- Encryption uses AES encryption via `EncryptedSerializer`
|
||||
- When `LANGGRAPH_AES_KEY` environment variable is present, encryption is automatically enabled on LangGraph Platform
|
||||
|
||||
### Data Retention
|
||||
|
||||
- **TTL (Time-to-Live)**: Configurable automatic cleanup of old data
|
||||
- **Default TTL**: Can be set in minutes for automatic expiration
|
||||
- **Automatic sweeping**: Expired data is automatically removed at configurable intervals
|
||||
|
||||
## Privacy Controls
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Key environment variables for controlling data collection and storage:
|
||||
|
||||
- `LANGGRAPH_CLI_NO_ANALYTICS=1`: Disable CLI analytics collection
|
||||
- `LANGGRAPH_AES_KEY`: Enable automatic encryption of stored data
|
||||
- `LANGSMITH_TRACING=false`: Disable tracing to LangSmith (self-hosted deployments)
|
||||
- `LANGSMITH_API_KEY`: Enable LangSmith integration (opt-in)
|
||||
|
||||
### Logging Controls
|
||||
|
||||
- `LOG_LEVEL`: Control verbosity of logs
|
||||
- `LOG_JSON`: Format logs as JSON
|
||||
- Various other logging configuration options
|
||||
|
||||
## Security Policy
|
||||
|
||||
For security vulnerabilities:
|
||||
- Report through the huntr.com bounty program
|
||||
- LangGraph is in-scope for security bounties
|
||||
- Security contact: `security@langchain.dev`
|
||||
|
||||
## Best Practices for Privacy
|
||||
|
||||
1. **Review Analytics**: Set `LANGGRAPH_CLI_NO_ANALYTICS=1` if you prefer not to share usage analytics
|
||||
2. **Enable Encryption**: Use `LANGGRAPH_AES_KEY` for sensitive data
|
||||
3. **Configure TTL**: Set appropriate data retention policies
|
||||
4. **Monitor Tracing**: Only enable tracing when needed and review what data is being sent
|
||||
5. **Environment Variables**: Audit your environment variables to ensure proper privacy controls
|
||||
|
||||
## Summary
|
||||
|
||||
LangGraph is designed with privacy in mind:
|
||||
- Minimal data collection (analytics can be disabled)
|
||||
- Local storage by default for development
|
||||
- Optional encryption for sensitive data
|
||||
- Clear opt-in requirements for external services
|
||||
- Comprehensive privacy controls through environment variables
|
||||
|
||||
Your application data, checkpoints, and state remain under your control and are not transmitted unless you explicitly configure external services like LangSmith.
|
||||
@@ -63,8 +63,4 @@ Yes! LangGraph is totally ambivalent to what LLMs are used under the hood. The m
|
||||
|
||||
Yes! You can use the [development version of LangGraph Server](../tutorials/langgraph-platform/local-server.md) to run the backend locally.
|
||||
This will connect to the studio frontend hosted as part of LangSmith.
|
||||
If you set an environment variable of `LANGSMITH_TRACING=false`, then no traces will be sent to LangSmith.
|
||||
|
||||
## What does "nodes executed" mean for LangGraph Platform usage?
|
||||
|
||||
**Nodes Executed** is the aggregate number of nodes in a LangGraph application that are called and completed successfully during an invocation of the application. If a node in the graph is not called during execution or ends in an error state, these nodes will not be counted. If a node is called and completes successfully multiple times, each occurrence will be counted.
|
||||
If you set an environment variable of `LANGSMITH_TRACING=false` then no traces will be sent to LangSmith.
|
||||
@@ -17,7 +17,7 @@ Use LangGraph Server to create and manage [assistants](assistants.md), [threads]
|
||||
|
||||
There are two versions of LangGraph Server:
|
||||
|
||||
- `Lite` is a limited version of the LangGraph Server that you can run locally or in a self-hosted manner (up to 1 million [nodes executed](../concepts/faq.md#what-does-nodes-executed-mean-for-langgraph-platform-usage) per year).
|
||||
- `Lite` is a limited version of the LangGraph Server that you can run locally or in a self-hosted manner (up to 1 million nodes executed per year).
|
||||
- `Enterprise` is the full version of the LangGraph Server. To use the `Enterprise` version, you must acquire a license key that you will need to specify when running the Docker image. To acquire a license key, please email sales@langchain.dev.
|
||||
|
||||
Feature Differences:
|
||||
|
||||
@@ -20,7 +20,7 @@ There are three different plans for using it.
|
||||
| | Developer | Plus | Enterprise |
|
||||
|------------------------------------------------------------------|---------------------------------------------|-------------------------------------------------------|-----------------------------------------------------|
|
||||
| Deployment Options | Standalone Container (Lite) | Cloud SaaS | <ul><li>Cloud SaaS</li><li>Self-Hosted Data Plane</li><li>Self-Hosted Control Plane</li><li>Standalone Container (Enterprise)</li></ul> |
|
||||
| Usage | Free, limited to 1M [nodes executed](../concepts/faq.md#what-does-nodes-executed-mean-for-langgraph-platform-usage) per year | See [Pricing](https://www.langchain.com/langgraph-platform-pricing) | Custom |
|
||||
| Usage | Free, limited to 1M nodes executed per year | Free while in Beta, will be charged per node executed | Custom |
|
||||
| APIs for retrieving and updating state and conversational history | ✅ | ✅ | ✅ |
|
||||
| APIs for retrieving and updating long-term memory | ✅ | ✅ | ✅ |
|
||||
| Horizontally scalable task queues and servers | ✅ | ✅ | ✅ |
|
||||
|
||||
@@ -184,6 +184,7 @@ nav:
|
||||
- cloud/how-tos/datasets_studio.md
|
||||
- LangGraph SDK: concepts/sdk.md
|
||||
- Data management:
|
||||
- Data storage & privacy: concepts/data_storage_and_privacy.md
|
||||
- Add semantic search: cloud/deployment/semantic_search.md
|
||||
- Add TTLs: how-tos/ttl/configure_ttl.md
|
||||
- Authentication & access control:
|
||||
|
||||
@@ -275,7 +275,7 @@ def apply_writes(
|
||||
)
|
||||
|
||||
# clear pending sends
|
||||
if checkpoint.get("pending_sends") and bump_step:
|
||||
if checkpoint["pending_sends"] and bump_step:
|
||||
checkpoint["pending_sends"].clear()
|
||||
|
||||
# Group writes by channel
|
||||
@@ -286,7 +286,7 @@ def apply_writes(
|
||||
if chan in (NO_WRITES, PUSH, RESUME, INTERRUPT, RETURN, ERROR):
|
||||
pass
|
||||
elif chan == TASKS:
|
||||
checkpoint.setdefault("pending_sends", []).append(val)
|
||||
checkpoint["pending_sends"].append(val)
|
||||
elif chan in channels:
|
||||
pending_writes_by_channel[chan].append(val)
|
||||
else:
|
||||
@@ -327,7 +327,7 @@ def apply_writes(
|
||||
# If this is (tentatively) the last superstep, notify all channels of finish
|
||||
if (
|
||||
bump_step
|
||||
and not checkpoint.get("pending_sends")
|
||||
and not checkpoint["pending_sends"]
|
||||
and updated_channels.isdisjoint(trigger_to_nodes)
|
||||
):
|
||||
for chan in channels:
|
||||
@@ -344,6 +344,17 @@ def apply_writes(
|
||||
return pending_writes_by_managed, updated_channels
|
||||
|
||||
|
||||
def has_next_tasks(
|
||||
trigger_to_nodes: Mapping[str, Sequence[str]],
|
||||
updated_channels: set[str],
|
||||
checkpoint: Checkpoint,
|
||||
) -> bool:
|
||||
"""Check if there are any tasks that should be run in the next step."""
|
||||
return bool(checkpoint["pending_sends"]) or not updated_channels.isdisjoint(
|
||||
trigger_to_nodes
|
||||
)
|
||||
|
||||
|
||||
@overload
|
||||
def prepare_next_tasks(
|
||||
checkpoint: Checkpoint,
|
||||
@@ -435,7 +446,7 @@ def prepare_next_tasks(
|
||||
null_version = checkpoint_null_version(checkpoint)
|
||||
tasks: list[Union[PregelTask, PregelExecutableTask]] = []
|
||||
# Consume pending_sends from previous step
|
||||
for idx, _ in enumerate(checkpoint.get("pending_sends", ())):
|
||||
for idx, _ in enumerate(checkpoint["pending_sends"]):
|
||||
if task := prepare_single_task(
|
||||
(PUSH, idx),
|
||||
None,
|
||||
@@ -637,7 +648,7 @@ def prepare_single_task(
|
||||
# SEND tasks, executed in superstep n+1
|
||||
# (PUSH, idx of pending send)
|
||||
idx = cast(int, task_path[1])
|
||||
if idx >= len(checkpoint.get("pending_sends", ())):
|
||||
if idx >= len(checkpoint["pending_sends"]):
|
||||
return
|
||||
packet = checkpoint["pending_sends"][idx]
|
||||
if not isinstance(packet, Send):
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "langgraph"
|
||||
version = "0.4.10"
|
||||
version = "0.4.8"
|
||||
description = "Building stateful, multi-actor applications with LLMs"
|
||||
authors = []
|
||||
requires-python = ">=3.9"
|
||||
|
||||
Generated
+2
-2
@@ -1197,7 +1197,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "langgraph"
|
||||
version = "0.4.10"
|
||||
version = "0.4.8"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "langchain-core" },
|
||||
@@ -1416,7 +1416,7 @@ inmem = [
|
||||
|
||||
[[package]]
|
||||
name = "langgraph-prebuilt"
|
||||
version = "0.2.3"
|
||||
version = "0.2.2"
|
||||
source = { editable = "../prebuilt" }
|
||||
dependencies = [
|
||||
{ name = "langchain-core" },
|
||||
|
||||
@@ -140,9 +140,7 @@ def _get_prompt_runnable(prompt: Optional[Prompt]) -> Runnable:
|
||||
return prompt_runnable
|
||||
|
||||
|
||||
def _should_bind_tools(
|
||||
model: LanguageModelLike, tools: Sequence[BaseTool], num_builtin: int = 0
|
||||
) -> bool:
|
||||
def _should_bind_tools(model: LanguageModelLike, tools: Sequence[BaseTool]) -> bool:
|
||||
if isinstance(model, RunnableSequence):
|
||||
model = next(
|
||||
(
|
||||
@@ -160,10 +158,9 @@ def _should_bind_tools(
|
||||
return True
|
||||
|
||||
bound_tools = model.kwargs["tools"]
|
||||
if len(tools) != len(bound_tools) - num_builtin:
|
||||
if len(tools) != len(bound_tools):
|
||||
raise ValueError(
|
||||
"Number of tools in the model.bind_tools() and tools passed to create_react_agent must match"
|
||||
f" Got {len(tools)} tools, expected {len(bound_tools) - num_builtin}"
|
||||
)
|
||||
|
||||
tool_names = set(tool.name for tool in tools)
|
||||
@@ -447,8 +444,9 @@ def create_react_agent(
|
||||
tool_calling_enabled = len(tool_classes) > 0
|
||||
|
||||
if (
|
||||
_should_bind_tools(model, tool_classes, num_builtin=len(llm_builtin_tools))
|
||||
_should_bind_tools(model, tool_classes)
|
||||
and len(tool_classes) > 0
|
||||
or (len(llm_builtin_tools) > 0)
|
||||
):
|
||||
model = cast(BaseChatModel, model).bind_tools(tool_classes + llm_builtin_tools) # type: ignore[operator]
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "langgraph-prebuilt"
|
||||
version = "0.2.3"
|
||||
version = "0.2.2"
|
||||
description = "Library with high-level APIs for creating and executing LangGraph agents and tools."
|
||||
authors = []
|
||||
requires-python = ">=3.9"
|
||||
|
||||
@@ -73,12 +73,9 @@ class FakeToolCallingModel(BaseChatModel):
|
||||
|
||||
tool_dicts = []
|
||||
for tool in tools:
|
||||
if isinstance(tool, dict):
|
||||
tool_dicts.append(tool)
|
||||
continue
|
||||
if not isinstance(tool, BaseTool):
|
||||
raise TypeError(
|
||||
"Only BaseTool and dict is supported by FakeToolCallingModel.bind_tools"
|
||||
"Only BaseTool is supported by FakeToolCallingModel.bind_tools"
|
||||
)
|
||||
|
||||
# NOTE: this is a simplified tool spec for testing purposes only
|
||||
|
||||
@@ -275,8 +275,7 @@ async def test_prompt_with_store_async():
|
||||
|
||||
@pytest.mark.parametrize("tool_style", ["openai", "anthropic"])
|
||||
@pytest.mark.parametrize("version", REACT_TOOL_CALL_VERSIONS)
|
||||
@pytest.mark.parametrize("include_builtin", [True, False])
|
||||
def test_model_with_tools(tool_style: str, version: str, include_builtin: bool):
|
||||
def test_model_with_tools(tool_style: str, version: str):
|
||||
model = FakeToolCallingModel(tool_style=tool_style)
|
||||
|
||||
@dec_tool
|
||||
@@ -289,27 +288,10 @@ def test_model_with_tools(tool_style: str, version: str, include_builtin: bool):
|
||||
"""Tool 2 docstring."""
|
||||
return f"Tool 2: {some_val}"
|
||||
|
||||
tools = [tool1, tool2]
|
||||
if include_builtin:
|
||||
tools.append(
|
||||
{
|
||||
"type": "mcp",
|
||||
"server_label": "atest_sever",
|
||||
"server_url": "https://some.mcp.somewhere.com/sse",
|
||||
"headers": {"foo": "bar"},
|
||||
"allowed_tools": [
|
||||
"mcp_tool_1",
|
||||
"set_active_account",
|
||||
"get_url_markdown",
|
||||
"get_url_screenshot",
|
||||
],
|
||||
"require_approval": "never",
|
||||
}
|
||||
)
|
||||
# check valid agent constructor
|
||||
agent = create_react_agent(
|
||||
model.bind_tools(tools),
|
||||
tools,
|
||||
model.bind_tools([tool1, tool2]),
|
||||
[tool1, tool2],
|
||||
version=version,
|
||||
)
|
||||
result = agent.nodes["tools"].invoke(
|
||||
|
||||
Generated
+743
-743
File diff suppressed because it is too large
Load Diff
Generated
+838
-838
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user