# SQLite
A plugin that provides SQLite database integration for Agent Smith, enabling AI agents to read and write data through natural language queries with schema awareness.
## Install
```bash
npm i -g @agent-smith/feat-sqlite
```
Add the plugin to your `config.yml` file and run the `conf` command:
```yml
plugins:
- "@agent-smith/feat-sqlite"
```
```bash
lm conf
```
## Actions and tools
### Database operations
Available tools:
- sqlquery Read data or write in the database. This tool is aware of the database schema and can read and write everything (requires `dbpath` variable)
- sqlreadquery Read data in the database by asking a question in natural language. Schema-aware read-only access (requires `dbpath` variable)
## Agents
Available agents:
- runsqliteagent Full read/write SQLite database assistant. Decomposes user questions and delegates tasks to tools. Lists tools used:
- `sqlquery` — schema-aware read and write database operations
- runsqlitereadagent Read-only SQLite database reader assistant. Analyzes questions and executes read queries safely. Lists tools used:
- `sqlreadquery` — schema-aware read-only database queries
## Example agent
```yaml
description: Sqlite read only agent
model: qwen4b
toolsList:
- sqlreadquery
variables:
required:
dbpath:
description: The database path
```
## Security
Read operations use readonly database connections for safety. Write operations require user confirmation via interactive prompts (`@inquirer/prompts`). Query execution is wrapped in transactions via `better-sqlite3`'s transaction API for atomicity.
Back: Overview