Workspaces and the skill library
Each hosted conversation can have a workspace: a set of files that belongs to that thread. The agent reads and changes them with its file tools while it works, and people browse and edit them through the API. The terminal client works in a local folder instead; see Terminal client. Skills live in the hosted skill library; see Skills.
Turning workspaces on
Section titled “Turning workspaces on”Workspaces need hosted threads (THREADS and FELIX_API_TOKEN) and one R2 bucket, bound as
WORKSPACES:
"r2_buckets": [ { "binding": "WORKSPACES", "bucket_name": "felix-workspaces" }]apps/api/wrangler.jsonc declares it in every environment. Create the bucket before deploying
(wrangler r2 bucket create felix-workspaces). Without the binding, /health does not report
workspace, runs get no file tools, and the workspace routes answer
503 workspace_not_configured. With it, /health reports workspace: true.
Small text files are kept with the thread; larger and binary files are stored in the bucket. Deleting a thread deletes its workspace and the stored files nothing else uses.
| Limit | Value |
|---|---|
| Files per thread | 2,000 |
| Bytes per thread | 50 MiB |
| Bytes per file | 5 MiB |
| Path length | 512 characters |
Paths are relative and /-separated, with no leading /, no . or .. segments, no backslashes
and no control characters. Folders are the prefixes of file paths; a path is a file or a folder,
never both.
What the agent can do
Section titled “What the agent can do”A run on a hosted thread gets these tools over that thread’s workspace, with the same names and arguments as the terminal’s file tools:
| Tool | Does |
|---|---|
read_file {path, start_line?, limit?} |
Reads up to 200 numbered lines (limit up to 2,000) within 50 KB per call; PNG, JPEG, GIF and WebP come back as images when IMAGES is bound. |
list_files {path?, limit?} |
Lists a folder’s files and folders. |
find_files {pattern, path?, limit?} |
Finds files by glob, such as *.ts, src/**/*.test.ts or *.{ts,tsx}; a glob without capital letters matches either case. |
grep_files {pattern, path?, glob?, ignore_case?, literal?, context?, limit?} |
Searches text files with a regular expression, at most 32 MiB per call. |
write_file {path, content} |
Creates or replaces a text file. |
edit_file {path, old_text, new_text} or {path, edits} |
Replaces text that matches exactly once; all edits or none, and an edit that changes nothing fails. |
delete_file {path} |
Deletes a file, or a folder and everything in it. |
rename_file {from, to} |
Moves a file or folder; never overwrites. |
save_image {ref, path} |
Copies an image the conversation already has (one a tool generated or read, by its sha256: reference) into the workspace at path, its extension set to the image’s type. Offered when IMAGES is bound; the image must be one the person may use. |
The four reads run in plan mode; the writes do not. Admins can turn any of them off, and an
agent’s tool list narrows them like any other tool (they are listed with the deployment’s
configured tools). No approval is required by default, because the workspace belongs to the
conversation and every change can be rewound; an approval rule that names a tool, such as
write_file, still applies to it. A delegated child agent can be granted the read tools, never the
writes. A client that brings its own tools with these names, such as the terminal attached to a
hosted Felix, keeps its own.
Browsing and editing files
Section titled “Browsing and editing files”The thread’s owner, admins and the operator token can read and change a workspace:
| Route | Does |
|---|---|
GET /v1/threads/{id}/workspace |
Every file with its size, SHA-256 and update time, and the limits. |
GET /v1/threads/{id}/workspace/file?path=… |
One file: text as is, anything else base64, with its content type. |
PUT /v1/threads/{id}/workspace/file |
{path, content, encoding?, expectSha?} writes a file. |
DELETE /v1/threads/{id}/workspace/file?path=… |
Deletes a file or folder. |
POST /v1/threads/{id}/workspace/rename |
{from, to, expectSha?} moves a file or folder. |
POST /v1/threads/{id}/workspace/edited |
{paths} tells the next run that files changed. |
Send back the sha256 you read as expectSha to save safely: if the file changed since, the write
is refused with 409 workspace_changed and nothing is lost. expectSha: null refuses a write when
the file already exists. A change made through these routes tells the conversation’s next run
which files a person changed (their paths, never their contents), so the agent reads them again.
Each change is recorded in the audit log as workspace_written, workspace_deleted or
workspace_renamed with its path and size; file contents are never logged.
Rewinding files
Section titled “Rewinding files”Before a file’s first change after each prompt, the workspace keeps its earlier version. Rewinding
a thread past prompts (POST /v1/threads/{id}/rewind) answers with files.changed, the files those
prompts changed. With "restoreFiles": true, each is put back as it was before the first of those
prompts, and a file they created is removed; files.restored and files.failed say which were and
which could not be, with the reason. Up to 500 earlier versions are kept per thread, the oldest
dropped first. A fork copies the workspace’s files as they are, but not their earlier versions.
© Felix. All rights reserved.