Skip to main content
Version: 0.0.6 (stable)

agrag.memory.decisions.DecisionMemory

DecisionMemory(store:GraphStore, *, project_id:str, agent_id:str) -> None

Write and search durable decisions for one configured project.

Functions:

  • continue_review_propagation – Expand at most limit queued decisions by one dependency hop each.
  • get_decision – Read a decision only when it belongs to this project.
  • list_conflicts – List active same-choice decisions with different conclusions.
  • list_decisions – List decisions for a task, including lifecycle history by default.
  • list_review – List active decisions that need a look, within this project's bounds.
  • list_support_history – Read exact historical support associations and who reviewed them.
  • reaffirm_decision – Confirm a decision still stands on the current version of its documents.
  • record_decision – Record a decision only when every support is valid and in scope.
  • reject_decision – Mark a decision rejected without changing its recorded conclusion.
  • resolve_supports – Resolve typed supports in a caller-owned transaction.
  • search_decisions – Find same-project decisions as precedents, with their task context.
  • supersede_decision – Record a same-choice replacement and preserve the old decision.

continue_review_propagation​

continue_review_propagation(*, limit:int = 100) -> int

Expand at most limit queued decisions by one dependency hop each.

get_decision​

get_decision(decision_id:UUID) -> DecisionLookup

Read a decision only when it belongs to this project.

list_conflicts​

list_conflicts() -> ConflictList

List active same-choice decisions with different conclusions.

list_decisions​

list_decisions(task_name:str, *, include_history:bool = True) -> DecisionPageLookup

List decisions for a task, including lifecycle history by default.

list_review​

list_review(*, task_name:str | None = None, limit:int = 20) -> DecisionReviewList

List active decisions that need a look, within this project's bounds.

A listed decision is flagged because a source or a decision it depends on changed. Review means it needs a look, not that it is false. Use reaffirm_decision, supersede_decision or reject_decision to clear the flag.

Parameters:

  • task_name (str | None) – Only list decisions of this task, or all tasks if None.
  • limit (int) – The number of decisions to return, capped at the page limit.

Returns:

  • DecisionReviewList – The decisions in the page, the total count, and whether more exist.

list_support_history​

list_support_history(decision_id:UUID, *, after_ordinal:int = -1, limit:int = 20) -> SupportHistoryPage

Read exact historical support associations and who reviewed them.

reaffirm_decision​

reaffirm_decision(decision_id:UUID, evidence:Sequence[DocumentSupportInput], *, fetched_evidence:Sequence[FetchOutcome] = (), explanation:str = 'Reaffirmed after review.', request_id:str | None = None) -> ReaffirmDecisionResult

Confirm a decision still stands on the current version of its documents.

Review means the decision needs a look. It does not mean the decision is false. Reaffirming records the caller as the reviewer, replaces the decision's document supports with evidence, and clears the review flag. It does not change the flags of dependent decisions.

Every document the decision cites must be fetched in its current version, and evidence must cite exactly those documents. A cited document that is removed, or whose current version was not fetched with status ok, fails with cannot_revalidate and the decision stays flagged. So does a decision that depends on another decision still needing review.

Parameters:

  • decision_id (UUID) – The id of the active decision to reaffirm.
  • evidence (Sequence[DocumentSupportInput]) – The new document supports, one or more per cited document.
  • fetched_evidence (Sequence[FetchOutcome]) – Fetch outcomes from this session. They must cover the current version of each cited document.
  • explanation (str) – The reason the reviewer accepts the current supports.
  • request_id (str | None) – An optional key that makes a retry return the stored result of the first call.

Returns:

record_decision​

record_decision(task_name:str, choice_key:str, conclusion:str, rationale:str, *, supports:Sequence[SupportInput], fetched_evidence:Sequence[FetchOutcome] = (), assumptions:Sequence[str] = (), open_questions:Sequence[str] = (), request_id:str | None = None) -> RecordDecisionResult

Record a decision only when every support is valid and in scope.

Document evidence must appear in fetched_evidence with status ok. All checks and writes share one graph transaction.

reject_decision​

reject_decision(decision_id:UUID, reason:str, *, request_id:str | None = None) -> RejectDecisionResult

Mark a decision rejected without changing its recorded conclusion.

resolve_supports​

resolve_supports(tx:GraphStoreTransaction, supports:Sequence[SupportInput], fetched:Sequence[FetchOutcome]) -> tuple[list[dict[str, Any]], bool]

Resolve typed supports in a caller-owned transaction.

Returns property maps and whether any observed source has changed. Raises ValueError when a reference cannot be resolved or was not fetched.

search_decisions​

search_decisions(query:str, *, task_name:str | None = None, limit:int = 20) -> list[DecisionHit]

Find same-project decisions as precedents, with their task context.

supersede_decision​

supersede_decision(decision_id:UUID, conclusion:str, rationale:str, *, explanation:str, supports:Sequence[SupportInput], fetched_evidence:Sequence[FetchOutcome] = (), assumptions:Sequence[str] = (), open_questions:Sequence[str] = (), request_id:str | None = None) -> RecordDecisionResult

Record a same-choice replacement and preserve the old decision.