Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Add auth docs #2797

Merged
merged 33 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
245cf83
[Docs] Add auth tutorial
hinthornw Dec 17, 2024
3dd1e67
Add mermaid
hinthornw Dec 17, 2024
6d160a2
Merge branch 'main' into wfh/docs/auth
hinthornw Dec 17, 2024
23e18e8
Add how-tos
hinthornw Dec 17, 2024
12f2a48
Add concepts
hinthornw Dec 18, 2024
ba56ba1
Add langgraph reference
hinthornw Dec 18, 2024
7904fdc
Update explanations
hinthornw Dec 18, 2024
97b3d1b
Simplify tutorial
hinthornw Dec 18, 2024
1c97bdd
Fix cross linking
hinthornw Dec 18, 2024
b85c996
Split into 3
hinthornw Dec 18, 2024
30e647a
Add links
hinthornw Dec 18, 2024
2df2f41
Merge branch 'main' into wfh/docs/auth
hinthornw Dec 18, 2024
8fc3f20
Add pt 2 and 3
hinthornw Dec 18, 2024
b3230cf
More guidance
hinthornw Dec 18, 2024
83e4e6c
Update docs/docs/tutorials/auth/add_auth_server.md
hinthornw Dec 18, 2024
51c57cc
[SDK] Add studio user object
hinthornw Dec 18, 2024
e20bd15
lib: Fix incorrect default for Command.update
nfcampos Dec 18, 2024
7e8a68f
Fix
nfcampos Dec 18, 2024
ef88b80
0.2.60
nfcampos Dec 18, 2024
dabd75f
build(deps-dev): bump tornado from 6.4.1 to 6.4.2 (#2519)
dependabot[bot] Dec 18, 2024
532bc71
langgraph[patch]: format messages in state (#2199)
baskaryan Dec 18, 2024
6b45a28
fix example in docs of state_schema in create_react_agent (#2109)
jokerkeny Dec 18, 2024
d9cc227
Unpin install command in doc
hinthornw Dec 18, 2024
1e07a9a
Add admonition
hinthornw Dec 18, 2024
7f0bfdc
Feedback
hinthornw Dec 18, 2024
6954e63
Numbering
hinthornw Dec 18, 2024
948027a
Notebook style
hinthornw Dec 18, 2024
2e1971b
Remaining feedback
hinthornw Dec 18, 2024
f89fe49
Merge branch 'main' into wfh/docs/auth
hinthornw Dec 18, 2024
06e1e4e
Update cross-linking
hinthornw Dec 18, 2024
d4a1fe5
concept
hinthornw Dec 18, 2024
1709cd3
concept
hinthornw Dec 18, 2024
b7f57b1
Merge branch 'main' into wfh/docs/auth
hinthornw Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/_scripts/notebook_hooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

Check notice on line 1 in docs/_scripts/notebook_hooks.py

View workflow job for this annotation

GitHub Actions / benchmark

Benchmark results

......................................... fanout_to_subgraph_10x: Mean +- std dev: 61.5 ms +- 1.6 ms ......................................... fanout_to_subgraph_10x_sync: Mean +- std dev: 53.3 ms +- 1.5 ms ......................................... fanout_to_subgraph_10x_checkpoint: Mean +- std dev: 74.8 ms +- 1.6 ms ......................................... fanout_to_subgraph_10x_checkpoint_sync: Mean +- std dev: 96.9 ms +- 3.8 ms ......................................... fanout_to_subgraph_100x: Mean +- std dev: 640 ms +- 31 ms ......................................... fanout_to_subgraph_100x_sync: Mean +- std dev: 516 ms +- 11 ms ......................................... fanout_to_subgraph_100x_checkpoint: Mean +- std dev: 799 ms +- 21 ms ......................................... fanout_to_subgraph_100x_checkpoint_sync: Mean +- std dev: 965 ms +- 25 ms ......................................... react_agent_10x: Mean +- std dev: 31.1 ms +- 0.9 ms ......................................... react_agent_10x_sync: Mean +- std dev: 23.1 ms +- 0.7 ms ......................................... react_agent_10x_checkpoint: Mean +- std dev: 38.5 ms +- 0.9 ms ......................................... react_agent_10x_checkpoint_sync: Mean +- std dev: 37.2 ms +- 0.7 ms ......................................... react_agent_100x: Mean +- std dev: 344 ms +- 7 ms ......................................... react_agent_100x_sync: Mean +- std dev: 276 ms +- 4 ms ......................................... react_agent_100x_checkpoint: Mean +- std dev: 868 ms +- 12 ms ......................................... react_agent_100x_checkpoint_sync: Mean +- std dev: 858 ms +- 14 ms ......................................... wide_state_25x300: Mean +- std dev: 23.1 ms +- 0.5 ms ......................................... wide_state_25x300_sync: Mean +- std dev: 15.0 ms +- 0.3 ms ......................................... wide_state_25x300_checkpoint: Mean +- std dev: 280 ms +- 16 ms ......................................... wide_state_25x300_checkpoint_sync: Mean +- std dev: 278 ms +- 15 ms ......................................... wide_state_15x600: Mean +- std dev: 27.0 ms +- 0.6 ms ......................................... wide_state_15x600_sync: Mean +- std dev: 17.3 ms +- 0.3 ms ......................................... wide_state_15x600_checkpoint: Mean +- std dev: 477 ms +- 17 ms ......................................... wide_state_15x600_checkpoint_sync: Mean +- std dev: 479 ms +- 17 ms ......................................... wide_state_9x1200: Mean +- std dev: 27.0 ms +- 0.6 ms ......................................... wide_state_9x1200_sync: Mean +- std dev: 17.4 ms +- 0.3 ms ......................................... wide_state_9x1200_checkpoint: Mean +- std dev: 312 ms +- 15 ms ......................................... wide_state_9x1200_checkpoint_sync: Mean +- std dev: 311 ms +- 16 ms

Check notice on line 1 in docs/_scripts/notebook_hooks.py

View workflow job for this annotation

GitHub Actions / benchmark

Comparison against main

+-----------------------------------------+---------+-----------------------+ | Benchmark | main | changes | +=========================================+=========+=======================+ | wide_state_9x1200_sync | 17.5 ms | 17.4 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_25x300 | 22.9 ms | 23.1 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_100x_sync | 274 ms | 276 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_10x_checkpoint | 74.2 ms | 74.8 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_100x_sync | 511 ms | 516 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_10x | 60.8 ms | 61.5 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_10x_checkpoint | 38.0 ms | 38.5 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | wide_state_25x300_sync | 14.8 ms | 15.0 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_100x_checkpoint_sync | 847 ms | 858 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | wide_state_15x600 | 26.6 ms | 27.0 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_100x | 339 ms | 344 ms: 1.02x slower | +-----------------------------------------+---------+-----------------------+ | wide_state_25x300_checkpoint_sync | 274 ms | 278 ms: 1.02x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_10x_checkpoint_sync | 36.6 ms | 37.2 ms: 1.02x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_10x_sync | 22.7 ms | 23.1 ms: 1.02x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_10x | 30.6 ms | 31.1 ms: 1.02x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_100x_checkpoint | 849 ms | 868 ms: 1.02x slower | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_10x_sync | 52.1 ms | 53.3 ms: 1.02x slower | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_10x_checkpoint_sync | 94.5 ms | 96.9 ms: 1.03x slower | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_100x_checkpoint_sync | 937 ms | 965 ms: 1.03x slower | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_100x | 618 ms | 640 ms: 1.04x slower | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_100x_checkpoint | 747 ms | 799 ms: 1.07x slower | +-----------------------------------------+---------+-----------------------+ | Geometric mean | (ref) | 1.01x slower | +-----------------------------------------+---------+-----------------------+ Benchmark hidden because not significant (7): wide_state_9x1200_checkpoint, wide_state_9x1200, wide_state_15x600_sync, wide_state_9x1200_checkpoint_sync, wide_state_15x600_checkpoint_sync, wide_state_15x600_checkpoint, wide_state_25x300_checkpoint
import os
from typing import Any, Dict

from mkdocs.structure.pages import Page
Expand All @@ -8,6 +9,7 @@
logger = logging.getLogger(__name__)
logging.basicConfig()
logger.setLevel(logging.INFO)
DISABLED = os.getenv("DISABLE_NOTEBOOK_CONVERT") in ("1", "true", "True")


class NotebookFile(File):
Expand All @@ -16,6 +18,8 @@


def on_files(files: Files, **kwargs: Dict[str, Any]):
if DISABLED:
return files
new_files = Files([])
for file in files:
if file.src_path.endswith(".ipynb"):
Expand All @@ -32,6 +36,8 @@


def on_page_markdown(markdown: str, page: Page, **kwargs: Dict[str, Any]):
if DISABLED:
return markdown
if page.file.src_path.endswith(".ipynb"):
logger.info("Processing Jupyter notebook: %s", page.file.src_path)
body = convert_notebook(page.file.abs_src_path)
Expand Down
34 changes: 32 additions & 2 deletions docs/docs/cloud/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ The LangGraph command line interface includes commands to build and run a LangGr

[](){#langgraph.json}

## Configuration File
## Configuration File {#configuration-file}

The LangGraph CLI requires a JSON configuration file with the following keys:

| Key | Description |
| Key | Description |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `dependencies` | **Required**. Array of dependencies for LangGraph Cloud API server. Dependencies can be one of the following: (1) `"."`, which will look for local Python packages, (2) `pyproject.toml`, `setup.py` or `requirements.txt` in the app directory `"./local_package"`, or (3) a package name. |
| `graphs` | **Required**. Mapping from graph ID to path where the compiled graph or a function that makes a graph is defined. Example: <ul><li>`./your_package/your_file.py:variable`, where `variable` is an instance of `langgraph.graph.state.CompiledStateGraph`</li><li>`./your_package/your_file.py:make_graph`, where `make_graph` is a function that takes a config dictionary (`langchain_core.runnables.RunnableConfig`) and creates an instance of `langgraph.graph.state.StateGraph` / `langgraph.graph.state.CompiledStateGraph`.</li></ul> |
| `auth` | _(Added in v0.0.11)_ Auth configuration containing the path to your authentication handler. Example: `./your_package/auth.py:auth`, where `auth` is an instance of `langgraph_sdk.Auth`. See [authentication guide](../../concepts/auth.md) for details. |
| `env` | Path to `.env` file or a mapping from environment variable to its value. |
| `store` | Configuration for adding semantic search to the BaseStore. Contains the following fields: <ul><li>`index`: Configuration for semantic search indexing with fields:<ul><li>`embed`: Embedding provider (e.g., "openai:text-embedding-3-small") or path to custom embedding function</li><li>`dims`: Dimension size of the embedding model. Used to initialize the vector table.</li><li>`fields` (optional): List of fields to index. Defaults to `["$"]`, meaningto index entire documents. Can be specific fields like `["text", "summary", "some.value"]`</li></ul></li></ul> |
| `python_version` | `3.11` or `3.12`. Defaults to `3.11`. |
Expand Down Expand Up @@ -120,6 +121,35 @@ def embed_texts(texts: list[str]) -> list[list[float]]:
return [[0.1, 0.2, ...] for _ in texts] # dims-dimensional vectors
```

#### Adding custom authentication

```json
{
"dependencies": ["."],
"graphs": {
"chat": "./chat/graph.py:graph"
},
"auth": {
"path": "./auth.py:auth",
"openapi": {
"securitySchemes": {
"apiKeyAuth": {
"type": "apiKey",
"in": "header",
"name": "X-API-Key"
}
},
"security": [
{"apiKeyAuth": []}
]
},
"disable_studio_auth": false
}
}
```

See the [authentication conceptual guide](../../concepts/auth.md) for details, and the [setting up custom authentication](../../tutorials/auth/getting_started.md) guide for a practical walk through of the process.

## Commands

The base command for the LangGraph CLI is `langgraph`.
Expand Down
15 changes: 1 addition & 14 deletions docs/docs/cloud/reference/sdk/python_sdk_ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,10 @@
::: langgraph_sdk.schema
handler: python


::: langgraph_sdk.auth
handler: python

::: langgraph_sdk.auth.types.Authenticator
handler: python

::: langgraph_sdk.auth.types.Handler
handler: python

::: langgraph_sdk.auth.types.HandlerResult
handler: python

::: langgraph_sdk.auth.types.FilterType
handler: python

::: langgraph_sdk.auth.types.AuthContext
::: langgraph_sdk.auth.types
handler: python

::: langgraph_sdk.auth.exceptions
Expand Down
Loading
Loading