Skip to main content

Conflict management

Conflict review in improve() stores one FactConflict per disputed attribute of an entity. When the review cannot decide which fact holds, for example because two sources disagree on something that never changes, the conflict stays unresolved. These functions let you inspect the stored conflicts and settle one yourself. Both are async, take the dataset id rather than its name, and are available since Cognee 1.6.6.
For a walkthrough, see Resolve Conflicting Facts.

Methods

list_conflicts()

Returns a dataset’s conflicts sorted by id, each with its competing facts (their ids, text, status, and source evidence) and any earlier decision. Returns an empty list when nothing matches. Raises PermissionDeniedError (403) if you lack read access to the dataset or it does not exist, and CogneeValidationError (422) for any other status value.

Remote mode (serve())

After cognee.serve(), the call runs on the connected instance through GET /api/v1/conflicts. The API key identifies the caller, so user is ignored, and an HTTP error is raised as RuntimeError carrying the status code.

resolve_conflict()

Accepts one of a conflict’s facts and returns the updated conflict. The conflict becomes resolved with resolution_source="user", the selected fact is marked current, and the others are marked superseded. Rejected facts are not deleted: they stay in the graph as evidence, while graph-completion and hybrid search leave them out of their context and state the accepted fact instead. A later automatic review keeps your decision for as long as the selected fact exists. Repeating the same choice changes nothing. If a review has since added a fact to the conflict, the repeated choice rejects that fact as well. Choosing a different fact replaces the earlier decision. Raises PermissionDeniedError (403) if you lack write access to the dataset or it does not exist, EntityNotFoundError (404) if the dataset holds no conflict with this id, and CogneeValidationError (422) if selected_fact_id is not one of the conflict’s facts.

Remote mode (serve())

After cognee.serve(), the call runs on the connected instance through POST /api/v1/conflicts/{conflict_id}/resolve. The API key identifies the caller, so user is ignored, and an HTTP error is raised as RuntimeError carrying the status code.

Return types

Both models are exported from cognee. Over HTTP their keys are camelCase (datasetId, selectedFactId, …).

ConflictDetail

ConflictFact

HTTP API

The same operations are available over HTTP. Request bodies accept camelCase or snake_case keys.