Skip to content

Commit 3e46009

Browse files
authored
Add LS sdk to link_py.py for auth link fix (#1333)
Update the Auth overview page in LangSmith for SDK link references to use the link_map.py link cross referencing.
1 parent 6f99eda commit 3e46009

File tree

2 files changed

+100
-29
lines changed

2 files changed

+100
-29
lines changed

pipeline/preprocessors/link_map.py

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,82 @@ class LinkMap(TypedDict):
237237
"Runtime": "langgraph/runtime/#langgraph.runtime.Runtime",
238238
"Send": "langgraph/types/#langgraph.types.Send",
239239
"Topic": "langgraph/channels/#langgraph.channels.Topic",
240-
# SDK
240+
# LangSmith Deployment SDK
241+
# Main client
242+
"get_client": "langsmith/deployment/sdk/#langgraph_sdk.get_client",
243+
"get_sync_client": "langsmith/deployment/sdk/#langgraph_sdk.get_sync_client",
244+
"LangGraphClient": "langsmith/deployment/sdk/#langgraph_sdk.client.LangGraphClient",
245+
# HTTP clients
246+
"HttpClient": "langsmith/deployment/sdk/#langgraph_sdk.client.HttpClient",
247+
"SyncHttpClient": "langsmith/deployment/sdk/#langgraph_sdk.client.SyncHttpClient",
248+
# Resource clients - Async
249+
"AssistantsClient": "langsmith/deployment/sdk/#langgraph_sdk.client.AssistantsClient",
250+
"ThreadsClient": "langsmith/deployment/sdk/#langgraph_sdk.client.ThreadsClient",
251+
"RunsClient": "langsmith/deployment/sdk/#langgraph_sdk.client.RunsClient",
252+
"CronClient": "langsmith/deployment/sdk/#langgraph_sdk.client.CronClient",
253+
"StoreClient": "langsmith/deployment/sdk/#langgraph_sdk.client.StoreClient",
254+
# Resource clients - Sync
255+
"SyncAssistantsClient": "langsmith/deployment/sdk/#langgraph_sdk.client.SyncAssistantsClient",
256+
"SyncThreadsClient": "langsmith/deployment/sdk/#langgraph_sdk.client.SyncThreadsClient",
257+
"SyncRunsClient": "langsmith/deployment/sdk/#langgraph_sdk.client.SyncRunsClient",
258+
"SyncCronClient": "langsmith/deployment/sdk/#langgraph_sdk.client.SyncCronClient",
259+
"SyncStoreClient": "langsmith/deployment/sdk/#langgraph_sdk.client.SyncStoreClient",
260+
# Client methods
241261
"client.runs.stream": "langsmith/deployment/sdk/#langgraph_sdk.client.RunsClient.stream",
242262
"client.runs.wait": "langsmith/deployment/sdk/#langgraph_sdk.client.RunsClient.wait",
243263
"client.threads.get_history": "langsmith/deployment/sdk/#langgraph_sdk.client.ThreadsClient.get_history",
244264
"client.threads.update_state": "langsmith/deployment/sdk/#langgraph_sdk.client.ThreadsClient.update_state",
265+
# Schema types - Enumerations
266+
"RunStatus": "langsmith/deployment/sdk/#langgraph_sdk.schema.RunStatus",
267+
"ThreadStatus": "langsmith/deployment/sdk/#langgraph_sdk.schema.ThreadStatus",
268+
"StreamMode": "langsmith/deployment/sdk/#langgraph_sdk.schema.StreamMode",
269+
"DisconnectMode": "langsmith/deployment/sdk/#langgraph_sdk.schema.DisconnectMode",
270+
"MultitaskStrategy": "langsmith/deployment/sdk/#langgraph_sdk.schema.MultitaskStrategy",
271+
"OnConflictBehavior": "langsmith/deployment/sdk/#langgraph_sdk.schema.OnConflictBehavior",
272+
# Schema types - Data models
273+
"Assistant": "langsmith/deployment/sdk/#langgraph_sdk.schema.Assistant",
274+
"AssistantVersion": "langsmith/deployment/sdk/#langgraph_sdk.schema.AssistantVersion",
275+
"Thread": "langsmith/deployment/sdk/#langgraph_sdk.schema.Thread",
276+
"Run": "langsmith/deployment/sdk/#langgraph_sdk.schema.Run",
277+
"Cron": "langsmith/deployment/sdk/#langgraph_sdk.schema.Cron",
278+
"Config": "langsmith/deployment/sdk/#langgraph_sdk.schema.Config",
279+
"Checkpoint": "langsmith/deployment/sdk/#langgraph_sdk.schema.Checkpoint",
280+
"GraphSchema": "langsmith/deployment/sdk/#langgraph_sdk.schema.GraphSchema",
281+
"Item": "langsmith/deployment/sdk/#langgraph_sdk.schema.Item",
282+
"SearchItem": "langsmith/deployment/sdk/#langgraph_sdk.schema.SearchItem",
283+
"ThreadState": "langsmith/deployment/sdk/#langgraph_sdk.schema.ThreadState",
284+
# Auth types
285+
"Auth": "langsmith/deployment/sdk/#langgraph_sdk.auth.Auth",
286+
"Auth.authenticate": "langsmith/deployment/sdk/#langgraph_sdk.auth.Auth.authenticate",
287+
"Auth.on": "langsmith/deployment/sdk/#langgraph_sdk.auth.Auth.on",
288+
"AuthContext": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.AuthContext",
289+
"BaseUser": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.BaseUser",
290+
"StudioUser": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.StudioUser",
291+
"MinimalUserDict": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.MinimalUserDict",
292+
"HTTPException": "langsmith/deployment/sdk/#langgraph_sdk.auth.exceptions.HTTPException",
293+
# Auth types - Threads
294+
"ThreadsCreate": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.ThreadsCreate",
295+
"ThreadsRead": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.ThreadsRead",
296+
"ThreadsUpdate": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.ThreadsUpdate",
297+
"ThreadsDelete": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.ThreadsDelete",
298+
"ThreadsSearch": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.ThreadsSearch",
299+
# Auth types - Assistants
300+
"AssistantsCreate": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.AssistantsCreate",
301+
"AssistantsRead": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.AssistantsRead",
302+
"AssistantsUpdate": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.AssistantsUpdate",
303+
"AssistantsDelete": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.AssistantsDelete",
304+
"AssistantsSearch": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.AssistantsSearch",
305+
# Auth types - Runs
306+
"RunsCreate": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.RunsCreate",
307+
# Auth types - Crons
308+
"CronsCreate": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.CronsCreate",
309+
"CronsRead": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.CronsRead",
310+
"CronsUpdate": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.CronsUpdate",
311+
"CronsDelete": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.CronsDelete",
312+
"CronsSearch": "langsmith/deployment/sdk/#langgraph_sdk.auth.types.CronsSearch",
313+
# Schema create types
314+
"RunCreate": "langsmith/deployment/sdk/#langgraph_sdk.schema.RunCreate",
315+
"RunCreateMetadata": "langsmith/deployment/sdk/#langgraph_sdk.schema.RunCreateMetadata",
245316
# Functional API
246317
"@task": "langgraph/func/#langgraph.func.task",
247318
"@entrypoint": "langgraph/func/#langgraph.func.entrypoint",

src/langsmith/auth.mdx

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ While often used interchangeably, these terms represent distinct security concep
1414
* [**Authentication**](#authentication) ("AuthN") verifies _who_ you are. This runs as middleware for every request.
1515
* [**Authorization**](#authorization) ("AuthZ") determines _what you can do_. This validates the user's privileges and roles on a per-resource basis.
1616

17-
In LangSmith, authentication is handled by your [`@auth.authenticate`](/langsmith/smith-python-sdk#langgraph_sdk.auth.Auth.authenticate) handler, and authorization is handled by your [`@auth.on`](/langsmith/langgraph-python-sdk#langgraph_sdk.auth.Auth.on) handlers.
17+
In LangSmith, authentication is handled by your @[`@auth.authenticate`][Auth.authenticate] handler, and authorization is handled by your @[`@auth.on`][Auth.on] handlers.
1818

1919
## Default security models
2020

@@ -76,15 +76,15 @@ sequenceDiagram
7676
LG-->>Client: 8. Return resources
7777
```
7878

79-
Your [`@auth.authenticate`](/langsmith/langgraph-python-sdk#langgraph_sdk.auth.Auth.authenticate) handler in LangGraph handles steps 4-6, while your [`@auth.on`](/langsmith/langgraph-python-sdk#langgraph_sdk.auth.Auth.on) handlers implement step 7.
79+
Your @[`@auth.authenticate`][Auth.authenticate] handler in LangGraph handles steps 4-6, while your @[`@auth.on`][Auth.on] handlers implement step 7.
8080

8181
## Authentication
8282

83-
Authentication in LangGraph runs as middleware on every request. Your [`@auth.authenticate`](/langsmith/langgraph-python-sdk#langgraph_sdk.auth.Auth.authenticate) handler receives request information and should:
83+
Authentication in LangGraph runs as middleware on every request. Your @[`@auth.authenticate`][Auth.authenticate] handler receives request information and should:
8484

8585
1. Validate the credentials
86-
2. Return [user info](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.MinimalUserDict) containing the user's identity and user information if valid
87-
3. Raise an [HTTP exception](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.exceptions.HTTPException) or AssertionError if invalid
86+
2. Return @[user info][MinimalUserDict] containing the user's identity and user information if valid
87+
3. Raise an @[HTTP exception][HTTPException] or AssertionError if invalid
8888

8989
```python
9090
from langgraph_sdk import Auth
@@ -116,11 +116,11 @@ async def authenticate(headers: dict) -> Auth.types.MinimalUserDict:
116116

117117
The returned user information is available:
118118

119-
* To your authorization handlers via [`ctx.user`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.AuthContext)
119+
* To your authorization handlers via @[`ctx.user`][AuthContext]
120120
* In your application via `config["configuration"]["langgraph_auth_user"]`
121121

122122
<Accordion title="Supported Parameters">
123-
The [`@auth.authenticate`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.Auth.authenticate) handler can accept any of the following parameters by name:
123+
The @[`@auth.authenticate`][Auth.authenticate] handler can accept any of the following parameters by name:
124124

125125
* request (Request): The raw ASGI request object
126126
* path (str): The request path, e.g., `"/threads/abcd-1234-abcd-1234/runs/abcd-1234-abcd-1234/stream"`
@@ -172,7 +172,7 @@ sequenceDiagram
172172
```
173173

174174
After authentication, the platform creates a special configuration object that is passed to your graph and all nodes via the configurable context.
175-
This object contains information about the current user, including any custom fields you return from your [`@auth.authenticate`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.Auth.authenticate) handler.
175+
This object contains information about the current user, including any custom fields you return from your @[`@auth.authenticate`][Auth.authenticate] handler.
176176

177177
To enable an agent to act on behalf of the user, use [custom authentication middleware](/langsmith/custom-auth). This will allow the agent to interact with external systems like MCP servers, external databases, and even other agents on behalf of the user.
178178

@@ -184,13 +184,13 @@ For information on how to authenticate an agent to an MCP server, see the [MCP c
184184

185185
## Authorization
186186

187-
After authentication, LangGraph calls your [`@auth.on`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.Auth.on) handlers to control access to specific resources (e.g., threads, assistants, crons). These handlers can:
187+
After authentication, LangGraph calls your @[`@auth.on`][Auth] handlers to control access to specific resources (e.g., threads, assistants, crons). These handlers can:
188188

189189
1. Add metadata to be saved during resource creation by mutating the `value["metadata"]` dictionary directly. See the [supported actions table](#supported-actions) for the list of types the value can take for each action.
190190
2. Filter resources by metadata during search/list or read operations by returning a [filter dictionary](#filter-operations).
191191
3. Raise an HTTP exception if access is denied.
192192

193-
If you want to just implement simple user-scoped access control, you can use a single [`@auth.on`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.Auth.on) handler for all resources and actions. If you want to have different control depending on the resource and action, you can use [resource-specific handlers](#resource-specific-handlers). See the [Supported Resources](#supported-resources) section for a full list of the resources that support access control.
193+
If you want to just implement simple user-scoped access control, you can use a single @[`@auth.on`][Auth] handler for all resources and actions. If you want to have different control depending on the resource and action, you can use [resource-specific handlers](#resource-specific-handlers). See the [Supported Resources](#supported-resources) section for a full list of the resources that support access control.
194194

195195
```python
196196
@auth.on
@@ -235,7 +235,7 @@ async def add_owner(
235235
<a id="resource-specific-handlers"></a>
236236
### Resource-specific handlers
237237

238-
You can register handlers for specific resources and actions by chaining the resource and action names together with the [`@auth.on`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.Auth.on) decorator.
238+
You can register handlers for specific resources and actions by chaining the resource and action names together with the @[`@auth.on`][Auth] decorator.
239239
When a request is made, the most specific handler that matches that resource and action is called. Below is an example of how to register handlers for specific resources and actions. For the following setup:
240240

241241
1. Authenticated users are able to create threads, read threads, and create runs on threads
@@ -351,7 +351,7 @@ A filter dictionary is a dictionary with keys that match the resource metadata.
351351
* `$contains`: List membership (e.g., `{"allowed_users": {"$contains": user_id}}`) or list containment (e.g., `{"allowed_users": {"$contains": [user_id_1, user_id_2]}}`). The value here must be an element of the list or a subset of the elements of the list, respectively. The metadata in the stored resource must be a list/container type.
352352

353353
A dictionary with multiple keys is treated using a logical `AND` filter. For example, `{"owner": org_id, "allowed_users": {"$contains": user_id}}` will only match resources with metadata whose "owner" is `org_id` and whose "allowed_users" list contains `user_id`.
354-
See the reference [here](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.FilterType) for more information.
354+
See the reference @[`Auth`](Auth) for more information.
355355

356356
## Common access patterns
357357

@@ -457,22 +457,22 @@ Here are all the supported action handlers:
457457

458458
| Resource | Handler | Description | Value Type |
459459
|----------|---------|-------------|------------|
460-
| **Threads** | `@auth.on.threads.create` | Thread creation | [`ThreadsCreate`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.ThreadsCreate) |
461-
| | `@auth.on.threads.read` | Thread retrieval | [`ThreadsRead`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.ThreadsRead) |
462-
| | `@auth.on.threads.update` | Thread updates | [`ThreadsUpdate`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.ThreadsUpdate) |
463-
| | `@auth.on.threads.delete` | Thread deletion | [`ThreadsDelete`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.ThreadsDelete) |
464-
| | `@auth.on.threads.search` | Listing threads | [`ThreadsSearch`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.ThreadsSearch) |
465-
| | `@auth.on.threads.create_run` | Creating or updating a run | [`RunsCreate`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.RunsCreate) |
466-
| **Assistants** | `@auth.on.assistants.create` | Assistant creation | [`AssistantsCreate`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.AssistantsCreate) |
467-
| | `@auth.on.assistants.read` | Assistant retrieval | [`AssistantsRead`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.AssistantsRead) |
468-
| | `@auth.on.assistants.update` | Assistant updates | [`AssistantsUpdate`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.AssistantsUpdate) |
469-
| | `@auth.on.assistants.delete` | Assistant deletion | [`AssistantsDelete`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.AssistantsDelete) |
470-
| | `@auth.on.assistants.search` | Listing assistants | [`AssistantsSearch`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.AssistantsSearch) |
471-
| **Crons** | `@auth.on.crons.create` | Cron job creation | [`CronsCreate`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.CronsCreate) |
472-
| | `@auth.on.crons.read` | Cron job retrieval | [`CronsRead`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.CronsRead) |
473-
| | `@auth.on.crons.update` | Cron job updates | [`CronsUpdate`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.CronsUpdate) |
474-
| | `@auth.on.crons.delete` | Cron job deletion | [`CronsDelete`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.CronsDelete) |
475-
| | `@auth.on.crons.search` | Listing cron jobs | [`CronsSearch`](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/#langgraph_sdk.auth.types.CronsSearch) |
460+
| **Threads** | `@auth.on.threads.create` | Thread creation | @[`ThreadsCreate`] |
461+
| | `@auth.on.threads.read` | Thread retrieval | @[`ThreadsRead`] |
462+
| | `@auth.on.threads.update` | Thread updates | @[`ThreadsUpdate`] |
463+
| | `@auth.on.threads.delete` | Thread deletion | @[`ThreadsDelete`] |
464+
| | `@auth.on.threads.search` | Listing threads | @[`ThreadsSearch`] |
465+
| | `@auth.on.threads.create_run` | Creating or updating a run | @[`RunsCreate`] |
466+
| **Assistants** | `@auth.on.assistants.create` | Assistant creation | @[`AssistantsCreate`] |
467+
| | `@auth.on.assistants.read` | Assistant retrieval | @[`AssistantsRead`] |
468+
| | `@auth.on.assistants.update` | Assistant updates | @[`AssistantsUpdate`] |
469+
| | `@auth.on.assistants.delete` | Assistant deletion | @[`AssistantsDelete`] |
470+
| | `@auth.on.assistants.search` | Listing assistants | @[`AssistantsSearch`] |
471+
| **Crons** | `@auth.on.crons.create` | Cron job creation | @[`CronsCreate`] |
472+
| | `@auth.on.crons.read` | Cron job retrieval | @[`CronsRead`] |
473+
| | `@auth.on.crons.update` | Cron job updates | @[`CronsUpdate`] |
474+
| | `@auth.on.crons.delete` | Cron job deletion | @[`CronsDelete`] |
475+
| | `@auth.on.crons.search` | Listing cron jobs | @[`CronsSearch`] |
476476

477477
<Note>
478478
"About Runs"

0 commit comments

Comments
 (0)