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.9.tar.gz (18.5 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.9-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autogen_vertexai_memory-0.1.9.tar.gz
  • Upload date:
  • Size: 18.5 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.9.tar.gz
Algorithm Hash digest
SHA256 80af1a42d01acf113885dfbfb10f9f12efc35707831dfa174ea41c9a65844559
MD5 d2b914ee3c34057930ab251d69f8dd9d
BLAKE2b-256 7db84ca5a016c9a8597bcd921a19eb3d8a070fbe59e942fb8675fe31107f3fe0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autogen_vertexai_memory-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 20.2 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 8d6e86b8862033a5d91e72e133da916bd89b38c6789b7682eefa08746048d345
MD5 bcf33e79c9a4070e00aab4a079d3d336
BLAKE2b-256 f29ae72cc53713edfd536a3d9c51ecde620ee076b544a9e79fd6e182f3161ad8

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