Skip to content
Ylabator
ExplainerAdvanced

Cortex, Memory, and Durable Agent Execution

"Cortex" names several unrelated products. Evaluate any of them by three separate layers: what a model call sees, what is remembered, and how a run survives a crash.

5 min read / Updated / Last checked

Format
Explainer · Advanced
Who it is for
Builders and technical founders
You leave with
Tell context, memory and durable execution apart, and build a run that resumes after a crash without repeating side effects.

The problem

As documented in November 2026, at least five unrelated products use the name Cortex. One is a local-first "agent kernel" for long, tool-using tasks, released under the MIT license [1]. One is Cortex Memory, which runs stateful AI agents on the Convex backend platform [2]. One is an engineering operations platform for engineering leaders [3]. Snowflake Cortex is a suite of AI features inside Snowflake's data platform [4]. And Cortex is also a Cloud Native Computing Foundation project that stores Prometheus metrics, accepted as an incubating project in August 2020 [5].

None of them is a standard, and they do not share an API. A team that reads "Cortex memory" in one vendor's docs and "Cortex agents" in another's can easily assume a shared layer that does not exist, or pick a product for a problem it was not built to solve.

The names hide a more useful question. Any agent that runs longer than one model call needs three things, and products bundle them differently: the context each call sees, the memory kept between tasks, and a way to resume a multi-step run after a crash without repeating what already happened. A founder evaluating "a Cortex" or any agent platform should ask about each layer separately.

How it works

Context is everything a single model call can see. It disappears after the call unless the application sends it again. A long conversation is context, not storage.

Memory is information kept for later retrieval: a confirmed user preference, a past decision, a document index. It needs an owner, a source, an expiry date and a deletion path, which Agent Memory: Session, Long-Term and Retrieval covers in detail.

Durable execution records which steps of a run have finished, so a crashed process can resume from the last completed step. It is closer to a transaction log than to memory. Two documented implementations show the mechanics:

  • LangGraph checkpoints the graph's state at step boundaries and can restart a failed run from the last successful step. It offers three durability modes: exit saves only when the run ends, async saves while the next step runs with a small risk of losing a checkpoint in a crash, and sync saves before each next step starts [6]. On resume it loads the latest checkpoint and retries the unfinished work, and the docs warn that nodes after a checkpoint re-trigger their LLM calls and API requests when replayed, so any step with a side effect must be safe to repeat [6].
  • Temporal keeps an Event History, a complete and durable log of everything that happens in a workflow execution, and after a crash a worker replays that history to recreate the workflow's state [9]. A workflow can run for seconds or years [7], but each history is capped at 51,200 events or 50 MB, with warnings from 10,240 events or 10 MB [8].

The Cortex agent kernel adds a layer above both: evidence gates. Each claim gets a verification receipt, an unchecked claim is recorded as not_run rather than counted as success, and a change is held by one actor at a time through an expiring lease, 15 minutes by default [1]. Whatever product is used, the principle carries over: "done" is a recorded, checkable state, not the model saying so.

Identity and authorization cut across all three layers. Every stored step, memory and checkpoint belongs to a user or tenant, and the application, not the model, checks that the caller may resume, read or delete it.

Three layers that agent products bundle under one name

Fig. 01
  1. Contextone model call, rebuilt each step
  2. Memoryfacts with owner, source, expiry
  3. Durable executioncheckpoints and step results
  4. Databasesource of truth for actions
Context is rebuilt per call, memory persists facts, durable execution persists progress; identity and deletion apply to every layer.

By the numbers

unrelated products named Cortex in the documentation reviewed for this article [1][2][3][4][5]
5
or 50 MB, the hard limit on one Temporal workflow's history [8]
51,200 events
LangGraph durability modes, from saving at exit to saving before every step [6]
3
default change lease in the Cortex agent kernel [1]
15 minutes
ProductWhat it isLayer it addresses
Cortex agent kernel (cortexai.tools)Local-first kernel between a model and its tools: evidence, plans, receipts, memory, MIT licensed [1]Durable task state and evidence gates for tool-using tasks
Cortex Memory (cortexmemory.dev)Runs stateful AI agents on Convex: inference, tools, transcript, asynchronous memory [2]Managed memory and agent backend
Cortex (cortex.io)Engineering operations platform for engineering leaders [3]None of the three: engineering operations
Snowflake CortexSuite of AI features that use LLMs to understand unstructured data [4]Model features inside the data platform
Cortex (CNCF)Horizontally scalable, multi-tenant long-term storage for Prometheus [5]None of the three: metrics storage
Five products named Cortex, as documented in November 2026 [1][2][3][4][5]

Two of the five are not agent products at all [3][5]. The other three each cover a different slice. The durability numbers explain why the slice matters. LangGraph's exit mode cannot recover a run that crashes halfway [6], and an agent loop that records many events per step inside one Temporal workflow can reach the 51,200-event ceiling, so long runs have to be designed around it [8]. Limits like these sit in the documentation, which is where an evaluation has to start.

Implementation

The smallest useful durable run fits in one table of step results. This module runs a research agent that collects sources, checks claims per company, drafts a report, waits for a person to approve it, and sends it. Each step's result is committed before the next step starts.

durable_run.pypython
"""A minimal durable run: each step's result is committed before the next step starts."""
import json
import sqlite3

SCHEMA = """
CREATE TABLE IF NOT EXISTS runs (run_id TEXT PRIMARY KEY, owner_id TEXT NOT NULL,
  status TEXT NOT NULL DEFAULT 'running');
CREATE TABLE IF NOT EXISTS steps (run_id TEXT NOT NULL REFERENCES runs (run_id),
  step TEXT NOT NULL, result TEXT NOT NULL, PRIMARY KEY (run_id, step));
"""


class Run:
    def __init__(self, db: sqlite3.Connection, run_id: str, owner_id: str):
        self.db, self.run_id = db, run_id
        with db:  # starting again with the same run_id resumes, it does not duplicate
            db.execute("INSERT OR IGNORE INTO runs (run_id, owner_id) VALUES (?, ?)",
                       (run_id, owner_id))

    def step(self, name: str, fn, *args):
        row = self.db.execute("SELECT result FROM steps WHERE run_id = ? AND step = ?",
                              (self.run_id, name)).fetchone()
        if row:  # finished before a crash: reuse the recorded result
            return json.loads(row[0])
        # A side effect gets a key derived from run and step, so a retry is a no-op downstream.
        result = fn(*args, idempotency_key=f"{self.run_id}:{name}")
        with self.db:
            self.db.execute("INSERT INTO steps VALUES (?, ?, ?)",
                            (self.run_id, name, json.dumps(result)))
        return result

    def finish(self, status: str = "done"):
        with self.db:
            self.db.execute("UPDATE runs SET status = ? WHERE run_id = ?", (status, self.run_id))


def research_report(run: Run, companies, tools):
    """Illustrative research agent: collect, check, draft, wait for approval, send."""
    sources = run.step("collect", tools.collect_sources, companies)
    checked = [run.step(f"check:{c}", tools.check_claims, c, sources[c]) for c in companies]
    draft = run.step("draft", tools.write_draft, checked)
    if not tools.is_approved(draft["id"]):  # read from the approvals table on every pass
        return run.finish("waiting_for_approval")  # a person approves, then the run resumes
    run.step("send", tools.send_report, draft["id"])
    run.finish()

Three choices make it safe. A step that already has a recorded result is skipped, so a resumed run picks up where it died. Each step receives an idempotency key built from the run and step name. Every step function accepts it, and read-only steps simply ignore it. A crash between a side effect and its commit means the step runs again, the same window LangGraph documents [6], and the key lets the email or payment provider drop the repeat (see Design for Failure: Retries, Queues and Idempotency). And approval is read from durable state on every pass rather than cached as a step result, so a run that waited can continue once a person approves.

Before adopting any memory or agent platform, Cortex-branded or not, fill in this worksheet with the vendor's documentation open. Any line the docs cannot answer is a question for the vendor.

agent-state-worksheet.txttext
Product and exact vendor:
Layer(s) it covers: context / memory / durable execution
Where data is stored, and in which region:
Owner key on every record (user, tenant):
Who may read, resume or delete a run:
Memory sources allowed (user-confirmed, tool output, web):
Retention and deletion path, including backups and indexes:
Checkpoint timing (after each step, async, at exit):
Steps with side effects, and their idempotency keys:
Human approval points, and where approvals are stored:
History or size limits per run:
Export format if the vendor is replaced:
Crash test result (date, run id, steps repeated):

Test it

Kill a run mid-step and resume it. The test below injects a crash, resumes, waits for approval, then reruns once more as a stray duplicate would. The assertion is the contract: everything completed before the crash runs once, the crashed step runs again, and the report is sent exactly once.

test_durable_run.pypython
import sqlite3
from collections import Counter

from durable_run import SCHEMA, Run, research_report


class FakeTools:
    """Counts every call and can crash once, the way a worker dies mid-run."""
    def __init__(self, crash_on=None):
        self.calls, self.crash_on, self.approved = Counter(), crash_on, set()
    def _call(self, name):
        self.calls[name] += 1
        if name == self.crash_on:
            self.crash_on = None
            raise RuntimeError(f"worker died during {name}")
    def collect_sources(self, companies, idempotency_key):
        self._call("collect")
        return {c: [f"https://example.com/{c}"] for c in companies}
    def check_claims(self, company, urls, idempotency_key):
        self._call(f"check:{company}")
        return {"company": company, "verified": True}
    def write_draft(self, checked, idempotency_key):
        self._call("draft")
        return {"id": "draft-1"}
    def is_approved(self, draft_id):
        return draft_id in self.approved
    def send_report(self, draft_id, idempotency_key):
        self._call("send")
        return {"sent": draft_id}


def test_crash_resume_and_approval_send_exactly_once():
    db, tools, names = sqlite3.connect(":memory:"), FakeTools(crash_on="check:beta"), ["alpha", "beta"]
    db.executescript(SCHEMA)
    try:
        research_report(Run(db, "run-1", "user-7"), names, tools)
    except RuntimeError:
        pass  # the worker died; a new worker picks the run up by its id
    research_report(Run(db, "run-1", "user-7"), names, tools)  # stops: waiting for approval
    tools.approved.add("draft-1")
    for _ in range(2):  # resume after approval, then a stray duplicate rerun
        research_report(Run(db, "run-1", "user-7"), names, tools)
    assert tools.calls == Counter({"collect": 1, "check:alpha": 1, "check:beta": 2, "draft": 1, "send": 1})
    assert db.execute("SELECT status FROM runs").fetchone()[0] == "done"

Expected: one passing test with python -m pytest test_durable_run.py. To see the test catch a real bug, delete the if row: early return in Run.step. Completed steps then run again on every resume, the call counts no longer match, and the test fails. Repeated work after a crash is the bug durable execution exists to prevent.

On a vendor platform, run the same experiment in staging: start a run, stop the worker process during a tool call, restart it, and count side effects in the downstream system. Expected: completed steps are not repeated, and the step that was interrupted repeats without a duplicate effect.

Decision

Choose memory and durable execution separately, and choose by layer, not by name.

  • Treat "Cortex" in a proposal as a pointer to one specific vendor. Ask which product, which layer and which API, and check its own documentation.
  • Start with an ordinary database: a steps table for durable runs and owner-scoped tables for memory. Move to LangGraph checkpoints, Temporal or a managed platform when runs become long, branching or high volume [6][7].
  • Give every side-effecting step an idempotency key and every completion a recorded, checkable result.
  • Run the crash test before launch and after every change to the run logic.

Sources

  1. [1]Cortex FAQ (opens in a new tab)Abdul Hamid Achik, November 2026
  2. [2]Cortex Memory documentation (opens in a new tab)Cortex Memory, November 2026
  3. [3]What is Cortex (opens in a new tab)Cortex, November 2026
  4. [4]Snowflake AI and ML (opens in a new tab)Snowflake Documentation, November 2026
  5. [5]TOC welcomes Cortex as an incubating project (opens in a new tab)Cloud Native Computing Foundation, August 2020
  6. [6]Checkpointers (opens in a new tab)LangChain Docs, November 2026
  7. [7]Temporal Workflow Execution overview (opens in a new tab)Temporal Docs, November 2026
  8. [8]Workflow Execution limits (opens in a new tab)Temporal Docs, November 2026
  9. [9]Event History (opens in a new tab)Temporal Docs, November 2026

Technical guidance, not legal or security certification.

Need a technical review of an AI-built MVP?

Discuss your build