Skip to main content
Version: 0.0.9

agrag.decisions.DecisionTraces

DecisionTraces(store:GraphStore, *, project_id:str, agent_id:str, scope:frozenset[str] | None = None) -> None

Write and search durable decisions for one configured project.

Functions:

  • continue_decision_review – Expand at most limit queued decisions by one dependency hop each.
  • get_decision – Read a decision only when its task is visible in this project.
  • list_conflicts – List active same-choice decisions with different conclusions.
  • list_decisions – List decisions for a visible task, including history by default.
  • list_decisions_for_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 when every support is valid, current and clear.
  • 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.

Parameters:

  • store (GraphStore) – The graph store holding decisions and their tasks.
  • project_id (str) – The project every operation is scoped to.
  • agent_id (str) – The author recorded on new decisions.
  • scope (frozenset[str] | None) – Document scope for reads and writes. None allows every task.

continue_decision_review​

continue_decision_review(*, 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 its task is visible in 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 visible task, including history by default.

list_decisions_for_review​

list_decisions_for_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. It also drops the documents the decision read without citing, so a later change to one of them no longer flags the decision.

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] = (), consulted:Sequence[FetchOutcome] = (), assumptions:Sequence[str] = (), open_questions:Sequence[str] = (), request_id:str | None = None) -> RecordDecisionResult

Record a decision when every support is valid, current and clear.

A document support must appear in fetched_evidence with status ok and must name the current version of its document. A decision support must be active and must not need review. consulted holds text returned to the caller, including outcomes that are not complete current fetches. All checks and writes share one graph transaction.

reject_decision​

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

Mark a decision rejected without changing its recorded conclusion.

When an approved revision is supplied, it is checked against the decision inside the write transaction, so a decision changed after approval is not rejected under the old approval.

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.

Visibility is applied inside the query before the row limit, so a hidden decision cannot push a visible one out of the page.

supersede_decision​

supersede_decision(decision_id:UUID, conclusion:str, rationale:str, *, explanation:str, supports:Sequence[SupportInput], fetched_evidence:Sequence[FetchOutcome] = (), consulted: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.

fetched_evidence is used to validate cited documents. consulted records every text-bearing outcome that informed the replacement.