Version: latest
agrag.candidates.review.approve_candidates
approve_candidates(graph_store:GraphStore, schema:GraphSchema, *, ids:Sequence[UUID] | None = None, query:CandidateQuery | None = None, output:Path | None = None, overwrite:bool = False, now:datetime | None = None) -> ApprovalResult
Approve resolvable candidates and plan a deterministic schema patch.
Pass exactly one of ids or query. Only pending candidates with
resolvable endpoints are approved. If any candidate changes state, a patch
is built from the approved groups; output also writes it as JSON.
Parameters:
- graph_store (
GraphStore) – Store containing candidates and endpoint entities. - schema (
GraphSchema) – Schema used to resolve endpoints and plan additions. - ids (
Sequence[UUID] | None) – Candidate ids to approve. - query (
CandidateQuery | None) – Filters used to select candidate ids. - output (
Path | None) – Optional path for the patch JSON file. - overwrite (
bool) – Whether to replace an existing output file. - now (
datetime | None) – Decision and patch creation time, or current UTC time.
Returns:
ApprovalResult– Approval results and a patch when at least one group changes state.ApprovalResult– The output path is set only when the file was written.
Raises:
ValueError– If both or neither ofidsandqueryare supplied.FileExistsError– Ifoutputexists andoverwriteis false.