> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Set Snapshot Root • AI Agent SDK

> set_snapshot_root: Root filesystem change-tracking at ``project_path``.

# set\_snapshot\_root

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**Agent**](../classes/Agent) class in the [**agent**](../modules/agent) module.

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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def set_snapshot_root(project_path: str) -> bool
```

## Parameters

<ParamField query="project_path" type="str" required={true}>
  No description available.
</ParamField>

### Returns

<ResponseField name="Returns" type="bool">
  The result of the operation.
</ResponseField>

## Uses

* `abspath`
* `FileSnapshot`
* `logger.debug`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/agent.py#L3407">
  `praisonaiagents/agent/agent.py` at line 3407
</Card>
