Validate Within Dir • AI Agent SDK
validate_within_dir: Validate that a path is contained within an allowed root directory.
validate_within_dir
Function
</div>
This function is defined in the workspace module.
Validate that a path is contained within an allowed root directory.
Signature
def validate_within_dir(path: Path, allowed_root: Path) -> boolParameters
ParamField
PathPath to validate
ParamField
PathRoot directory that must contain the path
Returns
ResponseField
boolTrue if path is within allowed_root, False otherwise
Uses
relative_topath.resolveallowed_root.resolve
Source
View on GitHubpraisonaiagents/workspace/__init__.py at line 153