Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
37 changes: 37 additions & 0 deletions pipeline/preprocessors/link_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,12 @@ class LinkMap(TypedDict):
"AssistantsClient": "langsmith/deployment/sdk/#langgraph_sdk.client.AssistantsClient",
"AssistantsClient.create": "langsmith/deployment/sdk/#langgraph_sdk.client.AssistantsClient.create",
"AssistantsClient.update": "langsmith/deployment/sdk/#langgraph_sdk.client.AssistantsClient.update",
"LangGraphSDK": "langsmith/deployment/sdk/",
"ThreadsClient": "langsmith/deployment/sdk/#langgraph_sdk.client.ThreadsClient",
"ThreadsClient.create": "langsmith/deployment/sdk/#langgraph_sdk.client.ThreadsClient.create",
"ThreadsClient.copy": "langsmith/deployment/sdk/#langgraph_sdk.client.ThreadsClient.copy",
"ThreadsClient.get": "langsmith/deployment/sdk/#langgraph_sdk.client.ThreadsClient.get",
"ThreadsClient.get_state": "langsmith/deployment/sdk/#langgraph_sdk.client.ThreadsClient.get_state",
"ThreadsClient.search": "langsmith/deployment/sdk/#langgraph_sdk.client.ThreadsClient.search",
"ThreadsClient.get_history": "langsmith/deployment/sdk/#langgraph_sdk.client.ThreadsClient.get_history",
"RunsClient": "langsmith/deployment/sdk/#langgraph_sdk.client.RunsClient",
Expand Down Expand Up @@ -370,10 +373,14 @@ class LinkMap(TypedDict):
"ToolNode": "classes/langchain.index.ToolNode.html",
"UsageMetadata": "types/_langchain_core.messages.UsageMetadata.html",
# LangSmith Deployment SDK - JS
"LangGraphSDK": "langgraph-sdk/",
"ThreadsClient": "classes/_langchain_langgraph-sdk.client.ThreadsClient.html",
"ThreadsClient.create": "classes/_langchain_langgraph-sdk.client.ThreadsClient.html#create",
"ThreadsClient.copy": "classes/_langchain_langgraph-sdk.client.ThreadsClient.html#copy",
"ThreadsClient.get": "classes/_langchain_langgraph-sdk.client.ThreadsClient.html#get",
"ThreadsClient.get_state": "classes/_langchain_langgraph-sdk.client.ThreadsClient.html#getstate",
"ThreadsClient.search": "classes/_langchain_langgraph-sdk.client.ThreadsClient.html#search",
"ThreadsClient.get_history": "classes/_langchain_langgraph-sdk.client.ThreadsClient.html#gethistory",
"ThreadsClient.getHistory": "classes/_langchain_langgraph-sdk.client.ThreadsClient.html#gethistory",
"AssistantsClient": "classes/_langchain_langgraph-sdk.client.AssistantsClient.html",
"AssistantsClient.create": "classes/_langchain_langgraph-sdk.client.AssistantsClient.html#create",
Expand All @@ -386,6 +393,36 @@ class LinkMap(TypedDict):
"toolRetryMiddleware": "functions/langchain.index.toolRetryMiddleware.html",
},
},
{
# LangSmith Deployment REST API - Python scope
"host": "https://langchain-ai.github.io/langgraph/cloud/reference/api/",
"scope": "python",
"links": {
"AssistantsAPI": "api_ref.html#tag/assistants",
"ThreadsAPI": "api_ref.html#tag/threads",
"ThreadsAPI.create": "api_ref.html#tag/threads/post/threads",
"ThreadsAPI.copy": "api_ref.html#tag/threads/post/threads/{thread_id}/copy",
"ThreadsAPI.get": "api_ref.html#tag/threads/get/threads/{thread_id}",
"ThreadsAPI.get_state": "api_ref.html#tag/threads/get/threads/{thread_id}/state",
"ThreadsAPI.search": "api_ref.html#tag/threads/post/threads/search",
"ThreadsAPI.get_history": "api_ref.html#tag/threads/post/threads/{thread_id}/history",
},
},
{
# LangSmith Deployment REST API - JS scope
"host": "https://langchain-ai.github.io/langgraph/cloud/reference/api/",
"scope": "js",
"links": {
"AssistantsAPI": "api_ref.html#tag/assistants",
"ThreadsAPI": "api_ref.html#tag/threads",
"ThreadsAPI.create": "api_ref.html#tag/threads/post/threads",
"ThreadsAPI.copy": "api_ref.html#tag/threads/post/threads/{thread_id}/copy",
"ThreadsAPI.get": "api_ref.html#tag/threads/get/threads/{thread_id}",
"ThreadsAPI.get_state": "api_ref.html#tag/threads/get/threads/{thread_id}/state",
"ThreadsAPI.search": "api_ref.html#tag/threads/post/threads/search",
"ThreadsAPI.get_history": "api_ref.html#tag/threads/post/threads/{thread_id}/history",
},
},
]


Expand Down
165 changes: 154 additions & 11 deletions src/langsmith/assistants.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,179 @@ title: Assistants
sidebarTitle: Overview
---

**Assistants** allow you to manage configurations (like prompts, LLM selection, tools) separately from your graph's core logic, enabling rapid changes that don't alter the graph architecture. It is a way to create multiple specialized versions of the same graph architecture, each optimized for different use cases through configuration variations rather than structural changes.
_Assistants_ allow you to manage configurations (like prompts, LLM selection, tools) separately from your graph's core logic, enabling rapid changes that don't alter the graph architecture. It is a way to create multiple specialized versions of the same graph architecture, each optimized for different [use cases](#when-to-use-assistants) through configuration variations rather than structural changes.

For example, imagine a general-purpose writing agent built on a common graph architecture. While the structure remains the same, different writing styles—such as blog posts and tweets—require tailored configurations to optimize performance. To support these variations, you can create multiple assistants (e.g., one for blogs and another for tweets) that share the underlying graph but differ in model selection and system prompt.

![assistant versions](/langsmith/images/assistants.png)

The LangGraph API provides several endpoints for creating and managing assistants and their versions. See the [API reference](https://langchain-ai.github.io/langgraph/cloud/reference/api/api_ref/#tag/assistants) for more details.
The LangGraph API provides several endpoints for creating and managing assistants and their versions. See the @[API reference][AssistantsAPI] for more details.

<Info>
Assistants are a [LangSmith](/langsmith/home) concept. They are not available in the open source LangGraph library.
Assistants are a [LangSmith Deployment](/langsmith/deployments) concept. They are not available in the open source LangGraph library.
</Info>

## Configuration
## When to use assistants

Assistants are ideal when you need to deploy the same graph logic with different configurations. Common use cases include:

- **User-level personalization**
- Customize model selection, system prompts, or tool availability per user.
- Store user preferences and apply them automatically to each interaction.
- Enable users to choose between different AI personalities or expertise levels.

- **Customer or organization-specific configurations**
- Maintain separate configurations for different customers or organizations.
- Customize behavior for each client without deploying separate infrastructure.
- Isolate configuration changes to specific customers.

```mermaid
graph TD
A["Graph: agent<br/>(deployed)"]
A --> B["Customer A Assistant<br/>━━━━━━━━━━━━━<br/>Model: GPT-4<br/>Tone: Legal<br/>Tools: Custom"]
A --> C["Customer B Assistant<br/>━━━━━━━━━━━━━<br/>Model: Claude<br/>Tone: Casual<br/>Tools: Standard"]
A --> D["Customer C Assistant<br/>━━━━━━━━━━━━━<br/>Model: GPT-3.5<br/>Tone: Formal<br/>Tools: Limited"]

style A fill:#4A90E2,stroke:#2E5C8A,stroke-width:3px,color:#fff
style B fill:#E8F4F8,stroke:#4A90E2,stroke-width:2px
style C fill:#E8F4F8,stroke:#4A90E2,stroke-width:2px
style D fill:#E8F4F8,stroke:#4A90E2,stroke-width:2px
```

- **Environment-specific configurations**
- Use different models or settings for development, staging, and production.
- Test configuration changes in staging before promoting to production.
- Reduce costs in non-production environments with smaller models.

- **A/B testing and experimentation**
- Compare different prompts, models, or parameter settings.
- Roll out configuration changes gradually to a subset of users.
- Measure performance differences between configuration variants.

- **Specialized task variants**
- Create domain-specific versions of a general-purpose agent.
- Optimize configurations for different languages, regions, or industries.
- Maintain consistent graph logic while varying the execution details.

```mermaid
graph TD
A["Graph: writing-agent<br/>(deployed)"]
A --> B["Blog Assistant<br/>━━━━━━━━━━━━━<br/>Model: GPT-4<br/>Tone: Formal<br/>Style: Long-form<br/>Tools: SEO optimization"]
A --> C["Tweet Assistant<br/>━━━━━━━━━━━━━<br/>Model: GPT-4-mini<br/>Tone: Casual<br/>Style: 280-char limit<br/>Tools: Hashtag suggestions"]
A --> D["Email Assistant<br/>━━━━━━━━━━━━━<br/>Model: GPT-4<br/>Tone: Professional<br/>Style: Medium length<br/>Tools: Templates"]

style A fill:#4A90E2,stroke:#2E5C8A,stroke-width:3px,color:#fff
style B fill:#E8F4F8,stroke:#4A90E2,stroke-width:2px
style C fill:#E8F4F8,stroke:#4A90E2,stroke-width:2px
style D fill:#E8F4F8,stroke:#4A90E2,stroke-width:2px
```

## How assistants work with deployments

When you deploy a graph with LangSmith Deployment, [Agent Server](/langsmith/agent-server) automatically creates a **default assistant** tied to that graph's default configuration. You can then create additional assistants for the same graph, each with its own configuration.

Assistants have several key features:

- **[Managed via API and UI](/langsmith/configuration-cloud)**: Create, list, update, version, and select assistants using the Agent Server/LangGraph SDKs or the [LangSmith UI](https://smith.langchain.com).
- **One graph, multiple assistants**: A single deployed graph can support multiple assistants, each with different configurations (e.g., prompts, models, tools).
- **[Versioned](#versioning) configurations**: Each assistant maintains its own configuration history through versioning. Editing an assistant creates a new version, and you can promote or roll back to any version.
- **[Configuration](#configuration) updates without graph changes**: Update prompts, model selection, and other settings through assistant configurations, enabling rapid iteration without modifying or redeploying your graph code.

<Note>
When invoking a run, you can specify either:
- A **graph name** (e.g., `"agent"`): Uses the default assistant for that graph
- An **assistant ID** (UUID): Uses a specific assistant configuration

This flexibility allows you to quickly test with default settings or precisely control which configuration is used.
</Note>

### Configuration

Assistants build on the LangGraph open source concept of [configuration](/oss/langgraph/graph-api#runtime-context).

While configuration is available in the open source LangGraph library, assistants are only present in [LangSmith](/langsmith/home). This is due to the fact that assistants are tightly coupled to your deployed graph. Upon deployment, Agent Server will automatically create a default assistant for each graph using the graph's default configuration settings.
While configuration is available in the open source LangGraph library, assistants are only present in [LangSmith Deployment](/langsmith/deployments) because they are tightly coupled to your deployed graph. Upon deployment, [Agent Server](/langsmith/agent-server) will automatically create a default assistant for each graph using the graph's default configuration settings.

In practice, an assistant is just an _instance_ of a graph with a specific configuration. Therefore, multiple assistants can reference the same graph but can contain different configurations (e.g. prompts, models, tools). The LangSmith Deployment API provides several endpoints for creating and managing assistants. See the [API reference](https://langchain-ai.github.io/langgraph/cloud/reference/api/api_ref/) and [this how-to](/langsmith/configuration-cloud) for more details on how to create assistants.

## Versioning
### Versioning

Assistants support versioning to track changes over time. Once you've created an assistant, subsequent edits will automatically create new versions.

- Each update creates a new version of the assistant.
- You can promote any version to be the active version.
- Rolling back to a previous version is as simple as setting it as active.
- All versions remain available for reference and rollback.

<Warning>
When updating an assistant, you must provide the entire configuration payload. The update endpoint creates new versions from scratch and does not merge with previous versions. Make sure to include all configuration fields you want to retain.
</Warning>

For more details on how to manage assistant versions, refer to the [Manage assistants guide](/langsmith/configuration-cloud#create-a-new-version-for-your-assistant).

### Execution

A _run_ is an invocation of an assistant. When you execute a run, you specify which assistant to use (either by graph name for the default assistant or by assistant ID for a specific configuration).

```mermaid
flowchart TB
subgraph deploy[Deployment]
G[Graph Code<br/>━━━━━━━━━<br/>Deployed logic]
end

subgraph config[Configuration]
A1[Assistant 1<br/>GPT-4, Formal]
A2[Assistant 2<br/>Claude, Casual]
end

subgraph state[State]
T1[Thread 1<br/>User A]
T2[Thread 2<br/>User B]
end

subgraph runs[Runs]
A1T1["Run: A1 + T1"]
A1T2["Run: A1 + T2"]
A2T1["Run: A2 + T1"]
end

A1 -.-> T1
A1 -.-> T2
A2 -.-> T1

A1T1 --> G
A1T2 --> G
A2T1 --> G

style G fill:#4A90E2,stroke:#2E5C8A,stroke-width:2px,color:#fff
style A1 fill:#E8F4F8,stroke:#4A90E2,stroke-width:2px
style A2 fill:#E8F4F8,stroke:#4A90E2,stroke-width:2px
style T1 fill:#FFF4E6,stroke:#F59E0B,stroke-width:2px
style T2 fill:#FFF4E6,stroke:#F59E0B,stroke-width:2px
style A1T1 fill:#F0FDF4,stroke:#10B981,stroke-width:2px
style A1T2 fill:#F0FDF4,stroke:#10B981,stroke-width:2px
style A2T1 fill:#F0FDF4,stroke:#10B981,stroke-width:2px
```

This diagram shows how a **run** combines an assistant with a thread to execute the graph:

- **Graph** (blue): The deployed code containing your agent's logic
- **Assistants** (light blue): Configuration options (model, prompts, tools)
- **Threads** (orange): State containers for conversation history
- **Runs** (green): Executions that pair an assistant + thread

Assistants support versioning to track changes over time.
Once you've created an assistant, subsequent edits to that assistant will create new versions. See [this how-to](/langsmith/configuration-cloud#create-a-new-version-for-your-assistant) for more details on how to manage assistant versions.
**Example combinations:**
- **Run: A1 + T1**: Assistant 1 configuration applied to User A's conversation
- **Run: A1 + T2**: Same assistant serving User B (different conversation)
- **Run: A2 + T1**: Different assistant applied to User A's conversation (configuration switch)

## Execution
When executing a run:

A **run** is an invocation of an assistant. Each run may have its own input, configuration, and metadata, which may affect execution and output of the underlying graph. A run can optionally be executed on a [thread](/oss/langgraph/persistence#threads).
- Each run may have its own input, configuration overrides, and metadata.
- Runs can be stateless (no thread) or stateful (executed on a [thread](/oss/langgraph/persistence#threads) for conversation persistence).
- Multiple runs can use the same assistant configuration.
- The assistant's configuration affects how the underlying graph executes.

LangSmith API provides several endpoints for creating and managing runs. See the [API reference](https://langchain-ai.github.io/langgraph/cloud/reference/api/api_ref/) for more details.
The LangSmith API provides several endpoints for creating and managing runs. For more details, refer to the [API reference](https://langchain-ai.github.io/langgraph/cloud/reference/api/api_ref/).

## Video guide

Expand Down
Loading
Loading