Esta página foi traduzida por máquina e ainda não foi revisada por uma pessoa. O inglês é a referência; correções são bem-vindas no GitHub. GitHub
Cookwala / SDK e cenários / 058
An execution log records steps and verification, never people
Run part of a shakshuka with a person doing one step, then read the log: each step says who verified it, the human intervention is counted in minutes, consent is none by default and time precision is a day.
Leia primeiro: /docs/CORE/ /docs/HUB/
Passos
Start a shakshuka run with a person present.
startExecutionThe arm cuts; the run waits for a person to heat the pan.
Read the seq.
getExecutionThe person heats the pan and confirms.
resumeExecutionThe heating step completes; the run waits for the next human step.
Stop the run.
stopExecutionThe device completes the stop.
Four steps ran: three verified by the vision sensor, one by the person. The human intervention appears as a kind and minutes, consent.dataset is none, privacy.personalData is none, timePrecision is day.
executionLog
Resultado
You know what a log holds and what it leaves out, which is what makes a research dataset of logs possible with consent. Next: scenario 003 shows the household side of the same principle.
Linha de comando
cookwala hub --recipes examples --speed 200
curl -s http://localhost:7878/v1/executions/ex-2026-10-04-001/logSaída gravada
Status: ok
[1] startExecution: {"core": "0.2.0", "kind": "ExecutionStatus", "id": "ex-058-log", "seq": 0, "state": "accepted", "request": "ex-058-log", "updatedAt": "2026-10-07T00:54:41Z", "x-hub-plan": [{"node": "n1", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n2", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n3", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n4", "op": "cw.op.heat", "by": "human", "verifiedBy": "human"}, {"node": "n5", "op": "cw.op.saute", "by": "huma…
[3] getExecution: {"core": "0.2.0", "kind": "ExecutionStatus", "id": "ex-058-log", "seq": 6, "state": "needs_human", "request": "ex-058-log", "updatedAt": "2026-10-07T00:54:43Z", "x-hub-plan": [{"node": "n1", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n2", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n3", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n4", "op": "cw.op.heat", "by": "human", "verifiedBy": "human"}, {"node": "n5", "op": "cw.op.saute", "by": "h…
[4] resumeExecution: {"core": "0.2.0", "kind": "ExecutionStatus", "id": "ex-058-log", "seq": 7, "state": "running", "request": "ex-058-log", "updatedAt": "2026-10-07T00:54:45Z", "x-hub-plan": [{"node": "n1", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n2", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n3", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n4", "op": "cw.op.heat", "by": "human", "verifiedBy": "human"}, {"node": "n5", "op": "cw.op.saute", "by": "human…
[6] stopExecution: {"core": "0.2.0", "kind": "ExecutionStatus", "id": "ex-058-log", "seq": 9, "state": "stopping", "request": "ex-058-log", "updatedAt": "2026-10-07T00:54:47Z", "x-hub-plan": [{"node": "n1", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n2", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n3", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n4", "op": "cw.op.heat", "by": "human", "verifiedBy": "human"}, {"node": "n5", "op": "cw.op.saute", "by": "huma…
[8] executionLog: {"core": "0.2.0", "kind": "ExecutionLog", "id": "log-ex-058-log", "recipe": "cw:cookwala.ai:example-shakshuka", "recipeHash": "sha256:2ea6fab93cc673fc6784f9bc9fe401d2387bb7779dc537df97286b73807c8841", "device": {"vendor": "Example Robotics", "model": "CounterArm 2", "firmware": "hub-0.1", "safetyLimits": "[email protected]"}, "startedAt": "2026-10-07T00:54:41Z", "endedAt": "2026-10-07T00:54:47Z", "outcome": "aborted_safe", "servings": 4, "steps": [{"node": "n1", "op": "cw.op.cut", "verifiedBy": "sensor", "envelopeOk": true, "startedAt": "2026-10-07T00:54:41Z", "endedAt": "2026-10-07T00:54…Código
Executar: python scenarios/out/058-the-log-carries-no-personal-data/python.py
# Scenario 058: An execution log records steps and verification, never people
# Run part of a shakshuka with a person doing one step, then read the log: each step says who verified it, the human intervention is counted in minutes, consent is none by default and time precision is a day.
# Run a hub first: python hub/cookwala_hub.py --recipes examples
import json, os
from cookwala.client import CookwalaClient, CookwalaProblem
def load(path):
with open(path, encoding="utf-8") as f:
return json.load(f)
def pick(obj, path):
for part in path.replace("]", "").replace("[", ".").split("."):
obj = obj[int(part)] if part.isdigit() else (len(obj) if part == "length" else obj.get(part))
return obj
c = CookwalaClient(os.environ.get("COOKWALA_HUB", "http://localhost:7878"))
# Step 1: Start a shakshuka run with a person present.
try:
started = c.start_execution({"core": "0.2.0", "kind": "ExecuteRequest", "id": "ex-058-log", "recipe": "cw:cookwala.ai:example-shakshuka", "recipeHash": "sha256:2ea6fab93cc673fc6784f9bc9fe401d2387bb7779dc537df97286b73807c8841", "servings": 4, "requestedBy": "agent:planner-1", "idempotencyKey": "ex-058-log-a"}, "ex-058-log-key", True)
except CookwalaProblem as p:
started = p.body # a refusal is a result, not a crash
print("refused:", p.refusal)
assert pick(started, "state") == "accepted", pick(started, "state")
print("ok", "state", "=", "accepted")
# Step 2: The arm cuts; the run waits for a person to heat the pan.
import time; time.sleep(4)
# Step 3: Read the seq.
status = c.get_execution("ex-058-log")
assert pick(status, "state") == "needs_human", pick(status, "state")
print("ok", "state", "=", "needs_human")
# Step 4: The person heats the pan and confirms.
try:
resumed = c.resume_execution("ex-058-log", pick(status, "seq"))
except CookwalaProblem as p:
resumed = p.body # a refusal is a result, not a crash
print("refused:", p.refusal)
assert pick(resumed, "state") == "running", pick(resumed, "state")
print("ok", "state", "=", "running")
# Step 5: The heating step completes; the run waits for the next human step.
import time; time.sleep(2)
# Step 6: Stop the run.
try:
stop = c.stop_execution("ex-058-log", "enough for the log")
except CookwalaProblem as p:
stop = p.body # a refusal is a result, not a crash
print("refused:", p.refusal)
assert pick(stop, "state") == "stopping", pick(stop, "state")
print("ok", "state", "=", "stopping")
# Step 7: The device completes the stop.
import time; time.sleep(1.5)
# Step 8: Four steps ran: three verified by the vision sensor, one by the person. The human intervention appears as a kind and minutes, consent.dataset is none, privacy.personalData is none, timePrecision is day.
log = c.execution_log("ex-058-log")
assert pick(log, "steps.length") == 4, pick(log, "steps.length")
print("ok", "steps.length", "=", 4)
assert pick(log, "steps[0].verifiedBy") == "sensor", pick(log, "steps[0].verifiedBy")
print("ok", "steps[0].verifiedBy", "=", "sensor")
assert pick(log, "steps[3].verifiedBy") == "human", pick(log, "steps[3].verifiedBy")
print("ok", "steps[3].verifiedBy", "=", "human")
assert pick(log, "steps[3].op") == "cw.op.heat", pick(log, "steps[3].op")
print("ok", "steps[3].op", "=", "cw.op.heat")
assert pick(log, "humanInterventions.length") == 1, pick(log, "humanInterventions.length")
print("ok", "humanInterventions.length", "=", 1)
assert pick(log, "consent.dataset") == "none", pick(log, "consent.dataset")
print("ok", "consent.dataset", "=", "none")
assert pick(log, "consent.withdrawable") == True, pick(log, "consent.withdrawable")
print("ok", "consent.withdrawable", "=", True)
assert pick(log, "privacy.personalData") == "none", pick(log, "privacy.personalData")
print("ok", "privacy.personalData", "=", "none")
assert pick(log, "privacy.timePrecision") == "day", pick(log, "privacy.timePrecision")
print("ok", "privacy.timePrecision", "=", "day")
print("scenario complete")