Skip to main content

Memory

Memory allows agents to retain information across conversations, enabling personalized experiences and continuity with returning callers.

How Memory Works

First Call:
  Caller: "My name is John"
  Agent: Stores → {caller_phone: "name": "John"}

Second Call:
  Agent: Retrieves → "John"
  Agent: "Welcome back, John!"

Memory Types

Short-Term Memory

Context within a single conversation:
{
  "memory": {
    "short_term": {
      "enabled": true,
      "scope": "conversation",
      "auto_capture": ["name", "intent", "mentioned_dates"]
    }
  }
}

Long-Term Memory

Persists across conversations:
{
  "memory": {
    "long_term": {
      "enabled": true,
      "scope": "caller",
      "retention_days": 365,
      "fields": ["name", "preferences", "appointment_history"]
    }
  }
}

Workspace Memory

Shared knowledge across all agents:
{
  "memory": {
    "workspace": {
      "enabled": true,
      "scope": "crew",
      "fields": ["vip_callers", "blocked_numbers"]
    }
  }
}

Configuring Memory

Automatic Capture

Automatically extract and store information:
{
  "memory": {
    "auto_capture": {
      "enabled": true,
      "fields": [
        {
          "name": "caller_name",
          "trigger": "name_mentioned",
          "storage": "long_term"
        },
        {
          "name": "preferred_time",
          "trigger": "time_preference_stated",
          "storage": "long_term"
        },
        {
          "name": "last_topic",
          "trigger": "intent_detected",
          "storage": "short_term"
        }
      ]
    }
  }
}

Manual Storage

Store information via pathway actions:
{
  "action": "store_memory",
  "data": {
    "key": "appointment_preference",
    "value": "{{collected_preference}}",
    "scope": "caller"
  }
}

API Storage

Store memory via API:
curl -X POST https://api.usecrew.ai/v1/memory \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "crew_id": "crew_xyz",
    "caller_id": "+14155551234",
    "data": {
      "name": "John Smith",
      "account_id": "acc_123",
      "tier": "premium"
    }
  }'

Retrieving Memory

Automatic Retrieval

Memory is automatically available in conversations:
Agent: "Welcome back, {{memory.name}}! 
        Last time you called about {{memory.last_topic}}. 
        Is this related?"

Via API

curl https://api.usecrew.ai/v1/memory?caller_id=+14155551234 \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "caller_id": "+14155551234",
  "data": {
    "name": "John Smith",
    "first_contact": "2024-01-01",
    "total_calls": 5,
    "last_topic": "appointment_scheduling",
    "preferences": {
      "preferred_time": "afternoon",
      "preferred_provider": "Dr. Johnson"
    }
  }
}

Memory in Conversations

Personalized Greetings

{
  "greeting": {
    "known_caller": "Hi {{memory.name}}! Great to hear from you again. How can I help today?",
    "unknown_caller": "Thank you for calling. May I get your name?"
  }
}

Context Continuity

{
  "context_check": {
    "enabled": true,
    "check": "memory.last_topic",
    "within_days": 7,
    "prompt": "Last time you called about {{memory.last_topic}}. Is this related to that, or something new?"
  }
}

Preference Application

{
  "preferences": {
    "scheduling": {
      "check": "memory.preferred_time",
      "apply": "offer_preferred_first",
      "prompt": "I see you usually prefer {{memory.preferred_time}} appointments. Should I look for availability then?"
    }
  }
}

Memory Schemas

Define what can be stored:
{
  "memory_schema": {
    "fields": [
      {
        "name": "caller_name",
        "type": "string",
        "pii": true
      },
      {
        "name": "preferences",
        "type": "object",
        "pii": false
      },
      {
        "name": "call_history",
        "type": "array",
        "max_items": 10
      },
      {
        "name": "notes",
        "type": "string",
        "max_length": 500
      }
    ]
  }
}

Privacy Controls

Retention Policies

{
  "memory": {
    "retention": {
      "default_days": 365,
      "pii_fields_days": 90,
      "auto_delete": true
    }
  }
}

Caller Opt-Out

Allow callers to request data deletion:
{
  "memory": {
    "opt_out": {
      "trigger_phrases": ["forget me", "delete my data"],
      "confirmation": "I'll remove your information from our system. This may affect personalized service on future calls. Should I proceed?",
      "action": "delete_caller_memory"
    }
  }
}

Data Access

Provide access to stored data:
# Export caller memory
curl https://api.usecrew.ai/v1/memory/export?caller_id=+14155551234 \
  -H "Authorization: Bearer YOUR_API_KEY"

Anonymization

{
  "memory": {
    "anonymization": {
      "enabled": true,
      "after_days": 90,
      "preserve_fields": ["call_count", "general_preferences"],
      "remove_fields": ["name", "specific_dates", "transcripts"]
    }
  }
}

Memory Events

Track memory operations:
EventDescription
memory.storedNew data stored
memory.retrievedData retrieved for call
memory.updatedExisting data modified
memory.deletedData deleted
memory.expiredData auto-deleted

Webhook Payload

{
  "event": "memory.stored",
  "caller_id": "+14155551234",
  "crew_id": "crew_xyz",
  "fields_updated": ["name", "preferences"],
  "timestamp": "2024-01-15T10:30:00Z"
}

Use Cases

VIP Recognition

{
  "vip_handling": {
    "check": "memory.tier == 'vip'",
    "behavior": {
      "greeting": "Thank you for calling, {{memory.name}}. As a valued customer, how can I provide exceptional service today?",
      "priority_routing": true,
      "skip_hold": true
    }
  }
}

Follow-Up Context

{
  "follow_up": {
    "check": "memory.pending_callback",
    "behavior": {
      "greeting": "Hi {{memory.name}}, I'm calling back about {{memory.callback_topic}} as promised."
    }
  }
}

Preference Learning

{
  "learning": {
    "track": ["scheduling_choices", "provider_preferences"],
    "after_interactions": 3,
    "apply_automatically": true
  }
}

Best Practices

Don’t store everything—focus on data that improves the experience.
Be transparent about data storage and honor deletion requests.
Don’t keep data longer than necessary.
Always have fallbacks when memory data isn’t available.
Verify personalized experiences work correctly with real data.

Next Steps