Context Sync API Reference
May 2, 2026 ยท View on GitHub
UploadStrategy
class UploadStrategy(Enum)
Upload strategy for context synchronization
UPLOAD_BEFORE_RESOURCE_RELEASE
UPLOAD_BEFORE_RESOURCE_RELEASE = "UploadBeforeResourceRelease"
DownloadStrategy
class DownloadStrategy(Enum)
Download strategy for context synchronization
DOWNLOAD_ASYNC
DOWNLOAD_ASYNC = "DownloadAsync"
UploadMode
class UploadMode(Enum)
Upload mode for context synchronization
FILE
FILE = "File"
ARCHIVE
ARCHIVE = "Archive"
Lifecycle
class Lifecycle(Enum)
Lifecycle options for recycle policy
LIFECYCLE_1DAY
LIFECYCLE_1DAY = "Lifecycle_1Day"
LIFECYCLE_3DAYS
LIFECYCLE_3DAYS = "Lifecycle_3Days"
LIFECYCLE_5DAYS
LIFECYCLE_5DAYS = "Lifecycle_5Days"
LIFECYCLE_10DAYS
LIFECYCLE_10DAYS = "Lifecycle_10Days"
LIFECYCLE_15DAYS
LIFECYCLE_15DAYS = "Lifecycle_15Days"
LIFECYCLE_30DAYS
LIFECYCLE_30DAYS = "Lifecycle_30Days"
LIFECYCLE_90DAYS
LIFECYCLE_90DAYS = "Lifecycle_90Days"
LIFECYCLE_180DAYS
LIFECYCLE_180DAYS = "Lifecycle_180Days"
LIFECYCLE_360DAYS
LIFECYCLE_360DAYS = "Lifecycle_360Days"
LIFECYCLE_FOREVER
LIFECYCLE_FOREVER = "Lifecycle_Forever"
UploadPolicy
@dataclass
class UploadPolicy()
Defines the upload policy for context synchronization
Attributes:
auto_upload: Enables automatic upload
upload_strategy: Defines the upload strategy
upload_mode: Defines the upload mode (UploadMode.FILE or UploadMode.ARCHIVE)
archive_exclude_paths: Paths excluded from Archive packaging, stored as individual
files (FILE mode). Only applicable when upload_mode=ARCHIVE. Each entry is a relative path prefix (no wildcards). Matching files support Presigned URL direct access.
auto_upload: bool
auto_upload = True
upload_strategy: UploadStrategy
upload_strategy = UploadStrategy.UPLOAD_BEFORE_RESOURCE_RELEASE
upload_mode: UploadMode
upload_mode = UploadMode.FILE
archive_exclude_paths: List[str]
archive_exclude_paths = field(default_factory=list)
default
@classmethod
def default(cls)
Creates a new upload policy with default values
DownloadPolicy
@dataclass
class DownloadPolicy()
Defines the download policy for context synchronization
Attributes:
auto_download: Enables automatic download
download_strategy: Defines the download strategy
auto_download: bool
auto_download = True
download_strategy: DownloadStrategy
download_strategy = DownloadStrategy.DOWNLOAD_ASYNC
default
@classmethod
def default(cls)
Creates a new download policy with default values
DeletePolicy
@dataclass
class DeletePolicy()
Defines the delete policy for context synchronization
Attributes:
sync_local_file: Enables synchronization of local file deletions
sync_local_file: bool
sync_local_file = True
default
@classmethod
def default(cls)
Creates a new delete policy with default values
ExtractPolicy
@dataclass
class ExtractPolicy()
Defines the extract policy for context synchronization
Attributes:
extract: Enables file extraction
delete_src_file: Enables deletion of source file after extraction
extract_current_folder: Enables extraction to the current folder
extract: bool
extract = True
delete_src_file: bool
delete_src_file = True
extract_current_folder: bool
extract_current_folder = False
default
@classmethod
def default(cls)
Creates a new extract policy with default values
RecyclePolicy
@dataclass
class RecyclePolicy()
Defines the recycle policy for context synchronization
Attributes:
lifecycle: Defines how long the context data should be retained
Available options:
- LIFECYCLE_1DAY: Keep data for 1 day
- LIFECYCLE_3DAYS: Keep data for 3 days
- LIFECYCLE_5DAYS: Keep data for 5 days
- LIFECYCLE_10DAYS: Keep data for 10 days
- LIFECYCLE_15DAYS: Keep data for 15 days
- LIFECYCLE_30DAYS: Keep data for 30 days
- LIFECYCLE_90DAYS: Keep data for 90 days
- LIFECYCLE_180DAYS: Keep data for 180 days
- LIFECYCLE_360DAYS: Keep data for 360 days
- LIFECYCLE_FOREVER: Keep data permanently (default) paths: Specifies which directories or files should be subject to the recycle policy Rules:
- Must use exact directory/file paths
- Wildcard patterns (* ? [ ]) are NOT supported
- Empty string "" means apply to all paths in the context
- Multiple paths can be specified as a list Default: [""] (applies to all paths)
lifecycle: Lifecycle
lifecycle = Lifecycle.LIFECYCLE_FOREVER
paths: List[str]
paths = field(default_factory=lambda: [""])
default
@classmethod
def default(cls)
Creates a new recycle policy with default values
WhiteList
@dataclass
class WhiteList()
Defines the white list configuration
Attributes:
path: Path to include in the white list.
When is_path_regex is False (default), this must be an exact absolute directory path and wildcard characters are not allowed. When is_path_regex is True, this is treated as a regex pattern (e.g. "/home/wuying/.*"). exclude_paths: Paths to exclude from the white list. When is_exclude_regex is False (default), these must be exact absolute directory paths and wildcard characters are not allowed. When is_exclude_regex is True, these are treated as regex patterns. is_path_regex: If True, path is interpreted as a regex pattern. If False (default), path is an absolute directory path. is_exclude_regex: If True, exclude_paths entries are interpreted as regex patterns. If False (default), exclude_paths entries are absolute directory paths.
path: str
path = ""
exclude_paths: List[str]
exclude_paths = field(default_factory=list)
is_path_regex: bool
is_path_regex = False
is_exclude_regex: bool
is_exclude_regex = False
BWList
@dataclass
class BWList()
Defines the black and white list configuration
Attributes:
white_lists: Defines the white lists
white_lists: List[WhiteList]
white_lists = field(default_factory=list)
MappingPolicy
@dataclass
class MappingPolicy()
Defines the mapping policy for cross-platform context synchronization
Attributes:
path: The original path from a different OS that should be mapped to the current context path
path: str
path = ""
default
@classmethod
def default(cls)
Creates a new mapping policy with default values
SyncPolicy
@dataclass
class SyncPolicy()
Defines the synchronization policy
Attributes:
upload_policy: Defines the upload policy
download_policy: Defines the download policy
delete_policy: Defines the delete policy
extract_policy: Defines the extract policy
recycle_policy: Defines the recycle policy
bw_list: Defines the black and white list
mapping_policy: Defines the mapping policy for cross-platform context synchronization
upload_policy: Optional[UploadPolicy]
upload_policy = None
download_policy: Optional[DownloadPolicy]
download_policy = None
delete_policy: Optional[DeletePolicy]
delete_policy = None
extract_policy: Optional[ExtractPolicy]
extract_policy = None
recycle_policy: Optional[RecyclePolicy]
recycle_policy = None
bw_list: Optional[BWList]
bw_list = None
mapping_policy: Optional[MappingPolicy]
mapping_policy = None
default
@classmethod
def default(cls)
Creates a new sync policy with default values
ContextSync
@dataclass
class ContextSync()
Defines the context synchronization configuration
Attributes:
context_id: ID of the context to synchronize
path: Path where the context should be mounted
policy: Defines the synchronization policy
beta_wait_for_completion: Beta feature flag to control whether session creation
should wait for this context's initial download to finish. If set to False, the SDK will not block create_session on this context. Defaults to None (treated as True for backward compatibility).
context_id: str
context_id = None
path: str
path = None
policy: Optional[SyncPolicy]
policy = None
beta_wait_for_completion: Optional[bool]
beta_wait_for_completion = None
new
@classmethod
def new(cls,
context_id: str,
path: str,
policy: Optional[SyncPolicy] = None,
beta_wait_for_completion: Optional[bool] = None)
Creates a new context sync configuration
with_policy
def with_policy(policy: SyncPolicy)
Sets the policy
See Also
Documentation generated automatically from source code using pydoc-markdown.