AI

Memory & RAG

Long-term memory for conversations and agents, and searchable knowledge bases built from your documents.


Namespaces

Both memory and knowledge bases are organized by namespace — a name you choose: one per customer, per conversation, per agent, per handbook. In a workflow, build it from data, e.g. support-{{$json.body.customerId}}, so each customer gets their own memory.

Memory

memory.store saves a piece of text — a message, a fact, a decision — and memory.recall finds the stored items closest in meaning to a query, most relevant first. Items can expire (ttlMs), and once a namespace grows past 30 items it is automatically compacted into a summary.

bash
curl -X POST https://api.directos.dev/api/memory/customer-42/remember \
  -H "authorization: Bearer $DIRECTOS_KEY" \
  -H 'content-type: application/json' \
  -d '{"role": "user", "content": "Prefers invoices in EUR, billed quarterly."}'

curl "https://api.directos.dev/api/memory/customer-42/recall?q=billing%20currency&limit=5" \
  -H "authorization: Bearer $DIRECTOS_KEY"

Knowledge bases (RAG)

rag.ingest turns a document into a searchable knowledge base: it extracts the text, splits it into overlapping chunks and indexes each one. rag.query searches it two ways at once — by meaning and by exact keywords — and merges the rankings, so both paraphrased questions and exact product codes find the right passage. Every result names its source document, ready for citations.

Supported formats
PDF, DOCX, HTML, CSV, Markdown, plain text
bash
# content is the file's bytes, base64-encoded
curl -X POST https://api.directos.dev/api/rag/handbook/ingest \
  -H "authorization: Bearer $DIRECTOS_KEY" \
  -H 'content-type: application/json' \
  -d "{\"name\": \"refunds.pdf\", \"mimeType\": \"application/pdf\", \"content\": \"$(base64 < refunds.pdf)\"}"

curl "https://api.directos.dev/api/rag/handbook/query?q=refund%20window&limit=5" \
  -H "authorization: Bearer $DIRECTOS_KEY"