SQLite plugin for Crypto.com Agent Client
Project description
Crypto.com Agent Plugin – SQLite
The Crypto.com Agent Plugin – SQLite adds support for persistent state storage using SQLite in the Crypto.com Agent Client ecosystem. This plugin allows conversational agents to store, retrieve, and manage session states efficiently using a lightweight, file-based database.
Features
SQLite Integration
- Stores and retrieves agent conversation states using a local SQLite database.
- Supports fast, lightweight persistence — no external DB required.
- Automatically creates the database and schema if they don't exist.
- Ensures thread-safe database access via
check_same_thread=False.
Plugin Architecture
-
Packaged as a standalone Python plugin.
-
Implements the
AgentPluginstorage interface with full support for:save_state()load_state()delete_state()list_keys()
-
Uses Python entry points and PEP 621 standards (
pyproject.toml).
Easy to Install and Extend
- Fully decoupled from the core Agent SDK.
- Compatible with other plugins (e.g., Discord, LangFuse, CLI).
- Automatically discovered and initialized by the SDK.
Installation
Install the plugin into your environment:
pip install cryptocom-agent-plugin-sqlite
Usage
Importing the Plugin
from crypto_com_agent_plugin_sqlite import SQLitePlugin
Using with the Agent SDK
from crypto_com_agent_client import Agent
from crypto_com_agent_plugin_sqlite import SQLitePlugin
sqlite_plugin = SQLitePlugin(db_path="agent_state.db")
agent = Agent.init(
llm_config={...},
blockchain_config={...},
plugins={...},
plugin_instances=[sqlite_plugin],
)
agent.start()
Plugin Lifecycle
This plugin defines:
mode = "support"— it does not control the event loop; multiple support plugins can run together.save_state(state, key)— stores agent state for a specificsession_id:thread_id.load_state(key)— retrieves stored state by key.delete_state(key)— removes stored state.list_keys()— lists all session keys stored in the database.
Example
from crypto_com_agent_plugin_sqlite import SQLitePlugin
# Initialize storage
storage = SQLitePlugin(db_path="agent_state.db")
# Save a sample state
state = {
"messages": [
{"type": "HumanMessage", "content": "Hello!"}
]
}
storage.save_state(state, key="session1:thread1")
# Load the saved state
loaded = storage.load_state(key="session1:thread1")
print(loaded)
# List all saved keys
print(storage.list_keys())
# Delete the saved state
storage.delete_state("session1:thread1")
Entry Point Declaration
This plugin is auto-discoverable via pyproject.toml:
[tool.poetry.plugins."crypto_com_agent.plugins"]
sqlite = "crypto_com_agent_plugin_sqlite:SQLitePlugin"
This allows the Agent SDK to dynamically discover and initialize your plugin.
File Structure
crypto_com_agent_plugin_sqlite/
├── __init__.py
└── sqlite_plugin.py # Main plugin implementation
Contributing
We welcome contributions! Please ensure your plugin:
- Adheres to the
AgentPluginstorage interface. - Includes proper type hints, docstrings, and unit tests.
- Handles serialization and deserialization safely.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cryptocom_agent_plugin_sqlite-1.0.4-py3-none-any.whl.
File metadata
- Download URL: cryptocom_agent_plugin_sqlite-1.0.4-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e8f18f70b42539a1ab5ea605ed800b8de6f45e0a570a4ced051d2ce59930d42
|
|
| MD5 |
f844dddcdf3f9baed8e5c30a31c78007
|
|
| BLAKE2b-256 |
40cd57371b1225f8cb828aa94b69c8aa257fff18f569f2689f20b07b4539ee2b
|