Skip to main content

Overview

Workspaces provide agents with an isolated sandbox file system. When an agent uses agent reasoning mode, it has access to built-in file tools (write, read, edit, grep, delete) that operate on workspace files.
Workspaces must be enabled for agents to use file tools, edit mode (chat_mode: 'edit'), and plan mode (chat_mode: 'plan'). When workspace is disabled, these tools are removed and chat mode falls back to ask.
Each workspace is scoped per-agent and per-user:
  • Authenticated users — each user gets their own workspace per agent
  • Anonymous users — each chat conversation gets an isolated workspace

Built-in File Tools

When an agent runs in agent reasoning mode, these tools are automatically available:
ToolDescriptionApproval
writeCreate or overwrite a fileConditional
readRead file content (supports line ranges)Auto
editExact string replacement in a fileConditional
grepRegex search across workspace filesAuto
deleteSoft-delete a fileConditional
Tools marked “Conditional” require user approval before execution (configurable per agent). Tools marked “Auto” execute without approval.

write

Create a new file or overwrite an existing one:
ParameterTypeRequiredDescription
file_pathstringYesVirtual file path (e.g., /src/app.js)
contentstringYesFull file content
languagestringNoProgramming language hint

read

Read a file’s content, optionally by line range:
ParameterTypeRequiredDescription
file_pathstringYesVirtual file path to read
start_lineintegerNoStart line (1-based)
end_lineintegerNoEnd line (1-based, inclusive)

edit

Apply an exact string replacement to a file:
ParameterTypeRequiredDescription
file_pathstringYesVirtual file path to edit
old_stringstringYesExact text to find (must match uniquely)
new_stringstringYesReplacement text (empty string to delete)

grep

Search across workspace files using regex:
ParameterTypeRequiredDescription
patternstringYesSearch pattern (regex supported)
file_pathstringNoRestrict to a specific file
includestringNoFile extension filter (e.g., .js)

delete

Remove a file from the workspace (soft delete):
ParameterTypeRequiredDescription
file_pathstringYesVirtual file path to delete

REST API

Manage workspaces and files programmatically. All endpoints require API key authentication.

List Workspaces

GET /v1/bot/workspace/readall?project_id={project_id}&bot_id={bot_id}
Response:
{
  "workspaces": [
    {
      "uuid": "ws_abc123",
      "name": "Default",
      "is_default": 1,
      "created_at": "2026-02-01T12:00:00Z"
    }
  ]
}

Create Workspace

POST /v1/bot/workspace/create
ParameterTypeRequiredDescription
project_idstringYesProject ID
bot_idstringYesBot ID
namestringYesWorkspace name
descriptionstringNoWorkspace description

Delete Workspace

DELETE /v1/bot/workspace/delete?project_id={project_id}&bot_id={bot_id}&workspace_uuid={uuid}
The default workspace cannot be deleted.

List Files

GET /v1/bot/workspace/files?project_id={project_id}&bot_id={bot_id}&workspace_uuid={uuid}
Response:
{
  "files": [
    {
      "uuid": "file_xyz",
      "file_path": "/src/app.js",
      "language": "javascript",
      "version": 3,
      "created_at": "2026-02-01T12:00:00Z"
    }
  ]
}

Read File

GET /v1/bot/workspace/file?project_id={project_id}&bot_id={bot_id}&workspace_uuid={uuid}&file_uuid={file_uuid}

Create File

POST /v1/bot/workspace/file
ParameterTypeRequiredDescription
project_idstringYesProject ID
bot_idstringYesBot ID
workspace_uuidstringYesWorkspace UUID
file_pathstringYesVirtual file path (e.g., /src/app.js)
contentstringNoFile content
languagestringNoProgramming language

Update File

PUT /v1/bot/workspace/file
ParameterTypeRequiredDescription
project_idstringYesProject ID
bot_idstringYesBot ID
workspace_uuidstringYesWorkspace UUID
file_uuidstringYesFile UUID
contentstringYesNew file content

Delete File

DELETE /v1/bot/workspace/file?project_id={project_id}&bot_id={bot_id}&workspace_uuid={uuid}&file_uuid={file_uuid}

Rename/Move File

PUT /v1/bot/workspace/file/rename
ParameterTypeRequiredDescription
project_idstringYesProject ID
bot_idstringYesBot ID
workspace_uuidstringYesWorkspace UUID
old_pathstringYesCurrent file path
new_pathstringYesNew file path
is_folderbooleanNoMove all files under path prefix (folder rename)

Next Steps

Chat API

Send messages and receive AI responses

API Reference

Complete API documentation