AbstractRuntime 0.2.0__py3-none-any.whl → 0.4.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 (36) hide show
  1. abstractruntime/__init__.py +7 -2
  2. abstractruntime/core/config.py +14 -1
  3. abstractruntime/core/event_keys.py +62 -0
  4. abstractruntime/core/models.py +12 -1
  5. abstractruntime/core/runtime.py +2444 -14
  6. abstractruntime/core/vars.py +95 -0
  7. abstractruntime/evidence/__init__.py +10 -0
  8. abstractruntime/evidence/recorder.py +325 -0
  9. abstractruntime/integrations/abstractcore/__init__.py +3 -0
  10. abstractruntime/integrations/abstractcore/constants.py +19 -0
  11. abstractruntime/integrations/abstractcore/default_tools.py +134 -0
  12. abstractruntime/integrations/abstractcore/effect_handlers.py +255 -6
  13. abstractruntime/integrations/abstractcore/factory.py +95 -10
  14. abstractruntime/integrations/abstractcore/llm_client.py +456 -52
  15. abstractruntime/integrations/abstractcore/mcp_worker.py +586 -0
  16. abstractruntime/integrations/abstractcore/observability.py +80 -0
  17. abstractruntime/integrations/abstractcore/summarizer.py +154 -0
  18. abstractruntime/integrations/abstractcore/tool_executor.py +481 -24
  19. abstractruntime/memory/__init__.py +21 -0
  20. abstractruntime/memory/active_context.py +746 -0
  21. abstractruntime/memory/active_memory.py +452 -0
  22. abstractruntime/memory/compaction.py +105 -0
  23. abstractruntime/rendering/__init__.py +17 -0
  24. abstractruntime/rendering/agent_trace_report.py +256 -0
  25. abstractruntime/rendering/json_stringify.py +136 -0
  26. abstractruntime/scheduler/scheduler.py +93 -2
  27. abstractruntime/storage/__init__.py +3 -1
  28. abstractruntime/storage/artifacts.py +20 -5
  29. abstractruntime/storage/json_files.py +15 -2
  30. abstractruntime/storage/observable.py +99 -0
  31. {abstractruntime-0.2.0.dist-info → abstractruntime-0.4.0.dist-info}/METADATA +5 -1
  32. abstractruntime-0.4.0.dist-info/RECORD +49 -0
  33. abstractruntime-0.4.0.dist-info/entry_points.txt +2 -0
  34. abstractruntime-0.2.0.dist-info/RECORD +0 -32
  35. {abstractruntime-0.2.0.dist-info → abstractruntime-0.4.0.dist-info}/WHEEL +0 -0
  36. {abstractruntime-0.2.0.dist-info → abstractruntime-0.4.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,99 @@
1
+ """abstractruntime.storage.observable
2
+
3
+ In-process pub/sub for ledger append events.
4
+
5
+ Design intent:
6
+ - Keep AbstractRuntime kernel dependency-light (stdlib only).
7
+ - Treat the ledger as the durable source of truth (replay via `list(run_id)`).
8
+ - Provide a small, optional subscription surface for live UX (WS/CLI) without
9
+ introducing a second global event system.
10
+
11
+ This is intentionally *process-local* (no cross-process guarantees).
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ from dataclasses import asdict
17
+ import threading
18
+ from typing import Any, Callable, Dict, List, Optional, Protocol, runtime_checkable
19
+
20
+ from .base import LedgerStore
21
+ from ..core.models import StepRecord
22
+
23
+
24
+ LedgerRecordDict = Dict[str, Any]
25
+ LedgerSubscriber = Callable[[LedgerRecordDict], None]
26
+
27
+
28
+ @runtime_checkable
29
+ class ObservableLedgerStoreProtocol(Protocol):
30
+ """Optional LedgerStore extension for in-process subscriptions."""
31
+
32
+ def subscribe(
33
+ self,
34
+ callback: LedgerSubscriber,
35
+ *,
36
+ run_id: Optional[str] = None,
37
+ ) -> Callable[[], None]:
38
+ """Subscribe to appended ledger records.
39
+
40
+ Args:
41
+ callback: Called after each append with a JSON-safe record dict.
42
+ run_id: If set, only receive records for that run.
43
+
44
+ Returns:
45
+ An unsubscribe callback.
46
+ """
47
+ ...
48
+
49
+
50
+ class ObservableLedgerStore(LedgerStore):
51
+ """LedgerStore decorator that notifies subscribers on append()."""
52
+
53
+ def __init__(self, inner: LedgerStore):
54
+ self._inner = inner
55
+ self._lock = threading.Lock()
56
+ self._subscribers: list[tuple[Optional[str], LedgerSubscriber]] = []
57
+
58
+ def append(self, record: StepRecord) -> None:
59
+ self._inner.append(record)
60
+
61
+ payload: LedgerRecordDict = asdict(record)
62
+ with self._lock:
63
+ subscribers = list(self._subscribers)
64
+
65
+ for run_id, callback in subscribers:
66
+ if run_id is not None and run_id != record.run_id:
67
+ continue
68
+ try:
69
+ callback(payload)
70
+ except Exception:
71
+ # Observability must never compromise durability/execution.
72
+ continue
73
+
74
+ def list(self, run_id: str) -> List[LedgerRecordDict]:
75
+ return self._inner.list(run_id)
76
+
77
+ def subscribe(
78
+ self,
79
+ callback: LedgerSubscriber,
80
+ *,
81
+ run_id: Optional[str] = None,
82
+ ) -> Callable[[], None]:
83
+ with self._lock:
84
+ self._subscribers.append((run_id, callback))
85
+
86
+ def _unsubscribe() -> None:
87
+ with self._lock:
88
+ try:
89
+ self._subscribers.remove((run_id, callback))
90
+ except ValueError:
91
+ return
92
+
93
+ return _unsubscribe
94
+
95
+ def clear_subscribers(self) -> None:
96
+ """Clear all subscribers (test utility)."""
97
+ with self._lock:
98
+ self._subscribers.clear()
99
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AbstractRuntime
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: AbstractRuntime: a durable graph runner designed to pair with AbstractCore.
5
5
  Project-URL: AbstractCore (website), https://www.abstractcore.ai/
6
6
  Project-URL: AbstractCore (GitHub), https://github.com/lpalbou/abstractruntime
@@ -18,6 +18,10 @@ Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
20
  Requires-Python: >=3.10
21
+ Provides-Extra: abstractcore
22
+ Requires-Dist: abstractcore>=2.6.8; extra == 'abstractcore'
23
+ Provides-Extra: mcp-worker
24
+ Requires-Dist: abstractcore[tools]>=2.6.8; extra == 'mcp-worker'
21
25
  Description-Content-Type: text/markdown
22
26
 
23
27
  ## AbstractRuntime
@@ -0,0 +1,49 @@
1
+ abstractruntime/__init__.py,sha256=hO9d8o5R-9TF7TrxybMdRvtE0jQBO7t2nkMkZQDEnnY,2804
2
+ abstractruntime/core/__init__.py,sha256=msUcfYjAwjkiEgvi-twteo1H11oBclYJFXqYVWlf8JQ,547
3
+ abstractruntime/core/config.py,sha256=U8cZbovq8dNI_7NaPkKiBwuGxABezhqytrN1L_lASJs,4672
4
+ abstractruntime/core/event_keys.py,sha256=5YECNuMkJV_pCGGV5uXzNU5LtGIy2Nu1I9JKiLrZb_c,1782
5
+ abstractruntime/core/models.py,sha256=-vYRcnm2G5PL8LsAhNU7rEyGHAzVpmHjLnn3hGCy0Dc,8490
6
+ abstractruntime/core/policy.py,sha256=C8tmxaY8YCTvs8_5-5Ns6tsFdCVE_G2vHBOiEckeg9Y,5115
7
+ abstractruntime/core/runtime.py,sha256=XeipSjlShb5P6ZT1ak7BFPiKAkiJtdoNfSWYL5QZZuA,130066
8
+ abstractruntime/core/spec.py,sha256=SBxAFaaIe9eJTRDMEgDub-GaF2McHTDkEgIl3L-DXbE,1461
9
+ abstractruntime/core/vars.py,sha256=SdDRpHVf4LL5PyHIn7QFx82Gc9HMgnPKis82QZWLMFk,6178
10
+ abstractruntime/evidence/__init__.py,sha256=pSfu8fdvvjGKclJdQ-5dUVc4KIDKLSq_MpOTDSQFvw0,212
11
+ abstractruntime/evidence/recorder.py,sha256=oqMDDqs6vj_DZDpLZrnHC9zhQo0Yzm28qKu1_HHrL_A,12894
12
+ abstractruntime/identity/__init__.py,sha256=aV_aA6lfqsIQMPE2S0B0AKi0rnb-_vmKYpgv1wWoaq8,119
13
+ abstractruntime/identity/fingerprint.py,sha256=axQFEHSJFsrYGNkikkfEVhNNQxdR8wBmv4TuVbTs0lM,1748
14
+ abstractruntime/integrations/__init__.py,sha256=CnhKNxeT-rCeJRURWOXT8YBZ7HJPOESJROV5cnEwJoQ,408
15
+ abstractruntime/integrations/abstractcore/__init__.py,sha256=7i-vqiXabK5gZnyUUqs_jKzfjGCJLFwC92BpTq06XWQ,1440
16
+ abstractruntime/integrations/abstractcore/constants.py,sha256=INu273hahMySNiNUIqUK7HhbXs-oJe0OjbsYyXiU92U,690
17
+ abstractruntime/integrations/abstractcore/default_tools.py,sha256=AQikJhja0ejy918oRMwh6o7rEPk1zokuEpy9VxxvK5Y,4209
18
+ abstractruntime/integrations/abstractcore/effect_handlers.py,sha256=8AM3LuKYTu5bwS7hL9BOM5IMh-2i-ajj8O1mqjYNXO0,15381
19
+ abstractruntime/integrations/abstractcore/factory.py,sha256=9T0369jNtDghPH2zaTbuUE1zKIqvBYxglDaCpTorwcc,9894
20
+ abstractruntime/integrations/abstractcore/llm_client.py,sha256=6W1uB6tW3p_X7m63e8vegpQceHqZUbscKtw46wBrXG4,29625
21
+ abstractruntime/integrations/abstractcore/logging.py,sha256=iYmibudvLXs83hhF-dpbgEoyUdzTo8tnT4dV-cC6uyE,683
22
+ abstractruntime/integrations/abstractcore/mcp_worker.py,sha256=rB2f0xbxA-WgnV44VBkonHR44inH0hxXZSVMrbwbo5Q,22514
23
+ abstractruntime/integrations/abstractcore/observability.py,sha256=YPTBrr5IPr7vCgBoClNaxTo09M1MdVko4OEN3lMxrpc,2527
24
+ abstractruntime/integrations/abstractcore/summarizer.py,sha256=lobota-K5mKMbDBgxIXczK_SHGmhZ832VwIMgtSvagw,5431
25
+ abstractruntime/integrations/abstractcore/tool_executor.py,sha256=LbA4GilPfbNYUAZv404fUCzjs2h_WTWZBpkBTMKWHrU,23646
26
+ abstractruntime/memory/__init__.py,sha256=0Ew8Z4z0vttW0rLYc6FnysU0UXFEtE6eDUf7kC_0MK0,689
27
+ abstractruntime/memory/active_context.py,sha256=py5_LZpUQ83blC-62SPh_-tDC8-iKAwSiJo9RpQ893A,28565
28
+ abstractruntime/memory/active_memory.py,sha256=hJy5ssx_fi4nTcoVlAFG3qZz4OzOczVC0Benxduw6CE,16565
29
+ abstractruntime/memory/compaction.py,sha256=oZfjfsM9CzLT0xWv4jmWkKIgq3FWh20RAniY-pc7Oxg,3505
30
+ abstractruntime/rendering/__init__.py,sha256=SgOW1wRic90sMVRKseATR4h6-9LZrx9FOlNA8t2XpyM,491
31
+ abstractruntime/rendering/agent_trace_report.py,sha256=SqEl4oj4s1YVfsO_GLK3XdFO-aKnH6yNlb-eqGsm9TE,9458
32
+ abstractruntime/rendering/json_stringify.py,sha256=llYWiNR9Ywu41V1ly0GGjLZO2BqmaG2bwEjfLXtBTDg,4198
33
+ abstractruntime/scheduler/__init__.py,sha256=ZwFJQrBN3aQOv7xuGXsURXEEBJAHV6qVQy13DYvbhqw,337
34
+ abstractruntime/scheduler/convenience.py,sha256=Rremvw_P3JMQ-NOkwn7ATlD5HPkKxRtSGJRfBkimyJY,10278
35
+ abstractruntime/scheduler/registry.py,sha256=0iqcTcCV0bYmhw-T7n8TFoZXVkhBRZt89AebXz_Z5fc,2969
36
+ abstractruntime/scheduler/scheduler.py,sha256=TSIz0sZeH-O7Vb3RSBsXv9qKrD62ttg_pMecYHAwKyE,16570
37
+ abstractruntime/storage/__init__.py,sha256=z1qmXdUm9q_5iCi2J9_KIGoTCWxQG4-_WSi5u3AoJUM,844
38
+ abstractruntime/storage/artifacts.py,sha256=bvVTLMOpauNyz2_fT4MGXiuB8Ill-_y9zkWQ7OxNQe4,16129
39
+ abstractruntime/storage/base.py,sha256=QkNjtHRhqRHHg5FbEP9CVNjL97RTFcy4y8vNRPtVVvc,2758
40
+ abstractruntime/storage/in_memory.py,sha256=baSlhu5ZPEFS82PvYwW89n0PbK7JmS1H07qlrPf40rI,3534
41
+ abstractruntime/storage/json_files.py,sha256=Mhrq7SeWC4RYkPlflcUuVzbEskLUVfc4LdIghOr23Ko,7459
42
+ abstractruntime/storage/ledger_chain.py,sha256=TnAWacQ9e58RAg2vKP8OU6WN8Re1PdqN72g574A2CGA,4717
43
+ abstractruntime/storage/observable.py,sha256=B0MK5GKsU7wdfF8Fkj7si7ivToKJCZXaF3AnPwOM5qM,2897
44
+ abstractruntime/storage/snapshots.py,sha256=-IUlZ40Vxcyl3hKzKk_IxYxm9zumBhkSAzrcL9WpmcU,6481
45
+ abstractruntime-0.4.0.dist-info/METADATA,sha256=e8XN94ocwrmd4kcxTHSRaQOGoNqdLZNgaYSKupWLo6Q,5178
46
+ abstractruntime-0.4.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
47
+ abstractruntime-0.4.0.dist-info/entry_points.txt,sha256=4-KMU85GJkTOEBN3cNI7bvzwwhqAvGMCzup6RM-ZiCI,105
48
+ abstractruntime-0.4.0.dist-info/licenses/LICENSE,sha256=6rL4UIO5IdK59THf7fx0q6Hmxp5grSFi7-kWLcczseA,1083
49
+ abstractruntime-0.4.0.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ abstractruntime-mcp-worker = abstractruntime.integrations.abstractcore.mcp_worker:main
@@ -1,32 +0,0 @@
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,,