Skip to main content

Writeback

POST /api/v2/containers/{container_tag}/agent/writeback

Writeback is the post-turn capture path. Agents should call it after a useful turn to submit durable outcomes, decisions, preferences, artifacts, or extracted facts. UnifiedMemory stores evidence first, rejects residue, and promotes only safe memory through lifecycle and trust gates.

Auth

Use a scoped key with agent.writeback and any required memory write capabilities.

Authorization: Bearer $UNIFIED_MEMORY_API_KEY

The stored source_app, agent_id, and visibility scope come from key metadata. Caller-supplied identity is diagnostic only when it conflicts.

Request fields

FieldRequiredTypeDefaultDescription
observed_factsNostring[][]Atomic facts observed during the turn.
decisionsNostring[][]Durable decisions or chosen approaches.
preferencesNostring[][]User preferences worth remembering.
artifactsNoobject[][]Files, links, or outputs worth tracking.
auto_extractNobooleanfalseAsk cognition to extract atomic claims from supplied content.
sourceNostringagent_runtimeSource label for this writeback event.
agent_idNostringkey metadataCompatibility-only identity hint.
app_idNostringkey metadataCompatibility-only app hint.
run_idNostringRun/session identifier.
default_confidenceNonumber0.82Compatibility signal. Cannot create trusted memory alone.
default_trust_scoreNonumber0.8Compatibility signal. Trust bucket gates remain authoritative.
metadataNoobject{}Integration-specific evidence metadata.

Schema from OpenAPI

This section is generated from /openapi.public.json. Edit the OpenAPI source or generator, not this block.

POST /api/v2/containers/{container_tag}/agent/writeback

  • Operation ID: agent_memory_writeback_api_v2_containers__container_tag__agent_writeback_post
  • Declared response statuses: 200, 422

Request schema

Schema: AgentWritebackRequest

FieldRequiredTypeNullableDefaultConstraints
agent_idNostringYes--
app_idNostringYes--
artifactsNoarray of string or AgentMemoryCandidateNo--
assistant_responseNostringYes-maxLength=50000
auto_extractNobooleanNofalse-
decisionsNoarray of string or AgentMemoryCandidateNo--
default_confidenceNonumberNo0.82minimum=0.0, maximum=1.0
default_trust_scoreNonumberNo0.8minimum=0.0, maximum=1.0
observed_factsNoarray of string or AgentMemoryCandidateNo--
org_idNostringYes--
preferencesNoarray of string or AgentMemoryCandidateNo--
request_idNostringYes--
review_requiredNobooleanNofalse-
run_idNostringYes--
session_idNostringYes--
sourceNostringNo"agent_runtime"-
user_idNostringYes--
user_messageNostringYes-maxLength=20000

200 response schema

Schema: AgentWritebackResponse

FieldRequiredTypeNullableDefaultConstraints
container_tagYesstringNo--
dedupe_supersession_decisionsNoarray of objectNo--
diagnosticsNoobjectNo--
operation_trail_idYesstringNo--
retained_memoriesNoarray of objectNo--
review_required_itemsNoarray of objectNo--
skipped_candidatesNoarray of objectNo--

Example

curl https://edge-api.jithendranara.dev/api/v2/containers/jeethendra/agent/writeback \
-H "Authorization: Bearer $UNIFIED_MEMORY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"decisions": [
"Hosted docs API pages should be handwritten before adding generated Scalar or Redoc."
],
"observed_facts": [
"Docusaurus local search is enabled with @easyops-cn/docusaurus-search-local."
],
"source": "codex",
"run_id": "docs-depth-repair"
}'

Response shape

{
"container_tag": "jeethendra",
"operation_trail_id": "docs-depth-repair",
"committed": true,
"committed_memory_ids": ["mem_01"],
"enrichment_status": "pending",
"pending_jobs": ["profile_atomic_merge"],
"client_retry_safe": true,
"idempotency_status": "request_id_recorded",
"retained_memories": [
{
"id": "mem_01",
"content": "Hosted docs API pages should be handwritten before adding generated API UI.",
"lifecycle_state": "pending",
"trust_bucket": "needs_review",
"next_action": "review"
}
],
"skipped_candidates": [],
"review_required_items": [],
"diagnostics": {
"committed": true,
"retained_count": 1
},
"effective_identity": {
"source_app": "codex",
"agent_id": "codex",
"agent_scope": "own"
},
"stored_visibility_scope": "private_agent",
"sharing_eligible": false,
"sharing_blocked_reason": "pending_review"
}

The commit acknowledgement fields have the same meaning as retain: committed and committed_memory_ids describe durable writes, while enrichment_status and pending_jobs describe slower post-commit work such as profile merge or cognitive promotion. When possible, send request_id so client_retry_safe can be true after client timeouts.

Common outcomes

StatusMeaning
200Writeback processed. Some items may be quarantined or rejected.
401Missing or invalid key.
403Key lacks writeback capability.
404Container is not visible to the key.
409Conflicting current fact requires review or supersession.
422Payload validation failed.
200 degradedHeavy cognition unavailable; deterministic admission still runs.

Bad candidates

Do not write back raw transcript blocks, full assistant answers, greetings, emoji-only messages, secrets, smoke/eval rows, or lifecycle logs as normal memory. See Bad candidates and residue.