| Name | Type | Description |
|---|---|---|
graph_id* | str | None | The ID of the graph the assistant should use. The graph ID is normally set in your langgraph.json configuration. |
config | Config | None | Default: NoneConfiguration to use for the graph. |
context | Context | None | Default: NoneStatic context to add to the assistant. |
metadata | Json | Default: None |
assistant_id | str | None | Default: None |
if_exists | OnConflictBehavior | None | Default: None |
name | str | None | Default: None |
headers | Mapping[str, str] | None | Default: None |
description | str | None | Default: None |
params | QueryParamTypes | None | Default: None |
Create a new assistant.
Useful when graph is configurable and you want to create different assistants based on different configurations.
client = get_sync_client(url="http://localhost:2024")
assistant = client.assistants.create(
graph_id="agent",
context={"model_name": "openai"},
metadata={"number":1},
assistant_id="my-assistant-id",
if_exists="do_nothing",
name="my_name"
)Metadata to add to assistant.
Assistant ID to use, will default to a random UUID if not provided.
How to handle duplicate creation. Defaults to 'raise' under the hood. Must be either 'raise' (raise error if duplicate), or 'do_nothing' (return existing assistant).
The name of the assistant. Defaults to 'Untitled' under the hood.
Optional custom headers to include with the request.
Optional description of the assistant. The description field is available for langgraph-api server version>=0.0.45
Optional query parameters to include with the request.