Create and configure a LangGraphClient.
The client provides programmatic access to LangSmith Deployment. It supports both remote servers and local in-process connections (when running inside a LangGraph server).
get_client(
*,
url: str | None = None,
api_key: str | None = NOT_PROVIDED,
headers: Mapping[str, str] | None = None,
timeout: TimeoutTypes | None = None
) -> LangGraphClientfrom langgraph_sdk import get_client
# get top-level LangGraphClient
client = get_client(url="http://localhost:8123")
# example usage: client.<model>.<method_name>()
assistants = await client.assistants.get(assistant_id="some_uuid")from langgraph_sdk import get_client
client = get_client(url=None)
async def my_node(...):
subagent_result = await client.runs.wait(
thread_id=None,
assistant_id="agent",
input={"messages": [{"role": "user", "content": "Foo"}]},
)from langgraph_sdk import get_client
# Don't load API key from environment variables
client = get_client(
url="http://localhost:8123",
api_key=None
)| Name | Type | Description |
|---|---|---|
url | str | None | Default: NoneBase URL of the LangGraph API.
|
api_key | str | None | Default: NOT_PROVIDEDAPI key for authentication. Can be:
|
headers | Mapping[str, str] | None | Default: NoneAdditional HTTP headers to include in requests. Merged with authentication headers. |
timeout | TimeoutTypes | None | Default: NoneHTTP timeout configuration. May be:
|