> ## Documentation Index
> Fetch the complete documentation index at: https://docs.compozy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory

> Memory in Compozy is a powerful feature that enables workflows, tasks, and agents to maintain context and recall information from past interactions.

## Introduction

Memory can be configured at different levels. Here are examples of each:

<CodeGroup>
  ```yaml Workflow Level theme={"dark"}
  # Workflow level memory configuration
  memory:
    id: global_memory
    vector:
      use: compozy/vector:pg-vector
      config:
        url: "{{ env.POSTGRES_URL }}"

  # Using workflow level memory
  workflows:
    memory: global_memory
    tasks:
      - id: analyze_request
        use: compozy/tasks:analyze-request
  ```

  ```yaml Task Level theme={"dark"}
  # Task level memory configuration
  memory:
    id: task_memory
    vector:
      use: compozy/vector:pinecone
      config:
        apiKey: "{{ env.PINECONE_API_KEY }}"

  # Using task level memory
  workflows:
    tasks:
      - id: analyze_request
        use: compozy/tasks:analyze-request
        memory: task_memory
  ```

  ```yaml Agent Level theme={"dark"}
  # Agent level memory configuration
  memory:
    id: agent_memory
    vector:
      use: compozy/vector:qdrant
      config:
        url: "{{ env.QDRANT_URL }}"

  # Using agent level memory
  workflows:
    tasks:
      - id: support_task
        use: compozy/tasks:support
        agents:
          support_agent:
            use: compozy/agents:openai
            memory: agent_memory
  ```
</CodeGroup>

Memory can be accessed through `{{ memory.<id>.current_thread }}`, `{{ memory.<id>.last_messages }}`, or `{{ memory.<id>.semantic_search }}`, allowing contextual responses based on past interactions.

## Core Features

<CardGroup cols={2}>
  <Card title="Vector Databases" icon="hard-drive">
    Choose from various vector storage solutions to match your needs.
  </Card>

  <Card title="Vector Search" icon="chart-scatter">
    Semantic search capabilities through vector embeddings.
  </Card>

  <Card title="Embeddings" icon="network-wired">
    Flexible embedding options for semantic search.
  </Card>

  <Card title="Memory Types" icon="layer-group">
    Different memory structures for various use cases.
  </Card>
</CardGroup>

## Key Points

<Steps>
  <Step title="Multiple Storage Options" icon="database">
    Support for various vector databases including PgVector, Pinecone, Qdrant, and more.
  </Step>

  <Step title="Semantic Search" icon="magnifying-glass">
    Vector search capabilities for intelligent context retrieval.
  </Step>

  <Step title="Working Memory" icon="brain">
    Structured persistent memory for maintaining user context.
  </Step>

  <Step title="Conversation History" icon="comments">
    Efficient storage and retrieval of interaction history.
  </Step>
</Steps>

## Next Steps

* Learn about [Memory Configuration](/core/memory/usage)
* Explore [Storage Types](/core/memory/types)
* Review the [API Reference](/core/memory/api)
* See [Example Implementations](/core/memory/examples)
