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.10.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.10-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autogen_vertexai_memory-0.1.10.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.10.tar.gz
Algorithm Hash digest
SHA256 296a369f5b3dde13c7e086571dac6a3267deb2302c24e24037b2eb944164aadd
MD5 67b1505232c37854c50783cf9b1f6be5
BLAKE2b-256 bc487aa5b2e1316189fbe2055103a726cb2de37e493fa9e71c639aa26613dd43

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autogen_vertexai_memory-0.1.10-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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 eb895ff21a1d0cd37fbbd9954eb1d0545bb8775f927fb425c560ef75c350f8ad
MD5 4e3ee4810e3d226d08cca06951ffae15
BLAKE2b-256 cd43bc063cbeb908de4d5e05626bcd21dfaafa32ae197733d7e60530df38dd3b

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