[BUG] [HELP] Postgres Storage is not working #2639
-
I have followed the docs and the cookbook. But the storage conversations are not being stored in the db. I have run the following Docker command,
Docs are outdated I guess but there is already a PR raised for it. It is "agnohq" and not "agno". The following contains the necessary functions from my code. I have two different databases. One for querying(SQL agent) and one for storage.
My code works as it should but I dont see anything being saved on the DB. Wanted to understand this first before I dived into how I could handle different sessions(or pass session to an agent or storage?) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hey @Anan7Codes Thank you for reaching out and for using Agno! We sincerely apologize for missing your query yesterday. We're prioritizing resolving this bug and will get back to you asap. Thank you for your patience! |
Beta Was this translation helpful? Give feedback.
-
Hey @Anan7Codes, can you first confirm me this- ![]() And yes, thanks for pointing out, the model storage docs are not update, we'll get to it asap. from agno.storage.postgres import PostgresStorage instead of from agno.storage.agent.postgres import PostgresAgentStorage Here's the code i used to test if things are getting saved- """Run `pip install duckduckgo-search sqlalchemy openai` to install dependencies."""
from agno.agent import Agent
from agno.models.anthropic import Claude
from agno.storage.postgres import PostgresStorage
from agno.tools.duckduckgo import DuckDuckGoTools
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
agent = Agent(
model=Claude(id="claude-3-5-sonnet-20241022"),
storage=PostgresStorage(table_name="agent_sessions", db_url=db_url),
tools=[DuckDuckGoTools()],
add_history_to_messages=True,
)
agent.print_response("How many people live in Canada?")
agent.print_response("What is their national anthem called?") Let me know if this solves it? |
Beta Was this translation helpful? Give feedback.
-
@Anan7Codes here's a loom walkthrough with somewhat of the code you gave above. I altered it a bit to test! Saves in db. https://www.loom.com/share/6d309d4c37024b1e9108a2066f6af78d?sid=b572fe91-0796-4095-a628-9504850e6af0 |
Beta Was this translation helpful? Give feedback.
@Anan7Codes here's a loom walkthrough with somewhat of the code you gave above. I altered it a bit to test! Saves in db.
https://www.loom.com/share/6d309d4c37024b1e9108a2066f6af78d?sid=b572fe91-0796-4095-a628-9504850e6af0