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

# Memory

> Store personalized memories and session summaries with Claude on Vertex AI using PostgreSQL.

```python memory.py theme={null}
"""
This recipe shows how to use personalized memories and summaries in an agent.
Steps:
1. Run: `./cookbook/scripts/run_pgvector.sh` to start a postgres container with pgvector
2. Run: `uv pip install anthropic sqlalchemy 'psycopg[binary]' pgvector` to install the dependencies
3. Run: `python cookbook/90_models/vertexai/claude/memory.py` to run the agent
"""

from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.vertexai.claude import Claude

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

# Setup the database
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
db = PostgresDb(db_url=db_url)

agent = Agent(
    model=Claude(id="claude-sonnet-4@20250514"),
    # Pass the database to the Agent
    db=db,
    # Store the memories and summary in the database
    update_memory_on_run=True,
    enable_session_summaries=True,
)

# -*- Share personal information
agent.print_response("My name is john billings?", stream=True)

# -*- Share personal information
agent.print_response("I live in nyc?", stream=True)

# -*- Share personal information
agent.print_response("I'm going to a concert tomorrow?", stream=True)

# Ask about the conversation
agent.print_response(
    "What have we been talking about, do you know my name?", stream=True
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass
```

## Run the Example

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

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno "anthropic[vertex]" "psycopg[binary]" sqlalchemy
```

**2. Export environment variables**

```bash Mac/Linux theme={null}
export ANTHROPIC_VERTEX_PROJECT_ID="your_anthropic_vertex_project_id_here"
export CLOUD_ML_REGION="your_cloud_ml_region_here"
```

```bash Windows theme={null}
$Env:ANTHROPIC_VERTEX_PROJECT_ID="your_anthropic_vertex_project_id_here"
$Env:CLOUD_ML_REGION="your_cloud_ml_region_here"
```

**3. Authenticate with Google Cloud**

Sign in with Application Default Credentials:

```bash theme={null}
gcloud auth application-default login
```

<Snippet file="run-pgvector-step.mdx" />

**4. Run the example**

Save the code above as `memory.py`, then run:

```bash theme={null}
python memory.py
```

Full source: [cookbook/90\_models/vertexai/claude/memory.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/90_models/vertexai/claude/memory.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.