eliza icon indicating copy to clipboard operation
eliza copied to clipboard

switch agent from sqlite to postgres

Open Icarus-Community opened this issue 7 months ago • 5 comments

Describe the bug

i have an agent running in V2 dev mode. Now i want to set the postgres db for the agent. i added the adapter-postgres and added it to .env like this

POSTGRES_URL=postgresql://neondb_owner:*****@royal-sound-a2hlzmuj-pooler.eu-central-1.aws.neon.tech/supahdev?sslmode=require

just like the eliza.how and the llm file states.

But my agent keeps loading the Sqlite db instead of the postgres db.

Expected behavior

the postgress to be used for the agent

Additional context

hope someone can point me to the proper way to change the agent from sqlite to postgress

Icarus-Community avatar May 21 '25 19:05 Icarus-Community

Hello @Icarus-Community! Welcome to the elizaOS community. Thank you for opening your first issue; we appreciate your contribution. You are now an elizaOS contributor!

github-actions[bot] avatar May 21 '25 19:05 github-actions[bot]

Or should i just delete the db.sqlite file so the systems does not default load that one?

Icarus-Community avatar May 21 '25 19:05 Icarus-Community

If it is locating the .env and the plugin has been added to the character or plugins array of your project then it should definitely work. Do you have a project or reproducible demo of this?

lalalune avatar May 23 '25 00:05 lalalune

i had it added to the character and .env is this the properway? i got it from eliza.how - usually the settings dont need "" in .env so it trows me off a bit.

POSTGRES_URL="postgresql://neondb_owner:np*****G2Vy5@ep-royal-sound-a2hl******er.eu-central-1.aws.neon.tech/supahdev?sslmode=require"

i now installed the plugin and get the following error.

Failed to import plugin: @elizaos-plugins/adapter-postgres file:///root/elizaos/eliza/packages/adapter-postgres/dist/index.js:4 import { DatabaseAdapter, EmbeddingProvider, elizaLogger, getEmbeddingConfig } from "@elizaos/core-plugin-v1"; ^^^^^^^^^^^^^^^ SyntaxError: The requested module '@elizaos/core-plugin-v1' does not provide an export named 'DatabaseAdapter' at ModuleJob._instantiate (node:internal/modules/esm/module_job:182:21) at async ModuleJob.run (node:internal/modules/esm/module_job:266:5) at async onImport.tracePromise.proto (node:internal/modules/esm/loader:644:26) at async file:///root/elizaos/eliza/agent/src/index.ts:302:40 at async Promise.all (index 8) at async handlePluginImporting (file:///root/elizaos/eliza/agent/src/index.ts:300:33) at async jsonToCharacter (file:///root/elizaos/eliza/agent/src/index.ts:180:25) at async loadCharacterTryPath (file:///root/elizaos/eliza/agent/src/index.ts:239:27) at async loadCharacters (file:///root/elizaos/eliza/agent/src/index.ts:274:35) at async startAgents (file:///root/elizaos/eliza/agent/src/index.ts:639:22)

Icarus-Community avatar May 23 '25 06:05 Icarus-Community

tried installing Supabase to test that adapter and it threw the same error.

Icarus-Community avatar May 24 '25 21:05 Icarus-Community

@Icarus-Community no need for adapter-postgres on 1.x version. You just have to setup your url:

POSTGRES_URL="postgresql://neondb_owner:np*****G2Vy5@ep-royal-sound-a2hl******er.eu-central-w1.aws.neon.tech/supahdev?sslmode=require"

If you wanna look where database is https://github.com/elizaOS/eliza/blob/v2-develop/packages/plugin-sql/src/index.ts#L86

Basically for POSTGRES_URL you can provider any postgres instance, cloud based like supabase, neon,tech and similar.

0xbbjoker avatar May 31 '25 23:05 0xbbjoker