GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing ct.rithul.dev — Durable execution - Continuum Durable execution¶A long agent run should survive a deploy, a crash, or a spot-instance eviction, and it should be possible to rewind it and try a different step. Both come from the same primitive: a checkpoint. What a checkpoint is¶
That is the entire run state. There is no external database and no in-memory handle to keep alive. Move the bytes and the run moves with them.
Checkpoint and resume¶from continuum import DurableAgent agent = DurableAgent() agent.begin(["pull the ticket", "reproduce the bug", "draft a fix", "open the PR"]) ckpt = agent.run_until_step(1) # steps 1 and 2 run now del agent # the process can die here revived = DurableAgent() # a fresh runtime outputs = revived.resume_from(ckpt) # finishes steps 3 and 4, nothing re-run revived.cache_size() # the KV cache came back with the checkpoint
Across processes¶The checkpoint is bytes, so the boundary between stages can be a file, an object store, or a queue. Nothing else has to cross it. # plan.py : a small box runs the cheap steps, then parks the job from pathlib import Path from continuum import DurableAgent agent = DurableAgent() agent.begin(["pull the ticket", "reproduce the bug", "draft a fix", "open the PR"]) Path("job.ckpt").write_bytes(agent.run_until_step(1)) # work.py : a different process, a GPU box, an hour later from pathlib import Path from continuum import DurableAgent outputs = DurableAgent().resume_from(Path("job.ckpt").read_bytes()) Path("job.result").write_text(repr(outputs)) # audit.py : a third process, anywhere, replays the same bytes from pathlib import Path from continuum import DurableAgent blob = Path("job.ckpt").read_bytes() assert DurableAgent().resume_from(blob) == DurableAgent().resume_from(blob) Because the checkpoint carries the KV cache, Checkpoint stores¶Instead of moving bytes yourself, hand from continuum import DurableAgent from continuum.checkpoints import LocalDirectoryStore, S3Store, GCSStore store = LocalDirectoryStore("/mnt/shared/ckpt") # store = S3Store("my-bucket", prefix="continuum") # pip install boto3 # store = GCSStore("my-bucket", prefix="continuum") # pip install google-cloud-storage agent = DurableAgent() agent.begin(["pull the ticket", "reproduce the bug", "draft a fix", "open the PR"]) agent.run_until_step(1, store=store, key="ticket-42/step-2") # any machine that can reach the store: DurableAgent().resume_from(store=store, key="ticket-42/step-2") Every store implements Incremental checkpoints, forks, and many workers¶
from continuum.checkpoints import CheckpointLog log = CheckpointLog(store, run_id="ticket-42") prev = None for step in range(4): prev = log.commit(agent.run_until_step(step), parent=prev, step=step) alt = log.fork(prev, agent.prompt_node_ids[3], "open a draft PR instead") DurableAgent().resume_from(log.load(alt))
Fork a timeline¶
from continuum import DurableAgent rec = DurableAgent() rec.begin(["summarize the bug", "find the module", "draft a fix", "write the changelog"]) ckpt = rec.run_until_step(1) # steps 1 and 2 executed step_3 = rec.prompt_node_ids[2] # the step-3 prompt, still pending real, what_if = DurableAgent(), DurableAgent() real.resume_from(ckpt) what_if.resume_from(DurableAgent.fork(ckpt, step_3, "write a haiku instead")) real.step_outputs() # one generated output per step, in step order what_if.step_outputs() # steps 1-2 identical; steps 3 and 4 differ
Running on a real model (vLLM, Ollama)¶By default ollama pull gemma4 # or: vllm serve <model> --served-model-name gemma4 export VLLM_BASE_URL=http://localhost:11434 PYTHONPATH=python python examples/03_time_travel_fork.py The model id defaults to |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |