Set Snapshot Root • AI Agent SDK
set_snapshot_root: Root filesystem change-tracking at “project_path“.
set_snapshot_root
Method
</div>
Root filesystem change-tracking at `project_path`.
Bots/gateway resolve file tools against a per-chat `Workspace and attach it after construction, but the FileSnapshot backing :meth:undo/:meth:redo/:meth:diff was created at __init__ time rooted at os.getcwd(). Without this, /undo` tracks the wrong directory (never where the tools actually wrote). Call this once after the workspace is known so change tracking follows the tools.
Rooting at a new directory clears the undo/redo stacks (they belong to the previous root). A no-op when the root is unchanged. Returns `True when a snapshot manager is rooted at project_path`.
Signature
def set_snapshot_root(project_path: str) -> boolParameters
strNo description available.
Returns
boolThe result of the operation.
Uses
abspathFileSnapshotlogger.debug
Source
View on GitHubpraisonaiagents/agent/agent.py at line 4411