Integrate CortexDB memory into Dify AI application workflows.

Dify Integration

CortexDB integrates with Dify as an external memory provider, adding long-term memory to your Dify applications.

Setup

  1. In your Dify application, navigate to Tools > Custom Tools
  2. Add a new tool provider with the CortexDB OpenAPI spec:
    https://api.cortexdb.ai/openapi.json
    
  3. Configure authentication with your CortexDB API key
  4. The remember, recall, and forget tools become available in your workflows

Workflow Integration

Add CortexDB tools to your Dify workflow:

  1. Before LLM node: Add a cortex_recall tool node to fetch relevant context
  2. After LLM node: Add a cortex_remember tool node to store the conversation

Configuration

| Field | Description | |---|---| | API Endpoint | https://api.cortexdb.ai | | API Key | Your CortexDB API key | | Tenant ID | Set as a variable in the tool configuration |

Under the Hood

The Dify custom tools call the CortexDB REST API:

# cortex_recall tool
curl -X POST https://api.cortexdb.ai/v1/recall \
  -H "Authorization: Bearer $CORTEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "user input", "tenant_id": "my-app"}'

# cortex_remember tool
curl -X POST https://api.cortexdb.ai/v1/remember \
  -H "Authorization: Bearer $CORTEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"content": "conversation content", "tenant_id": "my-app"}'

# cortex_forget tool
curl -X POST https://api.cortexdb.ai/v1/forget \
  -H "Authorization: Bearer $CORTEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "data to forget", "reason": "cleanup", "tenant_id": "my-app"}'