AbstractRuntime 0.4.0__py3-none-any.whl → 0.4.1__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 (65) hide show
  1. abstractruntime/__init__.py +76 -1
  2. abstractruntime/core/config.py +68 -1
  3. abstractruntime/core/models.py +5 -0
  4. abstractruntime/core/policy.py +74 -3
  5. abstractruntime/core/runtime.py +1002 -126
  6. abstractruntime/core/vars.py +8 -2
  7. abstractruntime/evidence/recorder.py +1 -1
  8. abstractruntime/history_bundle.py +772 -0
  9. abstractruntime/integrations/abstractcore/__init__.py +3 -0
  10. abstractruntime/integrations/abstractcore/default_tools.py +127 -3
  11. abstractruntime/integrations/abstractcore/effect_handlers.py +2440 -99
  12. abstractruntime/integrations/abstractcore/embeddings_client.py +69 -0
  13. abstractruntime/integrations/abstractcore/factory.py +68 -20
  14. abstractruntime/integrations/abstractcore/llm_client.py +447 -15
  15. abstractruntime/integrations/abstractcore/mcp_worker.py +1 -0
  16. abstractruntime/integrations/abstractcore/session_attachments.py +946 -0
  17. abstractruntime/integrations/abstractcore/tool_executor.py +31 -10
  18. abstractruntime/integrations/abstractcore/workspace_scoped_tools.py +561 -0
  19. abstractruntime/integrations/abstractmemory/__init__.py +3 -0
  20. abstractruntime/integrations/abstractmemory/effect_handlers.py +946 -0
  21. abstractruntime/memory/active_context.py +6 -1
  22. abstractruntime/memory/kg_packets.py +164 -0
  23. abstractruntime/memory/memact_composer.py +175 -0
  24. abstractruntime/memory/recall_levels.py +163 -0
  25. abstractruntime/memory/token_budget.py +86 -0
  26. abstractruntime/storage/__init__.py +4 -1
  27. abstractruntime/storage/artifacts.py +158 -30
  28. abstractruntime/storage/base.py +17 -1
  29. abstractruntime/storage/commands.py +339 -0
  30. abstractruntime/storage/in_memory.py +41 -1
  31. abstractruntime/storage/json_files.py +195 -12
  32. abstractruntime/storage/observable.py +38 -1
  33. abstractruntime/storage/offloading.py +433 -0
  34. abstractruntime/storage/sqlite.py +836 -0
  35. abstractruntime/visualflow_compiler/__init__.py +29 -0
  36. abstractruntime/visualflow_compiler/adapters/__init__.py +11 -0
  37. abstractruntime/visualflow_compiler/adapters/agent_adapter.py +126 -0
  38. abstractruntime/visualflow_compiler/adapters/context_adapter.py +109 -0
  39. abstractruntime/visualflow_compiler/adapters/control_adapter.py +615 -0
  40. abstractruntime/visualflow_compiler/adapters/effect_adapter.py +1051 -0
  41. abstractruntime/visualflow_compiler/adapters/event_adapter.py +307 -0
  42. abstractruntime/visualflow_compiler/adapters/function_adapter.py +97 -0
  43. abstractruntime/visualflow_compiler/adapters/memact_adapter.py +114 -0
  44. abstractruntime/visualflow_compiler/adapters/subflow_adapter.py +74 -0
  45. abstractruntime/visualflow_compiler/adapters/variable_adapter.py +316 -0
  46. abstractruntime/visualflow_compiler/compiler.py +3832 -0
  47. abstractruntime/visualflow_compiler/flow.py +247 -0
  48. abstractruntime/visualflow_compiler/visual/__init__.py +13 -0
  49. abstractruntime/visualflow_compiler/visual/agent_ids.py +29 -0
  50. abstractruntime/visualflow_compiler/visual/builtins.py +1376 -0
  51. abstractruntime/visualflow_compiler/visual/code_executor.py +214 -0
  52. abstractruntime/visualflow_compiler/visual/executor.py +2804 -0
  53. abstractruntime/visualflow_compiler/visual/models.py +211 -0
  54. abstractruntime/workflow_bundle/__init__.py +52 -0
  55. abstractruntime/workflow_bundle/models.py +236 -0
  56. abstractruntime/workflow_bundle/packer.py +317 -0
  57. abstractruntime/workflow_bundle/reader.py +87 -0
  58. abstractruntime/workflow_bundle/registry.py +587 -0
  59. abstractruntime-0.4.1.dist-info/METADATA +177 -0
  60. abstractruntime-0.4.1.dist-info/RECORD +86 -0
  61. abstractruntime-0.4.0.dist-info/METADATA +0 -167
  62. abstractruntime-0.4.0.dist-info/RECORD +0 -49
  63. {abstractruntime-0.4.0.dist-info → abstractruntime-0.4.1.dist-info}/WHEEL +0 -0
  64. {abstractruntime-0.4.0.dist-info → abstractruntime-0.4.1.dist-info}/entry_points.txt +0 -0
  65. {abstractruntime-0.4.0.dist-info → abstractruntime-0.4.1.dist-info}/licenses/LICENSE +0 -0
@@ -275,7 +275,7 @@ class MappingToolExecutor:
275
275
  return cleaned or text
276
276
  return None
277
277
 
278
- def _append_result(*, call_id: str, name: str, output: Any) -> None:
278
+ def _append_result(*, call_id: str, runtime_call_id: Optional[str], name: str, output: Any) -> None:
279
279
  error = _error_from_output(output)
280
280
  if error is not None:
281
281
  # Preserve structured outputs for provenance/evidence. For string-only error outputs
@@ -284,6 +284,7 @@ class MappingToolExecutor:
284
284
  results.append(
285
285
  {
286
286
  "call_id": call_id,
287
+ "runtime_call_id": runtime_call_id,
287
288
  "name": name,
288
289
  "success": False,
289
290
  "output": output_json,
@@ -295,6 +296,7 @@ class MappingToolExecutor:
295
296
  results.append(
296
297
  {
297
298
  "call_id": call_id,
299
+ "runtime_call_id": runtime_call_id,
298
300
  "name": name,
299
301
  "success": True,
300
302
  "output": _jsonable(output),
@@ -307,12 +309,16 @@ class MappingToolExecutor:
307
309
  raw_arguments = tc.get("arguments") or {}
308
310
  arguments = dict(raw_arguments) if isinstance(raw_arguments, dict) else (_loads_dict_like(raw_arguments) or {})
309
311
  call_id = str(tc.get("call_id") or "")
312
+ runtime_call_id = tc.get("runtime_call_id")
313
+ runtime_call_id_str = str(runtime_call_id).strip() if runtime_call_id is not None else ""
314
+ runtime_call_id_out = runtime_call_id_str or None
310
315
 
311
316
  func = self._tool_map.get(name)
312
317
  if func is None:
313
318
  results.append(
314
319
  {
315
320
  "call_id": call_id,
321
+ "runtime_call_id": runtime_call_id_out,
316
322
  "name": name,
317
323
  "success": False,
318
324
  "output": None,
@@ -335,11 +341,12 @@ class MappingToolExecutor:
335
341
 
336
342
  ok, output, err = _call_with_timeout(_invoke, timeout_s=self._timeout_s)
337
343
  if ok:
338
- _append_result(call_id=call_id, name=name, output=output)
344
+ _append_result(call_id=call_id, runtime_call_id=runtime_call_id_out, name=name, output=output)
339
345
  else:
340
346
  results.append(
341
347
  {
342
348
  "call_id": call_id,
349
+ "runtime_call_id": runtime_call_id_out,
343
350
  "name": name,
344
351
  "success": False,
345
352
  "output": None,
@@ -386,23 +393,29 @@ class AbstractCoreToolExecutor:
386
393
  from abstractcore.tools.core import ToolCall
387
394
  from abstractcore.tools.registry import execute_tool
388
395
 
389
- calls = [
390
- ToolCall(
391
- name=str(tc.get("name")),
392
- arguments=dict(tc.get("arguments") or {}),
393
- call_id=tc.get("call_id"),
396
+ calls: list[ToolCall] = []
397
+ runtime_call_ids: list[Optional[str]] = []
398
+ for tc in tool_calls:
399
+ calls.append(
400
+ ToolCall(
401
+ name=str(tc.get("name")),
402
+ arguments=dict(tc.get("arguments") or {}),
403
+ call_id=tc.get("call_id"),
404
+ )
394
405
  )
395
- for tc in tool_calls
396
- ]
406
+ runtime_call_id = tc.get("runtime_call_id")
407
+ runtime_call_id_str = str(runtime_call_id).strip() if runtime_call_id is not None else ""
408
+ runtime_call_ids.append(runtime_call_id_str or None)
397
409
 
398
410
  normalized = []
399
- for call in calls:
411
+ for call, runtime_call_id in zip(calls, runtime_call_ids):
400
412
  ok, out, err = _call_with_timeout(lambda c=call: execute_tool(c), timeout_s=self._timeout_s)
401
413
  if ok:
402
414
  r = out
403
415
  normalized.append(
404
416
  {
405
417
  "call_id": getattr(r, "call_id", "") if r is not None else "",
418
+ "runtime_call_id": runtime_call_id,
406
419
  "name": getattr(call, "name", ""),
407
420
  "success": bool(getattr(r, "success", False)) if r is not None else True,
408
421
  "output": _jsonable(getattr(r, "output", None)) if r is not None else None,
@@ -414,6 +427,7 @@ class AbstractCoreToolExecutor:
414
427
  normalized.append(
415
428
  {
416
429
  "call_id": str(getattr(call, "call_id", "") or ""),
430
+ "runtime_call_id": runtime_call_id,
417
431
  "name": getattr(call, "name", ""),
418
432
  "success": False,
419
433
  "output": None,
@@ -520,6 +534,9 @@ class McpToolExecutor:
520
534
  for tc in tool_calls:
521
535
  name = str(tc.get("name", "") or "")
522
536
  call_id = str(tc.get("call_id") or "")
537
+ runtime_call_id = tc.get("runtime_call_id")
538
+ runtime_call_id_str = str(runtime_call_id).strip() if runtime_call_id is not None else ""
539
+ runtime_call_id_out = runtime_call_id_str or None
523
540
  raw_arguments = tc.get("arguments") or {}
524
541
  arguments = dict(raw_arguments) if isinstance(raw_arguments, dict) else {}
525
542
 
@@ -531,6 +548,7 @@ class McpToolExecutor:
531
548
  results.append(
532
549
  {
533
550
  "call_id": call_id,
551
+ "runtime_call_id": runtime_call_id_out,
534
552
  "name": name,
535
553
  "success": False,
536
554
  "output": None,
@@ -547,6 +565,7 @@ class McpToolExecutor:
547
565
  results.append(
548
566
  {
549
567
  "call_id": call_id,
568
+ "runtime_call_id": runtime_call_id_out,
550
569
  "name": name,
551
570
  "success": False,
552
571
  "output": None,
@@ -557,6 +576,7 @@ class McpToolExecutor:
557
576
  results.append(
558
577
  {
559
578
  "call_id": call_id,
579
+ "runtime_call_id": runtime_call_id_out,
560
580
  "name": name,
561
581
  "success": True,
562
582
  "output": _mcp_result_to_output(mcp_result),
@@ -567,6 +587,7 @@ class McpToolExecutor:
567
587
  results.append(
568
588
  {
569
589
  "call_id": call_id,
590
+ "runtime_call_id": runtime_call_id_out,
570
591
  "name": name,
571
592
  "success": False,
572
593
  "output": None,