cognee.push()
Description
Upload a local dataset’s already-built knowledge graph to a Cognee Cloud (or any remote Cognee) instance. The dataset’s graph is exported to a COGX archive, packed as a tarball, uploaded, and imported on the remote instance — preserving the entities and relationships you extracted locally instead of re-deriving them from the raw files. This is what distinguishespush() from sync():
push() ships the graph so the remote side does little or no LLM work, while
sync() ships the raw data and the remote instance rebuilds the graph itself.
The dataset must already have a knowledge graph. If the export finds 0 nodes,
push() raises an error — run cognify() (or
remember()) on the dataset first.Authentication
push() reuses the serve() credential stack. Run cognee.serve()
(or cognee-cli serve) once to log in, then push any time. The remote target is
resolved in this order:
- Explicit
url/api_keyarguments - An active
cognee.serve()connection COGNEE_SERVICE_URL/COGNEE_API_KEYenvironment variables- Saved credentials from a previous
serve()login (~/.cognee/cloud_credentials.json)
push() raises a RuntimeError telling you to authenticate.
Parameters
Local dataset name or UUID to push. Requires read permission.
Dataset name on the remote instance. Defaults to the local dataset’s name.
Remote import fidelity. One of
preserve, hybrid, or re-derive (see below).If true, the remote import is scheduled and the call returns once the upload completes; poll the returned
pipeline_run_id for progress. Recommended for large graphs.Remote instance URL. Falls back to the active
serve() connection, COGNEE_SERVICE_URL, or saved credentials.API key for the remote instance. Falls back like
url.Local user context for the export. Uses the default user when omitted.
Import modes
| Mode | Remote behavior | LLM calls |
|---|---|---|
preserve (default) | Map the exported entities and facts directly into the remote graph | None |
hybrid | Preserve the exported graph and cognify the raw content | Yes |
re-derive | Ignore the exported graph; rebuild it from the raw content remotely | Yes |
Returns
APushResult dataclass:
Status reported by the remote remember call (for example
"started").Name of the local dataset that was exported.
Dataset name the graph was imported into on the remote instance.
Number of nodes uploaded.
Number of edges uploaded.
Remote migration pipeline run id; poll it when
run_in_background=True.Raw response returned by the remote remember endpoint.
Examples
The remote instance must run a Cognee version with COGX archive import support.
Against an older server the upload is accepted but ingested as a plain file;
push()
detects this and raises an error rather than silently degrading. Upgrade the remote
instance, or use sync() /
remember() with raw data instead.See also
- Syncing a Local Instance — connect the SDK to a remote instance and ship raw data with
sync() - Cognee CLI → Push to Cloud — the same operation from the terminal (
cognee push)