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.8.tar.gz (18.4 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.8-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autogen_vertexai_memory-0.1.8.tar.gz
  • Upload date:
  • Size: 18.4 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.8.tar.gz
Algorithm Hash digest
SHA256 a09abea2ba323a26bbc07e19bb19f965cb5e34ae9834c585d2060ffa09af3bf2
MD5 ef3b491942d3a715cb8c3ec69d1dba7d
BLAKE2b-256 46d64691ce4d9e90f678b8f5a492988cac2305db13ffd9aa14b433a06f78c30a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autogen_vertexai_memory-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 20.1 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b6ddca4e8bdc6619dee5da5fd645e9d9a928daa47cb9296eca559bee87a2b038
MD5 4a46f9960e146decc6ab3683672ec62e
BLAKE2b-256 0251995e050e3cc7e6aea76bca8e22cf6d64e8e4949c36da189a8c47d88535df

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