Skip to main content

VertexAI Memory integration for Autogen agents

Project description

autogen-vertexai-memory

VertexAI Memory integration for Autogen agents. Store and retrieve agent memories using Google Cloud's VertexAI Memory service.

Features

  • 🧠 Persistent memory storage in VertexAI
  • 🔍 Semantic search for memory retrieval
  • 🔄 Automatic chat context updates
  • ⚡ Async/await support
  • 🎯 User-scoped memory isolation

Installation

pip install autogen-vertexai-memory

Prerequisites

  • Google Cloud Project with VertexAI API enabled
  • Authentication configured (Application Default Credentials recommended)
  • VertexAI Memory resource created
gcloud auth application-default login

Quick Start

from autogen_vertexai_memory import VertexaiMemory, VertexaiMemoryConfig
from autogen_core.memory import MemoryContent, MemoryMimeType

# Configure
config = VertexaiMemoryConfig(
    api_resource_name="projects/xxxxxxxxxx/locations/us-central1/reasoningEngines/xxxxxxxxxxxxxxxx",
    project_id="YOUR_PROJECT_ID",
    location="us-central1",
    user_id="user123"
)

memory = VertexaiMemory(config=config)

# Add memory
await memory.add(
    content=MemoryContent(
        content="User prefers Python",
        mime_type=MemoryMimeType.TEXT
    )
)

# Query with semantic search
results = await memory.query(query="programming language preference")

# Get all memories
all_memories = await memory.query(query="")

API Reference

VertexaiMemoryConfig

VertexaiMemoryConfig(
    api_resource_name: str,  # Full VertexAI memory resource name
    project_id: str,         # GCP project ID
    location: str,           # GCP region (e.g., "us-central1")
    user_id: str            # User identifier for memory isolation
)

VertexaiMemory

VertexaiMemory(
    config: VertexaiMemoryConfig | None = None,
    client: Client | None = None
)

Methods:

  • add(content, cancellation_token=None) - Add a memory
  • query(query="", cancellation_token=None, **kwargs) - Query memories (empty query returns all)
  • update_context(model_context) - Update chat context with memories
  • clear() - Delete all memories (irreversible)
  • close() - Cleanup resources

Examples

Update Chat Context

from autogen_core.model_context import ChatCompletionContext

context = ChatCompletionContext()
result = await memory.update_context(context)

Custom Client

from vertexai import Client

client = Client(project="my-project", location="us-central1")
memory = VertexaiMemory(config=config, client=client)

Development

git clone https://github.com/thelaycon/autogen-vertexai-memory.git
cd autogen-vertexai-memory
poetry install
poetry run pytest

Contributing

Contributions welcome! Please submit a Pull Request.

License

MIT License - see LICENSE file for details.

Support


Made with ❤️ for the Autogen community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autogen_vertexai_memory-0.1.11.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autogen_vertexai_memory-0.1.11-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file autogen_vertexai_memory-0.1.11.tar.gz.

File metadata

  • Download URL: autogen_vertexai_memory-0.1.11.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for autogen_vertexai_memory-0.1.11.tar.gz
Algorithm Hash digest
SHA256 3217a05d26bd3b60ea5cb5ead7844dbc92aa6b1c4480f845eb7990e0d18754c9
MD5 bfa40431e36c82ecf179b740094da014
BLAKE2b-256 b1fb848b2b5b4f149411e71b5def01781b31d11a23487db04dad2a2d194c9f5e

See more details on using hashes here.

File details

Details for the file autogen_vertexai_memory-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: autogen_vertexai_memory-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for autogen_vertexai_memory-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 890e2bbefb2deeee8500e25d0164490dda2bae3bbb4725e3ebb863db53542504
MD5 5d10595cf53e691d198adcbda0163adf
BLAKE2b-256 0d32575228e3625ba09aa714ee1248c4835ed600f20340d63aafb7c19d3f1302

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page