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.6.tar.gz (18.7 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.6-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autogen_vertexai_memory-0.1.6.tar.gz
  • Upload date:
  • Size: 18.7 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.6.tar.gz
Algorithm Hash digest
SHA256 94190516ec82d2a40b4fd90bd9d767c0dd2bec1aa57824bdf27ba42870cc5481
MD5 fa70a1e1076e99dd87bd0ba53e2f189a
BLAKE2b-256 a1f9ed0772b018a4cc6e206acf3cbf567608eea4dee22a16c7920059f9852bf9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autogen_vertexai_memory-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 20.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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fe8bcefde41436c151fe8427ca12e944ebf99b6d1b0d920af4ea2de4608ca040
MD5 19d80cad4606bf283c7bae3dc0b5f420
BLAKE2b-256 fcc8c44aac6f1ee3cb16c1d8babd2681b294fdecf0e0ea101642dfae642776c3

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