{"id":37024376,"url":"https://github.com/sqliteai/sqlite-agent","last_synced_at":"2026-04-07T15:00:41.614Z","repository":{"id":328799647,"uuid":"1100621926","full_name":"sqliteai/sqlite-agent","owner":"sqliteai","description":"A SQLite extension that enables SQLite databases to run autonomous AI agents, using other SQLite AI extensions.","archived":false,"fork":false,"pushed_at":"2026-04-01T11:58:25.000Z","size":2683,"stargazers_count":23,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-04-01T13:34:53.362Z","etag":null,"topics":["agent","ai","sqlite","sqlite-agent"],"latest_commit_sha":null,"homepage":"https://sqlite.ai","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sqliteai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-20T14:28:13.000Z","updated_at":"2026-04-01T11:58:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sqliteai/sqlite-agent","commit_stats":null,"previous_names":["sqliteai/sqlite-agent"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/sqliteai/sqlite-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqliteai%2Fsqlite-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqliteai%2Fsqlite-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqliteai%2Fsqlite-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqliteai%2Fsqlite-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sqliteai","download_url":"https://codeload.github.com/sqliteai/sqlite-agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqliteai%2Fsqlite-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31516839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai","sqlite","sqlite-agent"],"created_at":"2026-01-14T02:56:50.089Z","updated_at":"2026-04-07T15:00:41.549Z","avatar_url":"https://github.com/sqliteai.png","language":"C","readme":"# SQLite Agent\n\n**SQLite Agent** is a cross-platform SQLite extension that brings autonomous AI agents to your database. It enables databases to run multi-step, tool-using agents that fetch data from external sources (web, APIs, etc.) through [sqlite-mcp](https://github.com/sqliteai/sqlite-mcp) and populate database tables. The extracted data can then be analyzed by LLMs, displayed in UIs, or used in applications.\n\n## Highlights\n\n* **Autonomous Agents** – Run AI agents that can plan and execute multi-step tasks\n* **MCP Integration** – Works with [sqlite-mcp](https://github.com/sqliteai/sqlite-mcp) for external tool access\n* **AI Powered** – Uses [sqlite-ai](https://github.com/sqliteai/sqlite-ai) for LLM inference and embeddings\n* **Table Extraction Mode** – Automatically fetch and populate database tables\n* **Auto-Embeddings** – Optionally uses [sqlite-vector](https://github.com/sqliteai/sqlite-vector) to generate vector embeddings automatically when inserting data for BLOB columns named `*_embedding`\n* **Auto-Vector Indexing** – Initialize vector search indices automatically\n\n## 🚀 Quick Start\n\n### Installation\n\n#### Pre-built Binaries\n\nDownload the appropriate pre-built binary for your platform from the [Releases](https://github.com/sqliteai/sqlite-agent/releases) page: we do support **Linux**, **macOS**, **Windows**, **Android** and **iOS**.\n\n#### Swift Package\n\nYou can [add this repository as a package dependency to your Swift project](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app#Add-a-package-dependency). After adding the package, you'll need to set up SQLite with extension loading by following steps 4 and 5 of [this guide](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/platforms/ios.md#4-set-up-sqlite-with-extension-loading).\n\nHere's an example of how to use the package:\n```swift\nimport agent\n\n...\n\nvar db: OpaquePointer?\nsqlite3_open(\":memory:\", \u0026db)\nsqlite3_enable_load_extension(db, 1)\nvar errMsg: UnsafeMutablePointer\u003cInt8\u003e? = nil\nsqlite3_load_extension(db, agent.path, nil, \u0026errMsg)\nvar stmt: OpaquePointer?\nsqlite3_prepare_v2(db, \"SELECT agent_version()\", -1, \u0026stmt, nil)\ndefer { sqlite3_finalize(stmt) }\nsqlite3_step(stmt)\nlog(\"agent_version(): \\(String(cString: sqlite3_column_text(stmt, 0)))\")\nsqlite3_close(db)\n```\n\n#### Android Package\n\nAdd the [following](https://central.sonatype.com/artifact/ai.sqlite/agent) to your Gradle dependencies:\n\n```gradle\nimplementation 'ai.sqlite:agent:0.1.3'\n```\n\nHere's an example of how to use the package:\n```java\nSQLiteCustomExtension agentExtension = new SQLiteCustomExtension(getApplicationInfo().nativeLibraryDir + \"/agent\", null);\nSQLiteDatabaseConfiguration config = new SQLiteDatabaseConfiguration(\n    getCacheDir().getPath() + \"/agent_test.db\",\n    SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.OPEN_READWRITE,\n    Collections.emptyList(),\n    Collections.emptyList(),\n    Collections.singletonList(agentExtension)\n);\nSQLiteDatabase db = SQLiteDatabase.openDatabase(config, null, null);\n```\n\n**Note:** Additional settings and configuration are required for a complete setup. For full implementation details, see the [complete Android example](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/examples/android/README.md).\n\n#### Flutter Package\n\nAdd the [sqlite_agent](https://pub.dev/packages/sqlite_agent) package to your project:\n\n```bash\nflutter pub add sqlite_agent  # Flutter projects\ndart pub add sqlite_agent     # Dart projects\n```\n\nUsage with `sqlite3` package:\n```dart\nimport 'package:sqlite3/sqlite3.dart';\nimport 'package:sqlite_agent/sqlite_agent.dart';\n\nsqlite3.loadSqliteAgentExtension();\nfinal db = sqlite3.openInMemory();\nprint(db.select('SELECT agent_version()'));\n```\n\nFor a complete example, see the [Flutter example](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/examples/flutter/README.md).\n\n### Basic Usage\n\n```sql\n-- Load required extensions\nSELECT load_extension('./dist/mcp');\nSELECT load_extension('./dist/ai');\nSELECT load_extension('./dist/agent');\n\n-- Initialize AI model\nSELECT llm_model_load('/path/to/model.gguf', 'gpu_layers=99');\n\n-- Connect to MCP server\nSELECT mcp_connect('http://localhost:8000/mcp');\n\n-- Run an autonomous agent (text-only mode)\nSELECT agent_run('Find affordable apartments in Rome with AC', 8);\n-- Agent uses MCP tools to accomplish the task and returns result\n```\n\n## 📖 API Reference\n\n### Available Functions\n\n| Function | Description |\n|----------|-------------|\n| `agent_version()` | Returns extension version |\n| `agent_run(goal, [table_name], [max_iterations], [system_prompt])` | Run autonomous AI agent |\n\nSee [API.md](API.md) for complete API documentation with examples.\n\n## Example: AirBnb MCP Server\n\nThis example demonstrates combining agent, MCP, AI, and vector extensions:\n\n```sql\n-- Load all extensions\n.load ../sqlite-mcp/dist/mcp\n.load ./dist/agent\n.load ../sqlite-ai/dist/ai\n.load ../sqlite-vector/dist/vector\n\n-- Initialize AI model (one-time)\nSELECT llm_model_load('/path/to/model.gguf', 'gpu_layers=99');\n\n-- Connect to MCP server (one-time)\nSELECT mcp_connect('http://localhost:8000/mcp');\n\n-- Create table with embedding column\nCREATE TABLE listings (\n  id INTEGER PRIMARY KEY,\n  title TEXT,\n  description TEXT,\n  location TEXT,\n  property_type TEXT,\n  amenities TEXT,\n  price REAL,\n  rating REAL,\n  embedding BLOB\n);\n\n-- Run agent to fetch and populate data\n-- Embeddings and vector index are created automatically!\nSELECT agent_run(\n  'Find affordable apartments in Rome under 100 EUR per night',\n  'listings',\n  8\n);\n-- Returns: 5 (number of rows inserted)\n\n-- Semantic search (works immediately!)\nSELECT title, location, price, v.distance\nFROM vector_full_scan('listings', 'embedding',\n  llm_embed_generate('cozy modern apartment', ''), 5) v\nJOIN listings l ON l.rowid = v.rowid\nORDER BY v.distance ASC;\n```\n\nRun the full demo:\n```bash\nmake airbnb #first place a .gguf model inside the models folder and run your AirBnb MCP server\n```\nSee [USAGE.md](USAGE.md) for complete usage examples.\n\n## How It Works\n\nThe agent operates through an iterative loop:\n\n1. Receives goal and available tools from MCP\n2. Decides which tool to call\n3. Executes tool via sqlite-mcp extension\n4. Receives tool result\n5. Continues until goal achieved or max iterations reached\n6. Returns final result\n\n## Support\n\n- [GitHub Issues](https://github.com/sqliteai/sqlite-agent/issues)\n- [SQLite Extension Load Guide](https://github.com/sqliteai/sqlite-extensions-guide)\n\n---\n\n## License\n\nThis project is licensed under the [Elastic License 2.0](./LICENSE). You can use, copy, modify, and distribute it under the terms of the license for non-production use. For production or managed service use, please [contact SQLite Cloud, Inc](mailto:info@sqlitecloud.io) for a commercial license.\n\n---\n\n## Part of the SQLite AI Ecosystem\n\nThis project is part of the **SQLite AI** ecosystem, a collection of extensions that bring modern AI capabilities to the world’s most widely deployed database. The goal is to make SQLite the default data and inference engine for Edge AI applications.\n\nOther projects in the ecosystem include:\n\n- **[SQLite-AI](https://github.com/sqliteai/sqlite-ai)** — On-device inference and embedding generation directly inside SQLite.\n- **[SQLite-Memory](https://github.com/sqliteai/sqlite-memory)** — Markdown-based AI agent memory with semantic search.\n- **[SQLite-Vector](https://github.com/sqliteai/sqlite-vector)** — Ultra-efficient vector search for embeddings stored as BLOBs in standard SQLite tables.\n- **[SQLite-Sync](https://github.com/sqliteai/sqlite-sync)** — Local-first CRDT-based synchronization for seamless, conflict-free data sync and real-time collaboration across devices.\n- **[SQLite-Agent](https://github.com/sqliteai/sqlite-agent)** — Run autonomous AI agents directly from within SQLite databases.\n- **[SQLite-MCP](https://github.com/sqliteai/sqlite-mcp)** — Connect SQLite databases to MCP servers and invoke their tools.\n- **[SQLite-JS](https://github.com/sqliteai/sqlite-js)** — Create custom SQLite functions using JavaScript.\n- **[Liteparser](https://github.com/sqliteai/liteparser)** — A highly efficient and fully compliant SQLite SQL parser.\n\nLearn more at **[SQLite AI](https://sqlite.ai)**.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqliteai%2Fsqlite-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsqliteai%2Fsqlite-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqliteai%2Fsqlite-agent/lists"}