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 --url ... --api-key ...) once to connect, 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.
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.Import modes
Returns
APushResult dataclass:
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)