Create a new session
Create a new session with required title and optional custom system prompt. Session automatically gets isolated storage directory.
Create a new session with required title and optional custom system prompt. Session automatically gets isolated storage directory.
customSystemPrompt?string
Custom system prompt content. Size limits apply based on promptMode: 100KB (102,400 bytes) for replace mode, 50KB (51,200 bytes) for append mode. Ignored in default mode. Supports environment variable substitution with $ syntax.
Length
length <= 102400
promptMode?string
Custom prompt handling mode:
- 'default': Use base system prompt only (customSystemPrompt ignored)
- 'append': Append customSystemPrompt to base system prompt (50KB limit)
- 'replace': Replace base system prompt with customSystemPrompt (100KB limit)
Default
"default"
Value in
"default" | "append" | "replace"
titlestring
Title for the session
Response Body
from mix_python_sdk import Mixwith Mix() as mix: res = mix.sessions.create(title="<value>", custom_system_prompt="You are a helpful assistant specialized in $<domain>. Always be concise and accurate.", prompt_mode="append") # Handle response print(res)
{
"assistantMessageCount": 0,
"completionTokens": 0,
"cost": 0.1,
"createdAt": "2019-08-24T14:15:22Z",
"firstUserMessage": "string",
"id": "string",
"promptTokens": 0,
"title": "string",
"toolCallCount": 0,
"userMessageCount": 0
}
{
"error": {
"code": 400,
"message": "promptMode must be 'default', 'append', or 'replace'",
"type": "validation_error"
}
}