AbstractRuntime 0.0.0__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. abstractruntime/__init__.py +104 -2
  2. abstractruntime/core/__init__.py +26 -0
  3. abstractruntime/core/config.py +101 -0
  4. abstractruntime/core/models.py +282 -0
  5. abstractruntime/core/policy.py +166 -0
  6. abstractruntime/core/runtime.py +736 -0
  7. abstractruntime/core/spec.py +53 -0
  8. abstractruntime/core/vars.py +94 -0
  9. abstractruntime/identity/__init__.py +7 -0
  10. abstractruntime/identity/fingerprint.py +57 -0
  11. abstractruntime/integrations/__init__.py +11 -0
  12. abstractruntime/integrations/abstractcore/__init__.py +47 -0
  13. abstractruntime/integrations/abstractcore/effect_handlers.py +119 -0
  14. abstractruntime/integrations/abstractcore/factory.py +187 -0
  15. abstractruntime/integrations/abstractcore/llm_client.py +397 -0
  16. abstractruntime/integrations/abstractcore/logging.py +27 -0
  17. abstractruntime/integrations/abstractcore/tool_executor.py +168 -0
  18. abstractruntime/scheduler/__init__.py +13 -0
  19. abstractruntime/scheduler/convenience.py +324 -0
  20. abstractruntime/scheduler/registry.py +101 -0
  21. abstractruntime/scheduler/scheduler.py +431 -0
  22. abstractruntime/storage/__init__.py +25 -0
  23. abstractruntime/storage/artifacts.py +519 -0
  24. abstractruntime/storage/base.py +107 -0
  25. abstractruntime/storage/in_memory.py +119 -0
  26. abstractruntime/storage/json_files.py +208 -0
  27. abstractruntime/storage/ledger_chain.py +153 -0
  28. abstractruntime/storage/snapshots.py +217 -0
  29. abstractruntime-0.2.0.dist-info/METADATA +163 -0
  30. abstractruntime-0.2.0.dist-info/RECORD +32 -0
  31. {abstractruntime-0.0.0.dist-info → abstractruntime-0.2.0.dist-info}/licenses/LICENSE +3 -1
  32. abstractruntime-0.0.0.dist-info/METADATA +0 -89
  33. abstractruntime-0.0.0.dist-info/RECORD +0 -5
  34. {abstractruntime-0.0.0.dist-info → abstractruntime-0.2.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: AbstractRuntime
3
+ Version: 0.2.0
4
+ Summary: AbstractRuntime: a durable graph runner designed to pair with AbstractCore.
5
+ Project-URL: AbstractCore (website), https://www.abstractcore.ai/
6
+ Project-URL: AbstractCore (GitHub), https://github.com/lpalbou/abstractruntime
7
+ Author: Laurent-Philippe Albou
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: agents,checkpoint,durable,graph,llm,resume,workflow
11
+ Classifier: Development Status :: 1 - Planning
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+
23
+ ## AbstractRuntime
24
+
25
+ **AbstractRuntime** is a low-level **durable workflow runtime**:
26
+ - Execute workflow graphs (state machines)
27
+ - **Interrupt → checkpoint → resume** (hours/days) without keeping Python stacks alive
28
+ - Append-only **ledger** ("journal d’exécution") for audit/debug/provenance
29
+
30
+ **Status**: MVP kernel + file persistence + AbstractCore integration adapters are implemented.
31
+
32
+ ---
33
+
34
+ ### Key concepts
35
+ - **WorkflowSpec**: graph definition (node handlers keyed by id)
36
+ - **RunState**: durable state (`current_node`, `vars`, `waiting`, etc.)
37
+ - **Effect**: a side-effect request (`llm_call`, `tool_calls`, `ask_user`, `wait_event`, ...)
38
+ - **Ledger**: append-only step records (`StepRecord`) describing what happened
39
+
40
+ ---
41
+
42
+ ### Quick start (pause + resume)
43
+
44
+ ```python
45
+ from abstractruntime import Effect, EffectType, Runtime, StepPlan, WorkflowSpec
46
+ from abstractruntime.storage import InMemoryLedgerStore, InMemoryRunStore
47
+
48
+
49
+ def ask(run, ctx):
50
+ return StepPlan(
51
+ node_id="ask",
52
+ effect=Effect(
53
+ type=EffectType.ASK_USER,
54
+ payload={"prompt": "Continue?"},
55
+ result_key="user_answer",
56
+ ),
57
+ next_node="done",
58
+ )
59
+
60
+
61
+ def done(run, ctx):
62
+ return StepPlan(node_id="done", complete_output={"answer": run.vars.get("user_answer")})
63
+
64
+
65
+ wf = WorkflowSpec(workflow_id="demo", entry_node="ask", nodes={"ask": ask, "done": done})
66
+ rt = Runtime(run_store=InMemoryRunStore(), ledger_store=InMemoryLedgerStore())
67
+
68
+ run_id = rt.start(workflow=wf)
69
+ state = rt.tick(workflow=wf, run_id=run_id)
70
+ assert state.status.value == "waiting"
71
+
72
+ state = rt.resume(
73
+ workflow=wf,
74
+ run_id=run_id,
75
+ wait_key=state.waiting.wait_key,
76
+ payload={"text": "yes"},
77
+ )
78
+ assert state.status.value == "completed"
79
+ ```
80
+
81
+ ---
82
+
83
+ ### Built-in Scheduler
84
+
85
+ AbstractRuntime includes a zero-config scheduler for automatic run resumption:
86
+
87
+ ```python
88
+ from abstractruntime import create_scheduled_runtime
89
+
90
+ # Zero-config: defaults to in-memory storage, auto-starts scheduler
91
+ sr = create_scheduled_runtime()
92
+
93
+ # run() does start + tick in one call
94
+ run_id, state = sr.run(my_workflow)
95
+
96
+ # If waiting for user input, respond (auto-finds wait_key)
97
+ if state.status.value == "waiting":
98
+ state = sr.respond(run_id, {"answer": "yes"})
99
+
100
+ # Stop scheduler when done
101
+ sr.stop()
102
+ ```
103
+
104
+ For production with persistent storage:
105
+
106
+ ```python
107
+ from abstractruntime import create_scheduled_runtime, JsonFileRunStore, JsonlLedgerStore
108
+
109
+ sr = create_scheduled_runtime(
110
+ run_store=JsonFileRunStore("./data"),
111
+ ledger_store=JsonlLedgerStore("./data"),
112
+ )
113
+ ```
114
+
115
+ ---
116
+
117
+ ### AbstractCore integration (LLM + tools)
118
+
119
+ AbstractRuntime’s kernel stays dependency-light; AbstractCore integration lives in:
120
+ - `src/abstractruntime/integrations/abstractcore/`
121
+
122
+ Execution modes:
123
+ - **Local**: in-process AbstractCore providers + local tool execution
124
+ - **Remote**: HTTP to AbstractCore server (`/v1/chat/completions`) + tool passthrough (default)
125
+ - **Hybrid**: remote LLM + local tool execution
126
+
127
+ See: `docs/integrations/abstractcore.md`.
128
+
129
+ ---
130
+
131
+ ### Snapshots / bookmarks
132
+
133
+ Snapshots are named, searchable checkpoints of a run state:
134
+ - `Snapshot(snapshot_id, run_id, name, description, tags, run_state)`
135
+
136
+ See: `docs/snapshots.md`.
137
+
138
+ ---
139
+
140
+ ### Provenance (tamper-evident ledger)
141
+
142
+ You can wrap any `LedgerStore` with a hash chain:
143
+
144
+ - `HashChainedLedgerStore(inner_store)`
145
+ - `verify_ledger_chain(records)`
146
+
147
+ This is **tamper-evident**, not non-forgeable (signatures are optional future work).
148
+
149
+ See: `docs/provenance.md`.
150
+
151
+ ---
152
+
153
+ ### Documentation index
154
+
155
+ | Document | Description |
156
+ |----------|-------------|
157
+ | [Proposal](docs/proposal.md) | Design goals, core concepts, and scope |
158
+ | [ROADMAP](ROADMAP.md) | Prioritized next steps with rationale |
159
+ | [ADRs](docs/adr/) | Architectural decisions and their rationale |
160
+ | [Backlog](docs/backlog/) | Completed and planned work items |
161
+ | [Integrations](docs/integrations/) | AbstractCore integration guide |
162
+ | [Snapshots](docs/snapshots.md) | Named checkpoints for run state |
163
+ | [Provenance](docs/provenance.md) | Tamper-evident ledger documentation |
@@ -0,0 +1,32 @@
1
+ abstractruntime/__init__.py,sha256=oobR5VlwZgxJKWr7hmjwVEGgYakHQt4oJNrdxcj6Nsc,2547
2
+ abstractruntime/core/__init__.py,sha256=msUcfYjAwjkiEgvi-twteo1H11oBclYJFXqYVWlf8JQ,547
3
+ abstractruntime/core/config.py,sha256=dQnWCpGL5fFV2y_KOhTjLVu5fzhcOfUnbLjd3uMcRCs,3922
4
+ abstractruntime/core/models.py,sha256=JmuDpM8jjzcr6lc0yv7oBTSrzCtID4Pz21eVDDcQnKk,8142
5
+ abstractruntime/core/policy.py,sha256=C8tmxaY8YCTvs8_5-5Ns6tsFdCVE_G2vHBOiEckeg9Y,5115
6
+ abstractruntime/core/runtime.py,sha256=ZPERZuvtVCBEhWPKXTO2K_7mwnBZd1FAjubp5uiV-Ck,27653
7
+ abstractruntime/core/spec.py,sha256=SBxAFaaIe9eJTRDMEgDub-GaF2McHTDkEgIl3L-DXbE,1461
8
+ abstractruntime/core/vars.py,sha256=ghe9WkjlOuVbIgN86V2RXRVqpd0D9qNmoBz_Xf30hqw,2995
9
+ abstractruntime/identity/__init__.py,sha256=aV_aA6lfqsIQMPE2S0B0AKi0rnb-_vmKYpgv1wWoaq8,119
10
+ abstractruntime/identity/fingerprint.py,sha256=axQFEHSJFsrYGNkikkfEVhNNQxdR8wBmv4TuVbTs0lM,1748
11
+ abstractruntime/integrations/__init__.py,sha256=CnhKNxeT-rCeJRURWOXT8YBZ7HJPOESJROV5cnEwJoQ,408
12
+ abstractruntime/integrations/abstractcore/__init__.py,sha256=txcjiJD7ETRyQMjQQ8zeSrlxpAHAsRjObU7fGLIoNbg,1302
13
+ abstractruntime/integrations/abstractcore/effect_handlers.py,sha256=Zwl5-v6HKgdCUdfuiXOCU3LphKsAL_LxfdSIG4PKudg,4467
14
+ abstractruntime/integrations/abstractcore/factory.py,sha256=r7ZtojoDLObe16gKsp0h04EliVAlbFl8aeXcuw6o9sw,6339
15
+ abstractruntime/integrations/abstractcore/llm_client.py,sha256=KA-GDb8yhcOA93tbNugrtdOPITJQYPsds5IFLe6JdIk,13654
16
+ abstractruntime/integrations/abstractcore/logging.py,sha256=iYmibudvLXs83hhF-dpbgEoyUdzTo8tnT4dV-cC6uyE,683
17
+ abstractruntime/integrations/abstractcore/tool_executor.py,sha256=yZq3txNlm00Xa-m7KfUN3_6ACKXGOZLnyslAI-CA-fs,5528
18
+ abstractruntime/scheduler/__init__.py,sha256=ZwFJQrBN3aQOv7xuGXsURXEEBJAHV6qVQy13DYvbhqw,337
19
+ abstractruntime/scheduler/convenience.py,sha256=Rremvw_P3JMQ-NOkwn7ATlD5HPkKxRtSGJRfBkimyJY,10278
20
+ abstractruntime/scheduler/registry.py,sha256=0iqcTcCV0bYmhw-T7n8TFoZXVkhBRZt89AebXz_Z5fc,2969
21
+ abstractruntime/scheduler/scheduler.py,sha256=Z3dIwz0e7bP7c_S_VoclgY1Fjw7NxFez_wsst-dYVT8,13535
22
+ abstractruntime/storage/__init__.py,sha256=KSg4V-0Ge_BWFnm_a-XsKezNdtUhUBUuvfsvRKUiDUo,702
23
+ abstractruntime/storage/artifacts.py,sha256=xIWR2Es4W4j3w3GJj1L4qrrRG4mkgiUagFucV_Cggio,15570
24
+ abstractruntime/storage/base.py,sha256=QkNjtHRhqRHHg5FbEP9CVNjL97RTFcy4y8vNRPtVVvc,2758
25
+ abstractruntime/storage/in_memory.py,sha256=baSlhu5ZPEFS82PvYwW89n0PbK7JmS1H07qlrPf40rI,3534
26
+ abstractruntime/storage/json_files.py,sha256=txj3deVXlhK2fXFquUEvPfhGCc5k4pxIKVR9FXJIugU,6954
27
+ abstractruntime/storage/ledger_chain.py,sha256=TnAWacQ9e58RAg2vKP8OU6WN8Re1PdqN72g574A2CGA,4717
28
+ abstractruntime/storage/snapshots.py,sha256=-IUlZ40Vxcyl3hKzKk_IxYxm9zumBhkSAzrcL9WpmcU,6481
29
+ abstractruntime-0.2.0.dist-info/METADATA,sha256=eeIBiGaa-l8bYfUj1pqMNKnQGOT08xZ3d41zRDahZ1Q,4997
30
+ abstractruntime-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
31
+ abstractruntime-0.2.0.dist-info/licenses/LICENSE,sha256=6rL4UIO5IdK59THf7fx0q6Hmxp5grSFi7-kWLcczseA,1083
32
+ abstractruntime-0.2.0.dist-info/RECORD,,
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 AbstractRuntime Contributors
3
+ Copyright (c) 2025 Laurent-Philippe Albou
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -21,3 +21,5 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
22
 
23
23
 
24
+
25
+
@@ -1,89 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: AbstractRuntime
3
- Version: 0.0.0
4
- Summary: Placeholder for AbstractRuntime: a durable graph runner designed to pair with AbstractCore.
5
- Project-URL: AbstractCore (website), https://www.abstractcore.ai/
6
- Project-URL: AbstractCore (GitHub), https://github.com/lpalbou/abstractcore
7
- Author: AbstractRuntime Contributors
8
- License: MIT
9
- License-File: LICENSE
10
- Keywords: agents,checkpoint,durable,graph,llm,resume,workflow
11
- Classifier: Development Status :: 1 - Planning
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3 :: Only
16
- Classifier: Programming Language :: Python :: 3.10
17
- Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Programming Language :: Python :: 3.12
19
- Classifier: Programming Language :: Python :: 3.13
20
- Requires-Python: >=3.10
21
- Description-Content-Type: text/markdown
22
-
23
- ## AbstractRuntime
24
-
25
- **Status:** placeholder package (planning stage). **No runtime implementation yet.**
26
-
27
- AbstractRuntime is intended to be a **durable graph runner** designed to pair with **AbstractCore** (unified LLM interface: [website](https://www.abstractcore.ai/), [GitHub](https://github.com/lpalbou/abstractcore)).
28
-
29
- ### Problem this package is meant to solve
30
-
31
- Agentic systems are inherently **multi-step** and frequently **interruptible**:
32
-
33
- - **External calls** (LLM providers, tools, jobs) can fail transiently, time out, or be rate-limited.
34
- - **Human-in-the-loop steps** require pausing, collecting input, and resuming later.
35
- - **Long-running workflows** must survive process restarts and redeploys.
36
-
37
- AbstractRuntime’s goal is to provide a **general-purpose execution substrate** that can:
38
-
39
- - **Interrupt → checkpoint → resume** at *any* step boundary
40
- - Support heterogeneous step types (LLM call, tool call, wait-until time, wait-job, ask-user, subgraph, etc.)
41
- - Maintain a durable **step ledger** (append-only history of attempts and outcomes)
42
-
43
- ### Design targets (intended capabilities)
44
-
45
- - **Durable execution model**
46
- - Steps are executed with **durable state transitions** persisted to storage.
47
- - A run can be safely resumed after crash/restart without losing progress.
48
- - Clear semantics for retries and backoff without “double-applying” effects.
49
-
50
- - **Interrupt / resume primitives**
51
- - Explicit “pause points” for ask-user / wait steps.
52
- - Resume via a stable run identifier + persisted checkpoint.
53
-
54
- - **Step ledger (audit + debugging)**
55
- - Append-only records for: step identity, inputs, outputs, errors, timestamps, attempt numbers, and metadata.
56
- - Designed to support observability, replay analysis, and compliance/audit needs.
57
-
58
- - **Step type extensibility**
59
- - A common “step contract” that can represent:
60
- - LLM calls (with AbstractCore)
61
- - Tool calls (side-effecting or pure)
62
- - Wait-until (time-based scheduling)
63
- - Wait-job (external job orchestration)
64
- - Ask-user (HITL)
65
- - Subgraph / dynamic branching
66
-
67
- - **Storage backends (planned)**
68
- - Pluggable persistence for checkpoints + ledgers (e.g., SQLite/Postgres/file).
69
- - Strong focus on correctness and durability over early optimization.
70
-
71
- ### Relationship to AbstractCore
72
-
73
- AbstractCore provides a **provider-agnostic LLM interface** and media/tooling primitives (see [AbstractCore website](https://www.abstractcore.ai/) and [AbstractCore GitHub](https://github.com/lpalbou/abstractcore)). AbstractRuntime is intended to orchestrate *when* and *how* those calls happen in larger workflows, with durability guarantees.
74
-
75
- ### Non-goals (initially)
76
-
77
- - A full workflow DSL or UI.
78
- - A distributed queue system replacement.
79
- - A specific persistence backend mandate (storage will be abstracted).
80
-
81
- ### Installation
82
-
83
- This package is currently a placeholder for PyPI name reservation and documentation.
84
-
85
- ### License
86
-
87
- MIT (see `LICENSE`).
88
-
89
-
@@ -1,5 +0,0 @@
1
- abstractruntime/__init__.py,sha256=0yfPLNKDzm5Ysix1FCMLU4vN3XHCYAGseoUguAFG1tM,160
2
- abstractruntime-0.0.0.dist-info/METADATA,sha256=bUReg7RLj44aOfeo35ECvTO6v-gLnRDZ8H9buXvv8iU,3904
3
- abstractruntime-0.0.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
4
- abstractruntime-0.0.0.dist-info/licenses/LICENSE,sha256=kzHeLsFARPLuhRrmBfR3ISCnJ8uxrAAAEPDwvbmcE7M,1087
5
- abstractruntime-0.0.0.dist-info/RECORD,,