Understand assistant configuration
Assistants store context values that customize graph behavior at runtime. You define a context schema in your graph code, then provide specific context values when creating an assistant via thecontext parameter.
Consider this example of a call_model node that reads the model_name from the context:
- SDK
- UI
Create an assistant
Use the AssistantsClient.create method to create a new assistant. This method requires:- Graph ID: The name of the deployed graph this assistant will use (e.g.,
"agent"). - Context: Configuration values matching your graph’s context schema.
- Name: A descriptive name for the assistant.
model_name set to openai:assistant_id: A UUID that uniquely identifies this assistantgraph_id: The graph this assistant is configured forcontext: The configuration values you providedname,metadata, timestamps, and other fields
assistant_id (a UUID like "62e209ca-9154-432a-b9e9-2d75c7a9219b") uniquely identifies this assistant configuration. You’ll use this ID when running your graph to specify which configuration to apply.Graph ID vs Assistant IDWhen creating an assistant, you specify a graph ID (graph name like
"agent"). This returns an assistant ID (UUID like "62e209ca..."). You can use either when running your graph:- Graph ID (e.g.,
"agent"): Uses the default assistant for that graph - Assistant ID (UUID): Uses the specific assistant configuration
Use an assistant
To use an assistant, pass itsassistant_id when creating a run. The example below uses the assistant we created above:Using graph ID vs assistant IDYou can pass either a graph ID or assistant ID when running your graph:
Create a new version for your assistant
Use the AssistantsClient.update method to create a new version of an assistant.For example, to add a system prompt to the assistant:Use a previous assistant version
Use thesetLatest method to change which version is active: