Getting Started
Quickstart
Install the SDK, store your first memory, and get a cited answer from your own knowledge in a few minutes.
In a few minutes you'll write a memory with Dock, read it back with Lynk, and then ask an engine a question about your own content. Every step works in Python, TypeScript, or cURL.
Building with an AI coding assistant?
Claude Code, Cursor, Codex, and other assistants can read every page of these docs as plain Markdown from /llms.txt. Point your assistant there and it can follow this guide for you.
Prerequisites
- A Docklee account. Sign up if you don't have one.
- An API key with the Both capability, created in API Keys in the dashboard. See API keys.
- A memory space, created in DUM in the dashboard. Copy its ID.
- Python 3.9+, Node.js 18+, or cURL.
Store your first memory
Pick a language tab below. Your choice carries over to every step on this page.
Install the SDK
pip install dockleeSet your key and memory space
The SDK reads both values from the environment, so your code never holds the key.
export DOCKLEE_API_KEY="your-api-key"
export DOCKLEE_MEMORY_SPACE_ID="your-memory-space-id"Write a memory
capture adds the memory to a buffer, and flush_sync() or close() sends it.
from docklee import Dock
dock = Dock()
dock.capture("Maya prefers email over phone calls.", type="preference")
result = dock.flush_sync()
print(result)Docklee accepts the event and stores it in your memory space. The SDK returns the same counts as the API:
{
"batch_id": "3f6d2a1c-8b4e-4c2f-9a71-5e0b9c4d7a12",
"accepted": 1,
"rejected": 0,
"errors": [],
"usage": {
"events_accepted": 1,
"ke_events": 0,
"dum_events": 1,
"processing_time_ms": 412
}
}Read it back
Ask a question in plain words. You don't need to match the stored text.
from docklee import Lynk
lynk = Lynk()
for record in lynk.recall_sync("How does Maya like to be contacted?"):
print(record.content, record.confidence)The memory comes back with a confidence score, best match first:
[
{
"id": "9b1e7c42-5d3a-4f08-b6e2-1a7c0d93e5f4",
"content": "Maya prefers email over phone calls.",
"memory_type": "entity",
"confidence_score": 0.87
}
]Place the recalled memories in your model's prompt, and its replies will reflect what your app already knows about Maya.
Query your knowledge
Write knowledge into a container
A knowledge write declares a container instead of a memory space. A vector container also takes an embedding dimension.
from docklee import Dock
dock = Dock(container="vector", dimension=1024)
dock.capture("Refunds are available within 30 days of purchase.", type="knowledge")
dock.flush_sync()The first write to a container creates an API/SDK Feed source for it in Sources.
Link the feed to an engine
In the dashboard, open Knowledge Engines, create an engine, and copy its ID. On the engine's Sources tab, add the API/SDK Feed source. An engine reads only the sources linked to it.
export DOCKLEE_ENGINE_ID="your-engine-id"Ask a question
from docklee import Lynk
lynk = Lynk()
result = lynk.query_sync("How long do customers have to request a refund?")
print(result.answer, result.confidence)The engine answers from the feed and cites the chunk it used:
{
"answer": "Customers can request a refund within 30 days of purchase.",
"citations": [
{
"chunk_id": "c2a8f5e1-7b39-4d6c-a014-8e3f2b9d61c7",
"page_number": null,
"section_title": null
}
],
"confidence": 0.93
}Capture without calling capture
In a FastAPI or Express app, dock.instrument(app) captures write requests for you. See Instrument your app.
Troubleshooting
| What you see | Why it happens | What to do |
|---|---|---|
API key is required | DOCKLEE_API_KEY isn't set in the shell that runs your code. | Export the key in that shell, or pass api_key (Python) or apiKey (TypeScript). |
memory_space_id is required for recall() | DOCKLEE_MEMORY_SPACE_ID isn't set. | Export the space ID, or pass it to Lynk. |
401 | The key is wrong or revoked. | Copy a fresh key from API Keys. |
403 | The key's capability or scope doesn't cover this space or engine. | Use a key with Both, scoped to this space and engine. |
Recall returns [] | The capture was never sent. | Call flush_sync() or close() after capture. |
| The answer ignores your knowledge | The feed isn't linked to the engine. | Add the API/SDK Feed source on the engine's Sources tab. |
Next steps
You've written a memory, recalled it, and queried an engine. Start with How Docklee works, since every call you make from here follows the same two paths.
How Docklee works
Where each write goes, and how it comes back.
Capture memory
Types, metadata, and per-user memory for every capture.
Containers
Pick vector or OKF, and the right dimension.
API keys
Narrow a key to the engines and spaces it needs.
Stuck on something else? See FAQs.