This repository contains the Python SDK for interacting with the LangSmith Deployment REST API.
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)Handles incrementally reading lines from text.
Configuration options for a call.
Represents a checkpoint in the execution process.
Defines the structure and properties of a graph.
Base model for an assistant.
Represents a specific version of an assistant.
Represents an assistant with additional properties.
Paginated response for assistant search results.
Represents an interruption in the execution flow.
Represents a conversation thread.
Represents a task within a thread.
Represents the state of a thread.
Represents the response from updating a thread's state.
Represents a single execution run.
Represents a scheduled task.
Payload for updating a cron job. All fields are optional.
Defines the parameters for initiating a background run.
Represents a single document or data entry in the graph's Store.
Response structure for listing namespaces.
Item with an optional relevance score from search operations.
Response structure for searching items.
Represents a part of a stream response.
Represents a message to be sent to a specific node in the graph.
Represents one or more commands to control graph execution flow and state.
Metadata for a run creation request.
Warning for beta features in LangGraph SDK.
Raised when attempting to register a duplicate encryption/decryption handler.
Add custom at-rest encryption to your LangGraph application.
Context passed to encryption/decryption handlers.
Client for managing assistants in LangGraph.
Client for interacting with the graph's shared storage.
Top-level client for LangGraph API.
Client for managing recurrent runs (cron jobs) in LangGraph.
Client for managing threads in LangGraph.
Handle async requests to the LangGraph API.
Client for managing runs in LangGraph.
Add custom authentication and authorization management to your LangGraph application.
User objects must at least expose the identity property.
The dictionary representation of a user.
The base ASGI user protocol
A user object that's populated from authenticated requests from the LangGraph studio.
Base class for authentication context.
Complete authentication context with resource and action information.
Time-to-live configuration for a thread.
Parameters for creating a new thread.
Parameters for reading thread state or run information.
Parameters for updating a thread or run.
Parameters for deleting a thread.
Parameters for searching threads.
Payload for creating a run.
Payload for creating an assistant.
Payload for reading an assistant.
Payload for updating an assistant.
Payload for deleting an assistant.
Payload for searching assistants.
Payload for creating a cron job.
Payload for deleting a cron job.
Payload for reading a cron job.
Payload for updating a cron job.
Payload for searching cron jobs.
Operation to retrieve a specific item by its namespace and key.
Operation to search for items within a specified namespace hierarchy.
Operation to list and filter namespaces in the store.
Operation to store, update, or delete an item in the store.
Operation to delete an item from the store.
Namespace for type definitions of different API operations.
Types for thread-related operations.
Type for thread creation parameters.
Type for creating or streaming a run.
Type for thread read parameters.
Type for thread update parameters.
Type for thread deletion parameters.
Type for thread search parameters.
Types for assistant-related operations.
Type for assistant creation parameters.
Type for assistant read parameters.
Type for assistant update parameters.
Type for assistant deletion parameters.
Type for assistant search parameters.
Types for cron-related operations.
Type for cron creation parameters.
Type for cron read parameters.
Type for cron update parameters.
Type for cron deletion parameters.
Type for cron search parameters.
Types for store-related operations.
Type for store put parameters.
Type for store get parameters.
Type for store search parameters.
Type for store delete parameters.
Type for store list namespaces parameters.
HTTP exception that you can raise to return a specific HTTP error response.
Client for managing assistants in LangGraph synchronously.
A client for synchronous operations on a key-value store.
Synchronous client for interacting with the LangGraph API.
Synchronous client for managing cron jobs in LangGraph.
Synchronous client for managing threads in LangGraph.
Handle synchronous requests to the LangGraph API.
Synchronous client for managing runs in LangGraph.