---
sidebar:
  label: roboto.upload_agent.files
  order: 2
title: roboto.upload_agent.files
---
## Module Contents

### UPLOAD_COMPLETE_FILENAME

```python
roboto.upload_agent.files.UPLOAD_COMPLETE_FILENAME = '.roboto_upload_complete.json'
```

`from roboto.upload_agent.files import UPLOAD_COMPLETE_FILENAME`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/upload_agent/files.py#L15-L15)

Name of the file the upload agent writes into a directory it has uploaded, holding an `UploadCompleteFile`.

### UPLOAD_IN_PROGRESS_FILENAME

```python
roboto.upload_agent.files.UPLOAD_IN_PROGRESS_FILENAME = '.roboto_upload_in_progress.json'
```

`from roboto.upload_agent.files import UPLOAD_IN_PROGRESS_FILENAME`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/upload_agent/files.py#L18-L18)

Name of the file the upload agent writes into a directory it is uploading, holding an `UploadInProgressFile`.

### UploadAgentConfig

```python
class roboto.upload_agent.files.UploadAgentConfig(/, **data: Any)
```

`from roboto.upload_agent.files import UploadAgentConfig`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/upload_agent/files.py#L88-L128)

Bases: `pydantic.BaseModel`

Settings of the upload agent: which directories it scans and what it does with files once they are uploaded.

`roboto-agent configure` writes them to `~/.roboto/upload_agent.json`, and `roboto-agent run` reads them from there. To upload from Python, pass them to [`UploadAgent`](/docs/reference/python-sdk/roboto/upload_agent/agent#roboto.upload_agent.agent.UploadAgent). Building it raises `pydantic.ValidationError` when `version` is not `"v1"`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UploadAgentConfig.default_org_id** (`str | None`) = `None`: Organization to create the dataset in when every directory is uploaded into one dataset.

  [`process_uploads()`](/docs/reference/python-sdk/roboto/upload_agent/agent#roboto.upload_agent.agent.UploadAgent.process_uploads) does so when `merge_uploads` is set, as `roboto-agent run --merge-uploads` sets it. Required for merged uploads when the caller belongs to more than one organization; otherwise the caller's only organization. A dataset for a single directory uses the upload config file's `dataset.org_id` instead.

- **UploadAgentConfig.delete_empty_directories** (`bool`) = `False`: Whether to delete a directory after uploading it when nothing but its `.roboto_upload_complete.json` is left.

  Most useful with `delete_uploaded_files`: the agent keeps uploaded files unless that setting removes them, and always keeps subdirectories, so a directory that has any is never deleted.

- **UploadAgentConfig.delete_uploaded_files** (`bool`) = `False`: Whether to delete a directory's local files once they are uploaded.

  An upload config file's `upload.delete_uploaded_files` overrides it for that file's directory.

- **UploadAgentConfig.search_paths** (`list[pathlib.Path]`): Directories to search, at any depth, for upload config files.

  The agent logs and skips a path that is not a directory.

- **UploadAgentConfig.upload_config_filename** (`str`) = `'.roboto_upload.json'`: Name of the upload config file the agent looks for.

- **UploadAgentConfig.version** (`Literal['v1']`) = `'v1'`: Format of the settings, always `"v1"`.

### UploadCompleteFile

```python
class roboto.upload_agent.files.UploadCompleteFile(/, **data: Any)
```

`from roboto.upload_agent.files import UploadCompleteFile`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/upload_agent/files.py#L149-L164)

Bases: `pydantic.BaseModel`

Contents of the file the upload agent writes into a directory once it has uploaded it.

The upload agent reads and writes it; nothing else does. The agent uploads the file to the dataset after every other file, so a trigger can watch for it to start work once every file is in the dataset. A later run skips a directory that holds one, even when it cannot parse the file.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UploadCompleteFile.completed** (`datetime.datetime`): Time the upload finished.
- **UploadCompleteFile.dataset_id** (`str`): ID of the dataset the directory was uploaded to.
- **UploadCompleteFile.version** (`Literal['v1']`) = `'v1'`: Format of the file, always `"v1"`.

### UploadConfigFile

```python
class roboto.upload_agent.files.UploadConfigFile(/, **data: Any)
```

`from roboto.upload_agent.files import UploadConfigFile`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/upload_agent/files.py#L69-L85)

Bases: `pydantic.BaseModel`

Contents of an upload config file, which marks a directory for the upload agent to upload.

The agent looks for files by the name `UploadAgentConfig.upload_config_filename` gives (`.roboto_upload.json` by default) at any depth under its search paths. It uploads each file's directory with its subdirectories, then deletes the file, and logs and skips a file it cannot parse. Building it raises `pydantic.ValidationError` when `version` is not `"v1"`, or when a section holds a value its model rejects.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UploadConfigFile.dataset** (`UploadConfigFileDatasetSection`) = `None`: Settings for the dataset the directory is uploaded to.
- **UploadConfigFile.upload** (`UploadConfigFileUploadSection`) = `None`: Settings for which of the directory's files to upload.
- **UploadConfigFile.version** (`Literal['v1']`) = `'v1'`: Format of the upload config file, always `"v1"`.

### UploadConfigFileDatasetSection

```python
class roboto.upload_agent.files.UploadConfigFileDatasetSection(**data)
```

`from roboto.upload_agent.files import UploadConfigFileDatasetSection`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/upload_agent/files.py#L22-L43)

Bases: [`roboto.domain.datasets.CreateDatasetRequest`](/docs/reference/python-sdk/roboto/domain/datasets/operations#roboto.domain.datasets.operations.CreateDatasetRequest)

Settings for the dataset a directory is uploaded to, from the `dataset` section of an upload config file.

Carried in `UploadConfigFile.dataset`. The upload agent creates the dataset with `description`, `metadata` and `tags`, and ignores `name`, `device_id` and `custom_fields`. When [`process_uploads()`](/docs/reference/python-sdk/roboto/upload_agent/agent#roboto.upload_agent.agent.UploadAgent.process_uploads) merges every directory into one dataset (`roboto-agent run --merge-uploads`), it applies `description`, `metadata` and `tags` to that dataset as an update, and ignores `org_id` and `add_to_collections`. Building it raises `pydantic.ValidationError` when `name` is longer than 120 characters.

**Attributes**

- **UploadConfigFileDatasetSection.add_to_collections** (`List[str] | None`) = `None`: IDs of the collections to add the dataset to once its upload finishes. `None` adds it to none.

  The agent logs each collection it cannot add the dataset to and goes on to the next.

- **UploadConfigFileDatasetSection.org_id** (`str | None`) = `None`: Organization to create the dataset in.

  Required when the caller belongs to more than one organization; otherwise the caller's only organization.

### UploadConfigFileUploadSection

```python
class roboto.upload_agent.files.UploadConfigFileUploadSection(/, **data: Any)
```

`from roboto.upload_agent.files import UploadConfigFileUploadSection`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/upload_agent/files.py#L46-L66)

Bases: `pydantic.BaseModel`

Settings for which files the upload agent uploads, from the `upload` section of an upload config file.

Carried in `UploadConfigFile.upload`. Both pattern lists are passed to [`upload_directory()`](/docs/reference/python-sdk/roboto/domain/datasets/dataset#roboto.domain.datasets.dataset.Dataset.upload_directory), which describes how they match.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UploadConfigFileUploadSection.delete_uploaded_files** (`bool | None`) = `None`: Whether to delete the directory's local files once they are uploaded.

  `None` uses `UploadAgentConfig.delete_uploaded_files`.

- **UploadConfigFileUploadSection.exclude_patterns** (`List[str] | None`) = `None`: Gitignore-style patterns for the files to skip. `None` skips none.

  The agent never uploads its `.roboto_upload_in_progress.json` file, whatever the patterns.

- **UploadConfigFileUploadSection.include_patterns** (`List[str] | None`) = `None`: Gitignore-style patterns for the files to upload. `None` uploads every file; an empty list uploads none.

### UploadInProgressFile

```python
class roboto.upload_agent.files.UploadInProgressFile(/, **data: Any)
```

`from roboto.upload_agent.files import UploadInProgressFile`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/upload_agent/files.py#L131-L146)

Bases: `pydantic.BaseModel`

Contents of the file the upload agent writes into a directory when it starts uploading it.

The upload agent reads and writes it; nothing else does. The agent never uploads the file and deletes it once the upload finishes. A later run that finds one, after an upload was interrupted, resumes the upload to the dataset it names instead of creating a dataset; the agent ignores a file it cannot parse.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UploadInProgressFile.dataset_id** (`str`): ID of the dataset the directory is being uploaded to.
- **UploadInProgressFile.started** (`datetime.datetime`): Time the upload started, which the agent records as the time the dataset was created.
- **UploadInProgressFile.version** (`Literal['v1']`) = `'v1'`: Format of the file, always `"v1"`.
