Skip to main content
cognee-rust ships four language bindings on top of the Rust core. All share the same SDK-tier implementation via cognee-bindings-common (portable op bodies + stable error codes), so their surfaces line up 1:1. Each exposes the same flow: warm() → add() → cognify() → search(). Module-level helpers exist in each binding for logging/telemetry setup. The serve() / disconnect() cloud helpers are not part of the OSS bindings. The full per-language method list lives in each binding’s README and its generated docs.

Per-call cognify options

cognify / addAndCognify take an options object that every binding parses the same way, in cognee_bindings_common::ops::pipeline::apply_cognify_opts. The keys are tenant, chunkSize, chunkOverlap, summarization, graphBackend, extractor (auto, llm, gliner/gliner_demo or another registered kind; graphBackend wins when both are given), graphSchema (a custom graph model’s JSON Schema, as an object or a JSON string; alias graphModel), graphSpec (the same model in the spec DSL, compiled into a graphSchema; not together with it) and chunkAttachment ("direct" or "all"). Python accepts the snake_case spellings too, and its compat cognify(graph_model=…) converts a Pydantic model class to its JSON Schema. Python also exposes the spec compiler on its own as cognee_py.graph_spec_to_json_schema (re-exported by cognee_py.compat). A wrongly-typed or invalid value, or a combination CognifyConfig rejects, fails with the VALIDATION_ERROR code before the dataset is looked up (and, for addAndCognify, before anything is added). An unknown key is logged as a warning — this now includes the removed temporalCognify and triplet options, which are ignored. See the custom graph schema guide.

Data rows and token_count

The data rows returned by add, addAndCognify and listData carry a token_count that is null until cognify has counted the item: TS number | null, Python None, Java Long tokenCount on CogneeData, JSON null in the C API. addAndCognify returns the count cognify computed for the newly added rows (still null for an item cognify could not count, such as one that is blank after trimming). The stored database column keeps -1, the value Python cognee writes, so a relational database shared by the two SDKs stays consistent.
This replaced the old -1 sentinel in the bindings and is a breaking change. In Java, CogneeData gained a third component: its canonical constructor is now new CogneeData(id, name, tokenCount), and record patterns need three bindings (case CogneeData(var id, var name, var tokenCount)).

Custom pipelines

Alongside the Cognee SDK surface, the Python, C and JS bindings expose the low-level pipeline API (Pipeline, tasks, a watcher, run handles) for composing your own tasks. The JS and C specifics are below. In JS, every task callback receives (input, ctx) and may return its result directly or through a Promise; a throw or a rejection fails the task with the error’s message. Each creator also has an async-named alias matching the C API (cg_task_async, cg_task_async_stream, …): Stream (“iter”) callbacks may return an array, any iterable (such as a generator) or an async iterable (such as an async function*). Iterables are pulled lazily, one item per downstream request. A batch task must directly follow a stream task, which accumulates its batch.
A stream that fails after it has started yielding fails the run. That failure is not retried, and items already passed downstream are not rolled back (see Tasks). In C, cg_pipeline_execute_in_background and cg_pipeline_execute_async keep their own reference to the watcher, so cg_pipeline_watcher_destroy() may be called right after starting the run. In those two modes, watcher callbacks run on runtime worker threads and can run concurrently. Watcher state must be thread-safe, and callbacks must not block or call blocking cg_* entry points. While a run is in flight, cg_pipeline_set_* and cg_pipeline_add_task on that pipeline are refused rather than aborting the process: they become no-ops and set cg_last_error_message(). The error is sticky, so call cg_last_error_clear() first to detect a refusal. The pipeline is mutable again once the run is done. See capi/include/cognee.h.

Process-wide configuration (logging, OTLP, analytics)

Logging, OpenTelemetry export and product analytics each configure a process-wide singleton, so they are not handle settings: a handle’s config.set(...) does not reach them. Each binding exposes the same module-level surface, resolved by one shared path (cognee_bindings_common::process_config): defaults < environment < options passed from code. See Configuration: Logging and Observability & telemetry for the keys. Analytics are on by default (opt-out). The switch wins over TELEMETRY_DISABLED / ENV, which are read when an event is sent (so a .env loaded later counts). Logging and OTLP setup latch on their first call. The argument-less forms (setup_logging(), cognee_setup_logging(), …) are unchanged and read the environment only.

Configuration

All four delegate to the same ConfigManager in cognee-bindings-common; the difference is purely ergonomic (design decision A3.1, intentional for 0.1.0): The generic set reaches every settable key: the Settings keys in the key registry and the keys of the component config sections compiled into the build, by canonical name (llm.model) or flat alias (llm_model). So C and Python deliberately ship only the generic + bulk setters; JS adds the granular setters as thin sugar over the same underlying settings; they are infallible except setMonitoringTool, which throws CONFIG_TYPE_MISMATCH for any tool but none. Type errors surface with the stable CONFIG_TYPE_MISMATCH code (C: CG_ERR_CONFIG_TYPE_MISMATCH) at the call site. Field names are camelCase in JS and snake_case in Python/C/Java.

Unification path (post-0.1.0)

If full parity is required, mirror the JS macro-driven approach: add set_llm_model(value) / cg_sdk_config_set_llm_model(handle, value) etc. as thin set_str("llm_model", value) wrappers in each binding’s idiomatic case (~0.5 d/binding, mechanical).