> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-service-account.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory Tools

> Trip-planner agent stores and recalls user memories in SQLite with MemoryTools.

```python memory_tools.py theme={null}
"""
Memory Tools
============

Demonstrates this reasoning cookbook example.
"""

from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIChat
from agno.tools.memory import MemoryTools
from agno.tools.websearch import WebSearchTools


# ---------------------------------------------------------------------------
# Create Example
# ---------------------------------------------------------------------------
def run_example() -> None:
    db = SqliteDb(db_file="tmp/memory.db")

    john_doe_id = "john_doe@example.com"

    memory_tools = MemoryTools(
        db=db,
    )

    agent = Agent(
        model=OpenAIChat(id="gpt-5-mini"),
        tools=[memory_tools, WebSearchTools()],
        instructions=[
            "You are a personalized trip planner that remembers everything about the user.",
            "Always start by retrieving stored memories to personalize your response.",
            "Store user preferences, interests, and trip details using MemoryTools.",
            "Use WebSearchTools to find real destinations, costs, and activities.",
            "Be proactive: propose specific plans tailored to the user's known interests instead of asking questions.",
        ],
        markdown=True,
    )

    agent.print_response(
        "My name is John Doe and I like to hike in the mountains on weekends. "
        "I like to travel to new places and experience different cultures. "
        "I am planning to travel to Africa in December. ",
        stream=True,
        user_id=john_doe_id,
    )

    agent.print_response(
        "Make me a travel itinerary for my trip, and propose where I should go, how much I should budget, etc.",
        stream=True,
        user_id=john_doe_id,
    )


# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    run_example()
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno ddgs openai sqlalchemy
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the example">
    Save the code above as `memory_tools.py`, then run:

    ```bash theme={null}
    python memory_tools.py
    ```
  </Step>
</Steps>

Full source: [cookbook/10\_reasoning/tools/memory\_tools.py](https://github.com/agno-agi/agno/blob/main/cookbook/10_reasoning/tools/memory_tools.py)
