Getting Started
Overview
One package for Python and TypeScript, with Dock to write and Lynk to read.
The Docklee SDK wraps the REST API so you never build requests by hand. It reads your settings from the environment, retries failed requests, buffers writes in the background, and returns typed results.
Packages
| Language | Package | Install | Requires |
|---|---|---|---|
| Python | docklee on PyPI | pip install docklee | Python 3.9+ |
| TypeScript | docklee on npm | npm install docklee | Node.js 18+ |
Both packages are at version 2.0.0. The Python package ships type hints, and its results are typed models. The TypeScript package ships ES module and CommonJS builds with TypeScript definitions.
Two classes
| Class | Direction | Reaches |
|---|---|---|
Dock | Writes data into Docklee | Vector and OKF containers, and memory spaces |
Lynk | Reads data back | Engines and memory spaces |
from docklee import Dock, Lynk
dock = Dock()
dock.capture("Maya prefers email over phone calls.", type="preference")
dock.flush_sync()
records = Lynk().recall_sync("How does Maya like to be contacted?")This example reads DOCKLEE_API_KEY and DOCKLEE_MEMORY_SPACE_ID from the environment. See Configuration.
Every method
| Method | Python | TypeScript | Calls |
|---|---|---|---|
| Capture | capture | capture | Buffers an event |
| Flush | flush, flush_sync | flush | POST /v1/dock/ingest |
| Close | close | close | Flushes and stops |
| Instrument an app | instrument | instrument | Captures write requests |
| Watch a database | watch | none | Captures new and changed rows |
| Listen for webhooks | listen | none | Captures incoming webhooks |
| Query | query, query_sync | query | POST /v1/engine/query or /v1/engine/query/stream |
| Retrieve | retrieve, retrieve_sync | retrieve | POST /v1/engine/retrieve |
| Recall | recall, recall_sync | recall | POST /v1/dum/search |
What the SDK does for you
| You get | Detail |
|---|---|
| Settings from the environment | Key, memory space, engine, end user, container, and dimension. |
| Buffered writes | capture returns at once, and batches are sent in the background. |
| Duplicate protection | Identical content within 60 seconds is captured once. |
| Retries | Timeouts, connection errors, and retryable statuses are retried with backoff. |
| Typed errors | Each HTTP status maps to its own error class. |
| Typed results | Every call returns a typed object. |
Next steps
You know what's in the package. Pick your language and make your first calls.