Pre-release
This release is a pre-release and may not be stable for production use.
elizaOS SQL Plugin (Python)
The Python implementation of the elizaOS SQL Plugin - PostgreSQL and PGLite database adapters for elizaOS agents.
Installation
pip install elizaos-plugin-sql
Features
- PostgreSQL adapter with vector search support via pgvector
- PGLite adapter for lightweight local development
- SQLAlchemy ORM with async support
- Automatic migrations using Alembic
- Runtime migration service compatible with TypeScript RuntimeMigrator
- Plugin schema namespacing for isolation
- Vector embeddings for semantic search
- Full type safety with Pydantic models
Quick Start
PostgreSQL
from elizaos import AgentRuntime, Character
from elizaos_plugin_sql import PostgresAdapter
# Create the database adapter
adapter = PostgresAdapter(
connection_string="postgresql+asyncpg://user:pass@localhost/db",
agent_id="12345678-1234-1234-1234-123456789012",
)
# Create the runtime with the adapter
character = Character(name="Agent", bio="A helpful agent")
runtime = AgentRuntime(
character=character,
adapter=adapter,
)
await runtime.initialize()
PGLite (Local Development)
from elizaos import AgentRuntime, Character
from elizaos_plugin_sql import PGLiteAdapter
# Create a local PGLite adapter
adapter = PGLiteAdapter(
data_dir="./data/pglite",
agent_id="12345678-1234-1234-1234-123456789012",
)
character = Character(name="Agent", bio="A helpful agent")
runtime = AgentRuntime(
character=character,
adapter=adapter,
)
await runtime.initialize()
Schema
The plugin provides the following database tables:
agents- Agent configurationsentities- Users and other entitiescomponents- Entity componentsrooms- Conversation roomsworlds- World containersmemories- Stored memories/messagesembeddings- Vector embeddingsrelationships- Entity relationshipstasks- Task queuecache- Key-value cachelogs- Activity logs
Migration System
The package includes a migration service compatible with the TypeScript RuntimeMigrator:
from elizaos_plugin_sql import MigrationService, derive_schema_name
# Create migration service
migration_service = MigrationService(engine)
await migration_service.initialize()
# Get migration status
status = await migration_service.get_status("@your-org/plugin-name")
# Derive schema name for plugin isolation
schema_name = derive_schema_name("@your-org/plugin-name")
# Returns: "your_org_plugin_name"
Running Alembic Migrations
# Set database URL
export POSTGRES_URL="postgresql+asyncpg://user:pass@localhost/db"
# Generate a new migration
alembic revision --autogenerate -m "Add new table"
# Apply migrations
alembic upgrade head
# Rollback
alembic downgrade -1
Development
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run migration tests
pytest tests/test_migrations.py
# Type checking
mypy elizaos_plugin_sql
# Linting
ruff check elizaos_plugin_sql
License
MIT
Metadata
Release files for elizaos-plugin-sql 2.0.0a5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| elizaos_plugin_sql-2.0.0a5.tar.gz | 19.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| elizaos_plugin_sql-2.0.0a5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.1 kB
Release files / elizaos_plugin_sql-2.0.0a5.tar.gz
| Download URL | elizaos_plugin_sql-2.0.0a5.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
84c6f14d05c9be30f844b3ad7947452435f2306c5287023816f1e216fe6408b2
|
|
BLAKE2b-256 checksum How to use checksums |
a4bf6aaa56a0ae754a3a8cf6d9225defe8472baa71c1a0f5646c0ba4e88fb9f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / elizaos_plugin_sql-2.0.0a5-py3-none-any.whl
| Download URL | elizaos_plugin_sql-2.0.0a5-py3-none-any.whl |
|---|---|
| Size | 18.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40001092521dd6c86420d3d9fbac077e9c844e48a20cf4a84bc11e7c9ec8fccc
|
|
BLAKE2b-256 checksum How to use checksums |
9bdd1807fa46f421aad7405da2c24bc5333cb667a31187f997da4e9613f0746a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|