Dify
Dify lets you add external tools from an OpenAPI schema, so there is no SDK to install. Suprflo is called directly over its REST API. You paste one OpenAPI document into Dify, and Suprflo shows up as a Custom Tool you can drop into any agent or workflow.
Create the custom tool
- In Dify, go to Tools → Create Custom Tool.
- Under Schema, choose Import from OpenAPI schema and paste the document below.
- Under Authorization, select API Key, set the auth type to Bearer, the header name to
Authorization, and pasteBearer <YOUR_API_KEY>as the value. - Save. Dify creates two tool actions:
searchMemoriesandaddMemories.
OpenAPI schema
This schema covers the two operations you need: search (retrieve relevant memories) and add (store new ones). The request and response shapes match rest-api.md.
{
"openapi": "3.0.0",
"info": {
"title": "Suprflo",
"description": "Memory layer for AI agents.",
"version": "1.0.0"
},
"servers": [
{ "url": "https://api.suprflo.com" }
],
"paths": {
"/api/memories/search": {
"post": {
"operationId": "searchMemories",
"summary": "Search for relevant memories",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["query"],
"properties": {
"query": { "type": "string", "description": "What to recall" },
"user_id": { "type": "string", "description": "Subject to scope the search to" },
"top_k": { "type": "integer", "default": 10 }
}
}
}
}
},
"responses": {
"200": {
"description": "Matching memories",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"memory": { "type": "string" },
"score": { "type": "number" },
"metadata": { "type": "object" }
}
}
}
}
}
}
}
}
}
}
},
"/api/memories": {
"post": {
"operationId": "addMemories",
"summary": "Extract and store memories from messages",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["messages"],
"properties": {
"messages": { "type": "string", "description": "Message text to extract facts from" },
"user_id": { "type": "string", "description": "Subject to store the memories under" },
"metadata": { "type": "object" }
}
}
}
}
},
"responses": {
"200": {
"description": "Stored memories",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"memory": { "type": "string" },
"event": { "type": "string" }
}
}
}
}
}
}
}
}
}
}
}
}
}Use it in an agent or workflow
The pattern is: search before the LLM step to pull in context, and add after to persist what happened.
In an Agent app, enable both searchMemories and addMemories under Tools. Instruct the agent to call searchMemories with the user's message and their user_id at the start of a turn, fold the returned results[].memory strings into its reasoning, and call addMemories with the new conversation turn and the same user_id once it has answered.
In a Workflow or Chatflow, wire it explicitly:
- Start — capture the user message and a
user_id. - Tool: searchMemories —
query= the user message,user_id= the subject. This returnsresults. - LLM — inject
results[].memoryinto the system prompt as known facts about the user, then answer. - Tool: addMemories —
messages= the latest turn,user_id= the same subject, so the exchange is remembered for next time.
Pass the same user_id on both calls so each subject's memories stay isolated.