Appearance
Memory and Policy Loop
This page describes the default integration sequence for production use.
What this page covers
- The runtime order for memory, policy, and action execution.
- The identifiers you must preserve for replay.
- The guardrails required for a stable production integration.
Lifecycle
- Write memory (
POST /v1/memory/write). - Recall memory (
POST /v1/memory/recall_textorPOST /v1/memory/recall). - Assemble context (
POST /v1/memory/context/assemble). - Evaluate policy (
POST /v1/memory/rules/evaluate). - Select and persist decision and run records (
tools/select,tools/decision,tools/run). - Persist outcome feedback (
POST /v1/memory/tools/feedback).
What each step is for
- Write stores durable execution facts that later runs can reuse.
- Recall retrieves relevant memory for the current request.
- Assemble shapes that recall into bounded runtime context.
- Evaluate applies rules before any action is chosen.
- Select and run records the actual decision and execution linkage.
- Feedback closes the loop so future decisions can improve.
Write guardrails
- Recallable writes require
nodes. input_textalone does not create memory nodes.- Empty-node writes may return
warnings[].code=write_no_nodes.
Replay Execution
Use this chain to reconstruct execution:
request_idrun_iddecision_idcommit_uri
Workflow:
- Start with failed request logs (
request_id). - Resolve run and decision linkage (
run_id,decision_id). - Resolve affected objects by
commit_uri. - Replay the workflow and compare expected vs actual outcomes.
Use cases:
- Incident debugging.
- Regression verification before re-release.
- Release evidence for production changes.
Example sequence
bash
export BASE_URL="https://api.your-domain.com"
export API_KEY="your_api_key"
curl -sS "$BASE_URL/v1/memory/write" \
-H 'content-type: application/json' \
-H "X-Api-Key: $API_KEY" \
-d '{
"tenant_id":"default",
"scope":"default",
"input_text":"Customer prefers email",
"memory_lane":"shared",
"nodes":[{"type":"event","memory_lane":"shared","text_summary":"Customer prefers email"}]
}' | jq
curl -sS "$BASE_URL/v1/memory/recall_text" \
-H 'content-type: application/json' \
-H "X-Api-Key: $API_KEY" \
-d '{"tenant_id":"default","scope":"default","query_text":"preferred follow-up","limit":5}' | jq
curl -sS "$BASE_URL/v1/memory/rules/evaluate" \
-H 'content-type: application/json' \
-H "X-Api-Key: $API_KEY" \
-d '{"tenant_id":"default","scope":"default","run_id":"run-demo-1","context":{"intent":"follow-up"}}' | jqProduction checklist
- Keep one stable
run_idacross the full execution attempt. - Persist
request_id,decision_id, andcommit_uriin logs and telemetry. - Do not treat write and selection endpoints as blindly retryable.
- Validate the replay path before shipping production changes.