Storage is a necessary component when building user-facing AI products. While agents come with built-in memory, it only lasts during the active session. For persistent conversations across sessions, Agno provides storage options that work with individual agents, multi-agent teams and complex workflows.

Agent Storage

When working with agents, storage allows users to continue conversations where they left off. Every message, along with the agent’s responses, is saved to your database of choice.

Here’s a simple example of adding storage to an agent:

storage.py
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.storage.postgres import PostgresStorage

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    storage=PostgresStorage(
        table_name="agent_sessions", 
        db_url="postgresql+psycopg://ai:ai@localhost:5532/ai"
    ),
    tools=[DuckDuckGoTools()],
    show_tool_calls=True,
    add_history_to_messages=True,
)

# These messages will persist across sessions
agent.print_response("How many people live in Canada?")
agent.print_response("What is their national anthem called?")
agent.print_response("Which country are we speaking about?")

Team Storage

The storage system in Agno also works with teams, providing persistent memory and state management for multi-agent collaborative systems. With team storage, you can maintain conversation history, shared context, and team state across multiple sessions.

Learn more about teams and their storage capabilities to build powerful multi-agent systems with persistent state.

Workflow Storage

The storage system in Agno also works with workflows, enabling more complex multi-agent systems with state management. This allows for persistent conversations and cached results across workflow sessions.

Learn more about using storage with workflows to build powerful multi-agent systems with state management.

Supported Storage Backends

The following databases are supported as a storage backend:

Check detailed examples for each storage