Skip to main content

AbstractRuntime: a durable graph runner designed to pair with AbstractCore.

Project description

AbstractRuntime

AbstractRuntime is a low-level durable workflow runtime:

  • Execute workflow graphs (state machines)
  • Interrupt → checkpoint → resume (hours/days) without keeping Python stacks alive
  • Append-only ledger ("journal d’exécution") for audit/debug/provenance

Status: MVP kernel + file persistence + AbstractCore integration adapters are implemented.


Key concepts

  • WorkflowSpec: graph definition (node handlers keyed by id)
  • RunState: durable state (current_node, vars, waiting, etc.)
  • Effect: a side-effect request (llm_call, tool_calls, ask_user, wait_event, ...)
  • Ledger: append-only step records (StepRecord) describing what happened

Quick start (pause + resume)

from abstractruntime import Effect, EffectType, Runtime, StepPlan, WorkflowSpec
from abstractruntime.storage import InMemoryLedgerStore, InMemoryRunStore


def ask(run, ctx):
    return StepPlan(
        node_id="ask",
        effect=Effect(
            type=EffectType.ASK_USER,
            payload={"prompt": "Continue?"},
            result_key="user_answer",
        ),
        next_node="done",
    )


def done(run, ctx):
    return StepPlan(node_id="done", complete_output={"answer": run.vars.get("user_answer")})


wf = WorkflowSpec(workflow_id="demo", entry_node="ask", nodes={"ask": ask, "done": done})
rt = Runtime(run_store=InMemoryRunStore(), ledger_store=InMemoryLedgerStore())

run_id = rt.start(workflow=wf)
state = rt.tick(workflow=wf, run_id=run_id)
assert state.status.value == "waiting"

state = rt.resume(
    workflow=wf,
    run_id=run_id,
    wait_key=state.waiting.wait_key,
    payload={"text": "yes"},
)
assert state.status.value == "completed"

Built-in Scheduler

AbstractRuntime includes a zero-config scheduler for automatic run resumption:

from abstractruntime import create_scheduled_runtime

# Zero-config: defaults to in-memory storage, auto-starts scheduler
sr = create_scheduled_runtime()

# run() does start + tick in one call
run_id, state = sr.run(my_workflow)

# If waiting for user input, respond (auto-finds wait_key)
if state.status.value == "waiting":
    state = sr.respond(run_id, {"answer": "yes"})

# Stop scheduler when done
sr.stop()

For production with persistent storage:

from abstractruntime import create_scheduled_runtime, JsonFileRunStore, JsonlLedgerStore

sr = create_scheduled_runtime(
    run_store=JsonFileRunStore("./data"),
    ledger_store=JsonlLedgerStore("./data"),
)

AbstractCore integration (LLM + tools)

AbstractRuntime’s kernel stays dependency-light; AbstractCore integration lives in:

  • src/abstractruntime/integrations/abstractcore/

Execution modes:

  • Local: in-process AbstractCore providers + local tool execution
  • Remote: HTTP to AbstractCore server (/v1/chat/completions) + tool passthrough (default)
  • Hybrid: remote LLM + local tool execution

See: docs/integrations/abstractcore.md.


Snapshots / bookmarks

Snapshots are named, searchable checkpoints of a run state:

  • Snapshot(snapshot_id, run_id, name, description, tags, run_state)

See: docs/snapshots.md.


Provenance (tamper-evident ledger)

You can wrap any LedgerStore with a hash chain:

  • HashChainedLedgerStore(inner_store)
  • verify_ledger_chain(records)

This is tamper-evident, not non-forgeable (signatures are optional future work).

See: docs/provenance.md.


Documentation index

Document Description
Proposal Design goals, core concepts, and scope
ROADMAP Prioritized next steps with rationale
ADRs Architectural decisions and their rationale
Backlog Completed and planned work items
Integrations AbstractCore integration guide
Snapshots Named checkpoints for run state
Provenance Tamper-evident ledger documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abstractruntime-0.2.0.tar.gz (120.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

abstractruntime-0.2.0-py3-none-any.whl (52.7 kB view details)

Uploaded Python 3

File details

Details for the file abstractruntime-0.2.0.tar.gz.

File metadata

  • Download URL: abstractruntime-0.2.0.tar.gz
  • Upload date:
  • Size: 120.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for abstractruntime-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8be8117fcc216ea4200864c315950909020f48e60e494debd81b151bfc9d466e
MD5 558d9abbf0ce13ae1442359f0b68e99e
BLAKE2b-256 9e915e766cf790faf127887073f1084cc6a223af953bb1099f844f120b677529

See more details on using hashes here.

File details

Details for the file abstractruntime-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for abstractruntime-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe224299e3554a9e91997f579d38202b8e19922453d6a4f5c7b7d97380d61852
MD5 d445d661c2f78fff43eb16f49de811b9
BLAKE2b-256 4384e1998764ac35501c26d4ece2aeaa85be373cea05c65ec1a68aa9dcf5c668

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page