Learning loop
Receipts, outcomes and retrieval feedback — how real results flow back into memory so useful memories and procedures are reinforced.
Storing and recalling is half of memory. The other half is learning which memories actually helped. Agent Memory closes that loop with three pieces:
- Receipts — every recall records exactly what it delivered.
- Outcomes — the run's measured result (build, tests, deploy, user rating).
- Retrieval feedback — which delivered memories the agent used or ignored, and which procedures it applied or skipped.
search ──► context + receiptId ──► agent works ──► outcome / feedback (receiptId, same runId)
│
memory utility, usage counts ◄───┤
procedure success / failure ◄───┘Receipts
Each recall returns a receiptId. The receipt records the run, the agent and the IDs of the memories that made it into the context after the token budget was applied — not the ones that were trimmed.
Pass the receipt back with outcomes and feedback, with the same runId you recalled with:
- With a
receiptId, an outcome credits exactly what that delivery contained. Without one, it credits everything the run was delivered. - Each delivery is credited once.
- Feedback that names a receipt from another run or workspace, or claims to have used a memory that receipt did not deliver, is refused with
400 RECEIPT_MISMATCHand nothing is recorded. The error lists theundeliveredIDs.
Outcomes
Report an outcome when the real result of a run is known:
curl -s -X POST "$AGENT_MEMORY_BASE_URL/v1/outcomes" \
-H "Authorization: Bearer $AGENT_MEMORY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"workspaceId": "'"$AGENT_MEMORY_WORKSPACE_ID"'",
"runId": "run-1",
"receiptId": "<receiptId>",
"buildSuccess": true,
"testPassRate": 0.95,
"errorCount": 0,
"notes": "CI green"
}'
# {"runId":"run-1","successScore":0.9785…}All signals are optional. The server folds the ones you send into a normalized successScore between 0 and 1, weighting them as follows and re-normalizing over the signals present:
| Signal | Weight |
|---|---|
buildSuccess | 0.30 |
testPassRate (0–1) | 0.30 |
deploySuccess | 0.20 |
error-free (errorCount; each error costs 0.1) | 0.10 |
userRating (1–5) | 0.10 |
warningCount, notes and measuredAt are recorded with the report. Reporting outcomes needs the feedback capability. Over MCP use report_outcome; in the SDKs, outcome().
What an outcome does:
- Validates the procedures the run applied — successes strengthen them, failures weaken them and can contribute anti-patterns.
- Updates the learned utility of the memories the run was delivered, which value-aware retrieval can use for ranking.
Retrieval feedback
Feedback is finer-grained: tell memory which delivered entries were actually used.
{
"workspaceId": "…",
"runId": "run-1",
"receiptId": "<receiptId>",
"usedEntryIds": ["…"],
"ignoredEntryIds": ["…"],
"appliedProcedureIds": ["…"],
"skippedProcedureIds": ["…"]
}Used entries are reinforced and ignored ones fade; applied procedures gain confidence. Endpoint: POST /v1/retrieval-feedback (MCP: record_retrieval_feedback, SDKs: feedback()).
Validating a procedure directly
When you know a specific procedure worked (or didn't) outside an outcome report, record it with POST /v1/procedures/validate — see Episodes and procedures.
Settings
| Setting | Scope | Default | Effect |
|---|---|---|---|
learning.enabled | tenant | on in the shipped API configuration | Record which memories each run saw and update their utility from outcomes. |
learning.utilityAlpha | tenant | 0.1 | Step size of the utility update applied per outcome. |
retrieval.valueAware.enabled | workspace | off | Blend learned utility into ranking. |
retrieval.utilityWeight | workspace | 0.5 | How strongly utility re-weights value-aware ranking. |
See Workspace settings.
Evaluation reads are not credited
Retrieval evaluation runs are side-effect free: no receipt, no usage touch and no credit, so measuring memory never changes it.
Identity and visibility
How credentials bind to agents and end users, and how per-memory visibility decides who can recall, update, share or delete a memory.
Updating and forgetting
Correct a memory in place, mark it superseded, delete it with its derived copies, and track the erasure until every copy is gone.