SITEMAP / DOCS / AGENTS

Memory Writes

memory.write appends a typed agent memory entry to a customer's ledger and mirrors it into the workspace timeline. This is how external agents share state across sessions, runs, and other agents.

FieldValue
Capabilitymemory.write
Grantcapability:memory.write
Legacy scopev1:memory:write
Modesdry_run, execute
Cost1 action credit when committed
Side effectmemory
MCP toolwrite_memory

01Request

POST /api/v1/capabilities/memory.write/invoke
Authorization: Bearer wp_live_...
Content-Type: application/json

{
  "mode": "execute",
  "source": "api",
  "idempotency_key": "esc-1284-v2",
  "input": {
    "customer": "cus_8af2",
    "type": "decision",
    "agent": "support_v2",
    "payload": {
      "action": "escalate_to_human",
      "reason": "customer_frustrated"
    },
    "idempotency_key": "esc-1284-v2"
  }
}
FieldTypeNotes
customerstring, requiredCustomer id or email.
typeenum, requireddecision, action, observation, or outcome.
agentstring, requiredStable agent slug.
payloadobject, requiredFree-form memory payload. Keep it concise and non-secret.
idempotency_keystring, requiredDedupes safe retries.

02When to use each type

03Examples

CLI

wp memory write --customer cus_8af2 --body "Requested pricing follow-up."

wp invoke memory.write \
  --mode execute \
  --idempotency-key esc-1284-v2 \
  --input '{
    "customer":"cus_8af2",
    "type":"decision",
    "agent":"support_v2",
    "payload":{"action":"escalate_to_human"},
    "idempotency_key":"esc-1284-v2"
  }'

curl

curl https://api.waypath.app/api/v1/capabilities/memory.write/invoke \
  -H "Authorization: Bearer wp_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "execute",
    "source": "api",
    "idempotency_key": "esc-1284-v2",
    "input": {
      "customer": "cus_8af2",
      "type": "decision",
      "agent": "support_v2",
      "payload": {
        "action": "escalate_to_human",
        "reason": "customer_frustrated"
      },
      "idempotency_key": "esc-1284-v2"
    }
  }'

MCP

await mcp.tools.write_memory({
  customer: 'cus_8af2',
  type: 'decision',
  agent: 'support_v2',
  payload: { action: 'escalate_to_human' },
  idempotency_key: 'esc-1284-v2',
  _mode: 'execute',
})

04Response

{
  "status": "committed",
  "result": {
    "memory_id": "mem_a91b",
    "deduped": false,
    "received_at": "2026-06-28T18:14:32Z"
  },
  "action_credit_cost": 1,
  "request_id": "req_123",
  "quota": {
    "plan": "starter",
    "limit": 500,
    "used": 42,
    "remaining": 458
  },
  "receipt_url": "/api/v1/capabilities/actions/req_123"
}

05Idempotency

Build deterministic keys from the thing being retried:

Idempotent replay never double-charges or creates duplicate memory.

06Errors

StatusCodeCause
400invalid_inputMissing required field.
400missing_idempotency_keyMissing idempotency key.
401unauthenticatedMissing or invalid key.
403grant_deniedKey lacks capability:memory.write or compatible legacy scope.
403mode_deniedKey cannot use the requested mode.
404customer_not_foundCustomer email did not resolve.
409idempotency_conflictSame idempotency key, conflicting request.
429rate_limitedPer-key request cap.

07See also