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
- In your Dify application, navigate to Tools > Custom Tools
- Add a new tool provider with the CortexDB OpenAPI spec:
https://api.cortexdb.ai/openapi.json - Configure authentication with your CortexDB API key
- The
remember,recall, andforgettools become available in your workflows
Workflow Integration
Add CortexDB tools to your Dify workflow:
- Before LLM node: Add a
cortex_recalltool node to fetch relevant context - After LLM node: Add a
cortex_remembertool 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"}'