Commit and recall are the core hosted memory loop for long-running agents. This page shows both calls from Python, the CLI, HTTP and MCP, the arguments that matter, the mistakes to avoid, and how to check that a write landed. Every change keeps a source and a history, and snapshots, diff and rollback let you undo a bad run.
When to commit, and when to recall.
Commit when a fact should outlive the current run: a decision, a finished result, a user preference, the outcome of a task. Recall at the start of a task and before any step that is hard to undo, such as a deploy, a migration, or a message to a user.
Use the other calls for the other jobs. To correct a memory that must already exist, use revise; it never creates. To say a memory is still right without resending it, use confirm. To drop obsolete state, use forget with a reason. All of them are in the API reference.
Commit only what should become durable memory.
from bilinc import CloudClient
client = CloudClient()
client.commit(
"project.status",
{"phase": "docs refresh", "verified": True},
memory_type="episodic",
importance=0.8,
)CloudClient() with no arguments reads BILINC_API_KEY, then the key saved by bilinc login.
Commit arguments
| Argument | What it does |
|---|---|
key | Required. Up to 512 characters. Use stable, namespaced keys such as project.status or user.preference. |
value | Required. Any JSON value. |
memory_type | Default semantic. See the memory model for the types. |
importance | A number from 0.0 to 1.0. Default 1.0. |
metadata | A JSON object stored with the memory. |
source | Optional "saved by" label, up to 256 characters. |
ttl | Optional lifetime in seconds. Must be positive. |
idempotency_key | Lets you retry the write without applying it twice. |
if_absent | True writes only if the key does not exist yet; otherwise you get 409 memory_exists. |
Commit returns an entryVersion. Keep it: pass it as expected_version to revise or confirm, and the call fails with version_conflict if someone changed the memory in between. Over HTTP, a successful commit answers 201.
Committing to a key that already exists replaces its value. The earlier value stays in that memory's history, so you can see what changed and when. If you need "create only", pass if_absent=True.
Recall before continuing a workflow.
results = client.recall(
"what did we verify in the docs refresh?",
profile="balanced",
limit=5,
)Recall arguments
| Argument | What it does |
|---|---|
query | Required. Plain-language text, up to 4096 characters. |
profile | fast, balanced, verified or deep. Default balanced. |
limit | 1 to 100 results. Default 10. |
memory_types | Optional list that limits recall to those memory types. |
Profiles depend on your plan. A profile your plan does not include returns 403 capability_not_entitled, and GET /api/cloud/status lists the profiles your key may use. Start with balanced and read recall profiles before you change it.
Recall is a search, not a lookup by key. To read one exact key, use client.get_memory("project.status"), or bilinc list --prefix project.status from the terminal.
The same loop from the terminal.
bilinc commit --key project.status --value '{"phase":"launch"}' --type episodic --importance 0.8
bilinc recall --query "project launch status" --profile balanced --limit 5--value takes JSON or a plain string. The CLI covers key, value, type, importance and metadata; use the SDK or HTTP for the other commit arguments. See the CLI reference.
The same loop over HTTP.
curl https://bilinc.space/api/cloud/memory/commit \
-H "Authorization: Bearer $BILINC_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"key": "project.status",
"value": { "phase": "launch" },
"memoryType": "episodic",
"importance": 0.8
}'
curl https://bilinc.space/api/cloud/memory/recall \
-H "Authorization: Bearer $BILINC_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "query": "project launch status", "profile": "balanced", "limit": 5 }'HTTP fields use camelCase: memoryType, ifAbsent, memoryTypes. In MCP clients the same calls are the commit_mem and recall tools; see MCP tools.
Treat failures as non-durable.
If the Cloud API does not return success, the agent should behave as if the write did not happen. This keeps durable memory honest.
That includes a commit the hosted runtime rejects, which comes back as 409 version_conflict: treat it as not saved, re-read the memory, then retry.
There is one exception. 503 mutation_outcome_unknown means the write may have been applied. Do not resend it under a new idempotency key; send the request ID to support. Every other code is listed in the error guide.
The SDK retries recall by itself on transient failures. It never retries a commit, because a retried write could apply twice. If you retry a commit, send the same idempotency_key and the same payload: the server replays the first result and bills it once.
Common mistakes.
- Storing secrets. A value that looks like an API key, token or private key is refused with
422 secret_detected, and nothing is saved. Store where the secret lives instead. - Unstable keys. A key with a timestamp or random ID in it creates a new memory every run. Keep keys stable and let the history record the changes.
- Committing every turn. Commit only what should outlive the run. Each commit is a billed write, and every extra memory is one more thing recall has to sort through.
- Skipping recall before risky steps. An agent that does not recall cannot use what it saved.
- Reserved names. Keys that start with
bilinc:dream:and sources that start withmcp:,mcp-local:ormcp-unverified:are refused with400 invalid_request.
How to check a write landed.
- The commit response has an
entryVersionand a request ID in_meta.requestId. bilinc history project.statusshows the change, newest first, with its source and time.bilinc list --prefix project.shows the key with its last-updated time.- A recall with a matching question returns it.
History and list are free and read-only. For checkpoints before risky work, see snapshots and rollback.
Frequently asked questions
What is the difference between commit and revise?
Commit writes a memory, creating it or replacing the current value. Revise only changes a memory that already exists, and returns 404 memory_not_found if it does not. Use revise when a missing key means something went wrong.
Does commit overwrite an existing memory?
Yes, commit replaces the current value of an existing key. The earlier value stays in the memory's history. Pass if_absent=True to refuse instead, with 409 memory_exists.
Which recall profile should I use?
Start with balanced, the default. Higher profiles depend on your plan; GET /api/cloud/status shows which ones your key may use. See recall profiles.
Is a failed commit charged?
A commit that fails validation is never charged, because validation runs before any credit is reserved. A commit that fails inside the hosted runtime releases its credit reservation. A retry with the same idempotency key and payload is billed once.