Memory recall

$0.002 per call · USDC via x402 · POST /api/memory/recall

Recall remembered text by similarity to a query (ranked by cosine similarity), not by exact key. Send POST /api/memory/recall with the required field query and pay $0.002 per call over x402 with USDC on an EVM chain (the paying wallet is the identity). It returns a JSON object with query and results.

Returns the top-k matches with scores. The retrieval half of the wallet-scoped semantic memory.

Category: Agent memory & coordination · Tags: memory semantic search recall vector similarity

TRY IN PLAYGROUND →

Parameters

NameTypeRequiredDescription
querystringyesNatural-language query Also accepted as q, search, term, keyword, question.
knumbernoHow many matches (1-50, default 5)
ownerstringnoOptional 0x namespace (requires a grant)

Example request

curl -i -X POST https://agent402.tools/api/memory/recall \
  -H "Content-Type: application/json" \
  -d '{"query":"why did the deployment break","k":3}'

Without payment this returns HTTP 402 Payment Required with the exact price for memory-recall; any x402 v2 or MPP client pays it and retries.

Example response

{
  "query": "why did the deployment break",
  "results": [
    {
      "id": "abc123",
      "score": 0.62,
      "text": "The deploy failed because…"
    }
  ]
}
FieldTypeAlways presentIn the example
querystringyeswhy did the deployment break
resultsarray of objectsyes1 item in the example

From an MCP client

catalog.call {
  "slug": "memory-recall",
  "params": {
    "query": "why did the deployment break",
    "k": 3
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for memory-recall; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY (wallet only for this tool). Local install: npx -y agent402-mcp.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/memory/recall", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "query": "why did the deployment break",
    "k": 3
  }),
});

Related tools

Memory remember

$0.003 · POST /api/memory/remember

Store a piece of text for later similarity recall - a per-wallet semantic index an agent cannot host in-session. Returns…

Memory forget

$0.001 · POST /api/memory/forget

Delete a remembered document by id from the recall store.

Memory compare-and-set

$0.001 · POST /api/memory/cas

Atomically write (or release) a key only if its current value equals `expected` - the coordination primitive for distrib…

Memory grant

$0.002 · POST /api/memory/grant

Share your namespace with another wallet so different agents can coordinate through it. Grant read or readwrite access t…

Memory grants list

$0.001 · GET /api/memory/grants

List the wallets you've granted access to your namespace, with their mode and expiry.

Memory counter

$0.001 · POST /api/memory/incr

Atomically increment (or decrement) a numeric key and return the new value - a coordination primitive for counters, lock…