Memory & Context

Memory Operations

Overview of memory operations available through API endpoints and workflow tasks for persistent data management

Overview

Memory operations in Compozy provide persistent context management for AI agents and workflows. These operations enable your applications to maintain conversation history, share context between agents, and optimize memory usage through intelligent strategies.

Memory operations are available through two primary interfaces:

Operation Categories

Compozy provides 8 core memory operations organized into logical groups:

Core CRUD Operations

  • Read

    Retrieve messages with pagination and filtering for efficient data access

  • Write

    Replace entire memory content with atomic operations for data consistency

  • Append

    Add new messages to existing memory with automatic optimization triggers

API Example:

# Read with pagination
curl "http://localhost:5001/api/v0/memory/user_memory/read?key=user:123&limit=10"

Task Example:

type: memory
operation: read
memory_ref: user_sessions
key_template: "user:{{ .workflow.input.user_id }}:conversation"

Implementation Approaches

Choose the approach that best fits your integration needs:

Best for: External integrations, custom applications, real-time operations

Key Features:

  • Direct HTTP access to all memory operations
  • Complete OpenAPI/Swagger documentation
  • Authentication and authorization support
  • Real-time response for immediate operations

Use Cases:

  • TypeScript tools and custom integrations
  • External application memory management
  • Real-time conversation systems
  • Direct programmatic access

Learn More: Complete API Reference →

Quick Start Examples

Get started with common memory operation patterns:

Store and retrieve conversation history:

# Store user message
- id: store-user-message
  type: memory
  operation: append
  memory_ref: conversations
  key_template: "conv:{{ .workflow.input.session_id }}"
  payload:
    role: "user"
    content: "{{ .workflow.input.message }}"
    timestamp: "{{ now }}"

# Retrieve conversation history
- id: get-conversation-history
  type: memory
  operation: read
  memory_ref: conversations
  key_template: "conv:{{ .workflow.input.session_id }}"
  read_config:
    limit: 50
    include_metadata: true