Esta página no está disponible en español. Se muestra la versión en inglés.

SQLite connector

Query, inspect, and (optionally) update SQLite database files from AgentRuntime workflow steps.

En esta página

SQLite is a small database that lives in a single .db file. The sqlite connector lets a workflow read that file with SQL, look at its tables, views, and indexes, preview rows, and, if you allow it, change data. Typical uses are a local reporting database, an embedded app's data, a prototype you are not ready to move to Postgres or MySQL, and exploring an unfamiliar schema.

Nota

The connector opens the file on the machine where the connector runs. It reads and updates existing database files; it does not create new ones. Make sure your deployment can reach the file you want to use before you set this up.

Prerequisites

  • An existing SQLite database file (.db) that the connector can reach, and its path.
  • The project_contributor role or higher in your project.
  • Optional: a root folder you want to restrict access to (sqlite_data_root).
  • Only if workflows must change data: a decision to turn on sqlite_allow_write. It is off by default.

This connector needs no account or password. All its settings are plain configuration values.

Connect in AgentRuntime

  1. Add the connector

    Click MCP in the sidebar, click Add connectors, find sqlite, select it, and click Add to workspace.

  2. Open Instance config

    Open the new instance. On Instance config, under Profiles for this connector, click New profile and enter a Display name.

  3. Enter the settings

    In the credentials section, choose Type secrets on this screen and fill in the fields from Configuration. At minimum set sqlite_default_database_path to your file, for example /data/app/metrics.db. Leave sqlite_allow_write empty or false for a read-only setup.

  4. Make the profile active

    Set Status to Active — can be used in workflows, click Save, then click Use this profile for workflows. The profile shows an active badge.

  5. Test it in a workflow

    In Workflow Studio, add a connector tool step for this instance and choose sqlite_get_database_info. Run it. A successful result shows the resolved database_path and the sqlite_version.

See MCP instances for more on profiles.

What you can build

  • Metrics report. Run sqlite_query on a schedule to pull daily totals, summarize them with an LLM step, and post the summary to a channel.
  • Schema explorer for an agent. Give an agent sqlite_list_tables and sqlite_describe_table, so it can learn the shape of a database before it writes its own SELECT.
  • Quick data checks. Use sqlite_sample_table_rows to preview a table, or sqlite_get_table_schema to confirm columns and indexes before a migration.
  • Lightweight ETL. With sqlite_allow_write on, load cleaned rows into a staging table with sqlite_execute, then verify them with sqlite_query.

Tools

Every tool accepts database_path. Pass an empty string to use sqlite_default_database_path.

Read

ToolWhat it does
sqlite_get_database_infoReturns the resolved file path, the SQLite version, and the attached databases
sqlite_queryRuns one read-only statement and returns columns, rows, and row_count
sqlite_list_tablesLists the user tables
sqlite_list_viewsLists the views
sqlite_describe_tableLists a table's columns (table_name required)
sqlite_get_table_schemaReturns a table's columns and indexes (table_name required)
sqlite_list_indexesLists the indexes on a table (table_name required)
sqlite_sample_table_rowsPreviews rows from a table (table_name required, optional limit, default 10)

Write

These change data and fail unless sqlite_allow_write is true.

ToolWhat it does
sqlite_executeRuns one statement that may change data (INSERT, UPDATE, DELETE, or schema changes). Returns rows_affected and last_insert_id
sqlite_execute_sqlThe same as sqlite_execute under a second name

Example

Report the last seven days of sales from a read-only database:

{
  "id": "daily_sales",
  "type": "mcp",
  "name": "Daily sales total",
  "tool_name": "sqlite_query",
  "tool_args": {
    "database_path": "",
    "sql": "SELECT date(created_at) AS day, SUM(amount) AS total FROM orders GROUP BY day ORDER BY day DESC LIMIT 7"
  },
  "timeout_s": 30
}

Studio fills in instance_id when you pick the instance. Later steps read the result with {{steps.daily_sales.result.rows}}.

sqlite_query accepts a single statement that starts with SELECT or PRAGMA. A statement containing a semicolon is rejected, and so is one that starts with WITH.

Configuration

Set these on the profile's Instance config screen. All are optional.

KeyDefaultDescription
sqlite_data_rootnoneA root folder. When set, every database path must resolve to a location inside it
sqlite_default_database_pathnoneThe .db file used when a tool call leaves database_path empty
sqlite_query_timeout_seconds30Time limit for one query, in seconds
sqlite_max_rows1000The most rows a read query or row preview returns. Extra rows are dropped without an error
sqlite_allow_writefalseSet to true to allow sqlite_execute and sqlite_execute_sql

Troubleshooting

IssueFix
database_path is required (or set sqlite_default_database_path)Pass database_path in the step, or set sqlite_default_database_path on the profile
database path must be under sqlite_data_rootUse a file inside the configured root, or change sqlite_data_root
sqlite_execute is disabled (set sqlite_allow_write=true)Set sqlite_allow_write to true on the active profile, save, and run again
sqlite_query only allows SELECT, PRAGMA, or WITH statementsSend a single statement that starts with SELECT or PRAGMA, without a semicolon. For anything that changes data use sqlite_execute
invalid table_nameTable names must use only letters, digits, and underscores, and not start with a digit
Fewer rows than expectedThe result was cut at sqlite_max_rows. Raise it or add a WHERE or LIMIT to narrow the query
database is lockedAnother process is writing to the file. The connector retries a few times before it fails; run the step again later
The file cannot be openedCheck the path exists where the connector runs. The connector does not create database files
Editar esta páginaagentruntime-io/agentruntime-docs