Workspaces
A workspace stores data for particles. It has two halves:
- Key/value state: small string values under string keys, such as a cursor, a setting or a cached ID.
- Files: folders and files, such as documents, reports and data sets.
When you install a particle, you choose a workspace for its key/value state and one for each file mount its manifest declares. The install keeps the workspace’s ID, not its name, so you can rename a workspace without breaking the particles that use it. The ID is shown next to the scope on the workspace’s page.
To create a workspace, open Tools > Workspaces, press New workspace, and choose Global or Conversation. You can also create one from the workspace picker while you install a particle.
Quick Reference
Workspace
| Field | Purpose | Guidance |
|---|---|---|
| Name | Identifies the workspace | Unique. You can rename a workspace at any time. Installed particles refer to it by its ID, so a rename doesn’t affect them. |
| Scope | Who shares the data | Global: one set of keys and files, shared by every conversation and every install that uses the workspace. Conversation: each conversation gets its own copy, which starts empty. Chosen when you create the workspace. It can’t be changed. |
Browsing (Global scope)
| Field | Purpose | Guidance |
|---|---|---|
| Files | Folders and files | Browse folders, add a folder, upload files, download and delete. Drag files or whole folders onto the list to upload them. |
| Key/value | Keys and values | Search by key prefix, add a key, and view, edit, copy or delete a value. |
Key/value state
Use key/value state for small values that a particle reads and writes often.
A particle that uses it declares kv: { enabled: true } in its manifest. At install you choose the KV workspace. The particle then has four calls: get, set, delete, and list, which returns the keys that start with a prefix. The prefix match is exact and case-sensitive. Keys and values are strings.
The keys belong to the workspace, not to the install. Two installs that use the same KV workspace read and write the same keys. If you change an install’s KV workspace, its keys don’t move: the install sees the keys of the new workspace from then on.
Limits:
- A value is at most 64 KiB (65,536 bytes). Store anything larger in files.
- On the hosted service, a workspace holds at most 1,000 keys, and the workspaces of an organization hold at most 10,000 keys in all. A Conversation workspace holds 1,000 keys in each conversation.
- A write past a limit fails, and the particle gets a quota error.
Files
Use files for anything too large for a value, and for data a person adds or reads, such as source documents or generated reports.
A particle that uses files declares one or more mounts under filesystem.mounts. Each mount has a path inside the particle’s sandbox and an access of readonly or readwrite. At install you choose a workspace for each mount. The workspace’s top folder appears at the mount’s path, and the particle reads and writes it with ordinary file calls. A read-only mount refuses writes. Several mounts, and several installs, can use the same workspace.
A self-hosted Partite Mesh keeps workspace files only when FILESTORE_ROOT_DIR names a folder. Without it, workspaces have key/value state but no files: a particle with a mount fails when it runs, and the Files tab shows an error. See Self-Hosting.
Scopes
| Global | Conversation | |
|---|---|---|
| Data | One set of keys and files, shared by every conversation and every install that uses the workspace. | Each conversation has its own keys and files. One conversation can’t see another’s. |
| Starts as | Empty when you create it. You can add keys and files in the UI. | Empty in each conversation. A conversation’s copy is made the first time a particle uses the workspace in it. Nothing is copied into it. |
| Browse in the UI | Yes, on the Files and Key/value tabs. | No. Its page says each conversation has its own copy. |
| Removed | When you delete the workspace. | A conversation’s copy is removed when the conversation is deleted, by you or by retention. |
Use Global for reference data, settings and caches that every conversation should see. Use Conversation for scratch files and state that belong to one conversation.
The scope is set when you create the workspace. You can’t change it.
The GraphQL API can read and change one conversation’s copy of a Conversation workspace: give the conversation ID with the workspace ID.
Calls with no conversation
When you run a particle’s tool by hand on its page, there is no conversation. A Conversation workspace is then a temporary one: it starts empty, holds at most 1 MB of key/value state and 16 MB of files, and is removed when the call ends. A Global workspace is the real one, so a tool you run by hand can change its keys and files.
Download and upload links
On the Files tab, each download and each upload uses a link made for that one file. The link carries its own authorization: anyone who has it can use it until it expires. A link expires 2 minutes after it is made. A transfer that has started before then finishes. When you host Partite Mesh yourself, WORKSPACE_DOWNLOAD_LINK_TTL sets how long links work.
An upload never writes over a file. When you upload files that already exist, the page asks whether to replace them or skip them. Replacing deletes the old file first.
The GraphQL API makes the same links with workspaceFileDownload and createWorkspaceFileUpload. Send the file’s bytes to an upload link with PUT. The folder must exist and the file must not.
Deleting a workspace
You can’t delete a workspace that an installed particle uses. Choose another workspace on the install first.
When you delete a workspace, its keys and files are removed in the background. The copies that conversations have of a Conversation workspace stay until their conversations are deleted.
Related
- Particles: declare key/value state and mounts, and choose workspaces at install.
- Self-Hosting:
FILESTORE_ROOT_DIRandWORKSPACE_DOWNLOAD_LINK_TTL. - Configuration As Code: the
partiteai_workspaceresource. An install refers to it withkv_workspace_idandmounts[].workspace_idonpartiteai_installed_particle.