> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rerun.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Databases

> Read and write the private database of a coworker and the database shared by a workspace.

Each coworker has one private SQLite database that no other coworker can read. The workspace has a second database that every coworker in it reads and writes, whichever Box they sit in. These tools reach both, so you can lay out the tables a coworker works from before it ever runs.

It is plain SQLite. Column types are `TEXT`, `INTEGER`, `REAL`, `BLOB` or `NUMERIC`.

## Coworker database

### list\_tables

Structure of the coworker private database: every table with its columns, types, primary keys and not-null flags.

**agentId** `string` *required*

### db\_query

Runs a read-only `SELECT` and returns the rows. Anything that writes is refused here.

**agentId** `string` *required*

**sql** `string` *required*

A single `SELECT`, or `WITH … SELECT`.

**params** `array`

Values bound to the `?` placeholders, in order.

**limit** `number`

Maximum rows returned. Default `100`, maximum `1000`.

```json Request arguments theme={"system"}
{
  "agentId": "…",
  "sql": "SELECT email, created_at FROM leads WHERE status = ? ORDER BY created_at DESC",
  "params": ["new"],
  "limit": 50
}
```

Use `?` placeholders with `params` rather than pasting values into the SQL.

### db\_execute

Changes the coworker private database: `CREATE`, `ALTER`, `DROP` a table, or `INSERT`, `UPDATE`, `DELETE` rows.

**agentId** `string` *required*

**sql** `string`

A single statement.

**params** `array`

Values bound to the `?` placeholders in `sql`, in order.

**statements** `object[]`

Several statements applied atomically in one transaction. Each entry needs `sql` and may carry `params`. This is the right way to lay out a whole schema.

Pass either `sql` or `statements`. The call fails if you pass neither.

```json Request arguments theme={"system"}
{
  "agentId": "…",
  "statements": [
    { "sql": "CREATE TABLE IF NOT EXISTS leads (id INTEGER PRIMARY KEY, email TEXT NOT NULL, status TEXT)" },
    { "sql": "CREATE INDEX IF NOT EXISTS leads_status ON leads (status)" }
  ]
}
```

## Shared database

The same three operations, on the database every coworker of the workspace shares. Get the `spaceId` from [`list_spaces`](https://docs.rerun.build/api/tools/agents#list-spaces).

### list\_space\_tables

**spaceId** `string` *required*

### space\_db\_query

**spaceId** `string` *required*

**sql** `string` *required*

**params** `array`

**limit** `number`

Default `100`, maximum `1000`.

### space\_db\_execute

**spaceId** `string` *required*

**sql** `string`

**params** `array`

**statements** `object[]`

> [!WARNING]
>
> Every coworker of the workspace sees the result immediately. Prefer `CREATE TABLE IF NOT EXISTS`, extend with `ALTER TABLE ADD COLUMN`, and do not drop a table the coworkers already fill.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.