Skip to content

Using Filesystem and Database

UClaw environments come equipped with virtual filesystem storage and transactional SQLite databases. This allows agents to persist application state, run SQL statements, and maintain code bases.

Filesystem Operations

Agents have direct access to their sandbox workspace filesystem.

Supported Tools

  • read(path): Retrieves the string content of a file.
  • write(path, content): Creates or replaces a file with the given content.
  • edit(path, targetContent, replacementContent): Edits a block of text in an existing file.
  • list(path): Lists the contents of a directory.
  • find(query): Performs a recursive filename lookup.
  • grep(query): Ripgrep-style searches for exact text strings within workspace files.

SQLite Database Operations

Each environment includes a complete, transaction-capable SQLite database.

SQL Tool Usage

Agents can run queries against their workspace database using the sql tool.

javascript
// Example schema created inside the agent's lifecycle
await sql`
  CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    email TEXT UNIQUE
  )
`;

To let your agent connect to external APIs and resolve credentials securely, check out the Connect with External APIs guide.