aid-runtime-python 0.1.162__tar.gz → 0.1.164__tar.gz

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 (130) hide show
  1. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/PKG-INFO +1 -1
  2. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/pyproject.toml +1 -1
  3. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/__init__.py +11 -1
  4. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/agents/__init__.py +24 -0
  5. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/agents/loop.py +36 -3
  6. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/agents/policy.py +13 -4
  7. aid_runtime_python-0.1.164/src/aid_runtime/agents/resume.py +402 -0
  8. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/agents/state.py +24 -0
  9. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/evals/agent_runner.py +14 -2
  10. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime_python.egg-info/PKG-INFO +1 -1
  11. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime_python.egg-info/SOURCES.txt +2 -0
  12. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_agent_eval_runner.py +79 -4
  13. aid_runtime_python-0.1.164/tests/test_agents_checkpoint_integrity.py +234 -0
  14. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_agents_deep_agents.py +8 -2
  15. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_tool_permissions.py +41 -2
  16. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/README.md +0 -0
  17. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/setup.cfg +0 -0
  18. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/agents/chat_model.py +0 -0
  19. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/agents/deep_agents.py +0 -0
  20. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/agents/engine.py +0 -0
  21. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/agents/guardrails.py +0 -0
  22. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/agents/ir.py +0 -0
  23. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/agents/managed.py +0 -0
  24. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/agents/memory.py +0 -0
  25. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/cache.py +0 -0
  26. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/concurrency.py +0 -0
  27. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/control.py +0 -0
  28. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/cost.py +0 -0
  29. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/decisions.py +0 -0
  30. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/errors.py +0 -0
  31. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/evals/__init__.py +0 -0
  32. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/evals/dataset.py +0 -0
  33. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/evals/gate.py +0 -0
  34. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/evals/metrics.py +0 -0
  35. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/evals/predicate.py +0 -0
  36. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/evals/runner.py +0 -0
  37. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/evals/trajectory.py +0 -0
  38. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/gateway.py +0 -0
  39. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/local_trace.py +0 -0
  40. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/metrics.py +0 -0
  41. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/pipeline.py +0 -0
  42. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/prompts.py +0 -0
  43. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/providers/__init__.py +0 -0
  44. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/providers/anthropic.py +0 -0
  45. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/providers/base.py +0 -0
  46. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/providers/bedrock.py +0 -0
  47. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/providers/fake.py +0 -0
  48. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/providers/gemini.py +0 -0
  49. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/providers/gemini_wire.py +0 -0
  50. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/providers/http.py +0 -0
  51. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/providers/recorded.py +0 -0
  52. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/providers/vertex.py +0 -0
  53. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/py.typed +0 -0
  54. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/redaction.py +0 -0
  55. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/__init__.py +0 -0
  56. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/chunking.py +0 -0
  57. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/citations.py +0 -0
  58. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/connectors.py +0 -0
  59. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/embedding.py +0 -0
  60. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/filters.py +0 -0
  61. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/gate.py +0 -0
  62. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/hybrid.py +0 -0
  63. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/knowledge_base.py +0 -0
  64. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/metrics.py +0 -0
  65. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/pgvector.py +0 -0
  66. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/rerank.py +0 -0
  67. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/retriever.py +0 -0
  68. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/stores.py +0 -0
  69. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/retrieval/types.py +0 -0
  70. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/steps.py +0 -0
  71. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/structured.py +0 -0
  72. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/telemetry.py +0 -0
  73. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/tools.py +0 -0
  74. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/tracing.py +0 -0
  75. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime/types.py +0 -0
  76. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime_python.egg-info/dependency_links.txt +0 -0
  77. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime_python.egg-info/requires.txt +0 -0
  78. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/src/aid_runtime_python.egg-info/top_level.txt +0 -0
  79. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_agents_budget.py +0 -0
  80. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_agents_hitl.py +0 -0
  81. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_agents_loop.py +0 -0
  82. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_agents_memory.py +0 -0
  83. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_anthropic_provider.py +0 -0
  84. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_bedrock_provider.py +0 -0
  85. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_cache.py +0 -0
  86. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_concurrency.py +0 -0
  87. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_control.py +0 -0
  88. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_cost.py +0 -0
  89. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_dataset.py +0 -0
  90. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_decisions.py +0 -0
  91. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_evals.py +0 -0
  92. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_evals_assert_gate.py +0 -0
  93. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_evals_budgets.py +0 -0
  94. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_evals_decision.py +0 -0
  95. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_evals_gate.py +0 -0
  96. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_evals_predicate.py +0 -0
  97. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_evals_trajectory.py +0 -0
  98. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_gateway.py +0 -0
  99. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_gemini_provider.py +0 -0
  100. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_guardrails.py +0 -0
  101. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_guardrails_managed.py +0 -0
  102. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_guardrails_model_armor.py +0 -0
  103. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_http_provider.py +0 -0
  104. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_local_trace.py +0 -0
  105. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_metrics.py +0 -0
  106. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_package.py +0 -0
  107. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_pipeline.py +0 -0
  108. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_prompts.py +0 -0
  109. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_recorded_provider.py +0 -0
  110. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_redaction.py +0 -0
  111. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_chunking.py +0 -0
  112. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_citations.py +0 -0
  113. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_connectors.py +0 -0
  114. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_embedding.py +0 -0
  115. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_filters.py +0 -0
  116. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_gate.py +0 -0
  117. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_hybrid.py +0 -0
  118. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_knowledge_base.py +0 -0
  119. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_metrics.py +0 -0
  120. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_rerank.py +0 -0
  121. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_stores.py +0 -0
  122. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_retrieval_types.py +0 -0
  123. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_steps.py +0 -0
  124. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_streaming.py +0 -0
  125. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_structured.py +0 -0
  126. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_telemetry.py +0 -0
  127. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_tools.py +0 -0
  128. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_tracing.py +0 -0
  129. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_types.py +0 -0
  130. {aid_runtime_python-0.1.162 → aid_runtime_python-0.1.164}/tests/test_vertex_provider.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aid-runtime-python
3
- Version: 0.1.162
3
+ Version: 0.1.164
4
4
  Summary: The AID Framework Python runtime: model gateway with pinning and cost budgets, prompt registry, tool executor, OTel GenAI tracing, plain-async pipeline, and an eval harness that gates on statistical regression against a stored baseline.
5
5
  Author: The AID Framework authors
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "aid-runtime-python"
7
- version = "0.1.162"
7
+ version = "0.1.164"
8
8
  description = "The AID Framework Python runtime: model gateway with pinning and cost budgets, prompt registry, tool executor, OTel GenAI tracing, plain-async pipeline, and an eval harness that gates on statistical regression against a stored baseline."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -29,12 +29,15 @@ from aid_runtime.agents import (
29
29
  AgentCheckpoint,
30
30
  AgentDefinition,
31
31
  AgentRuntime,
32
+ CheckpointRefusalError,
33
+ CheckpointSigner,
32
34
  FileMemoryStore,
33
35
  HumanApproval,
34
36
  HumanDecision,
35
37
  InProcessMemoryStore,
36
38
  MemoryDefinition,
37
39
  MemoryStore,
40
+ NonceStore,
38
41
  PendingApproval,
39
42
  Principal,
40
43
  RunResult,
@@ -44,6 +47,8 @@ from aid_runtime.agents import (
44
47
  StepRecord,
45
48
  ThreadMemory,
46
49
  ToolSpec,
50
+ nonce_store_from_env,
51
+ signer_from_env,
47
52
  )
48
53
  from aid_runtime.cache import CompletionCache, cache_key_for
49
54
  from aid_runtime.concurrency import ConcurrencyLimiter
@@ -351,7 +356,7 @@ from aid_runtime.types import (
351
356
  )
352
357
 
353
358
  #: Kept in sync with ``pyproject.toml`` by a test, so the two cannot drift.
354
- __version__ = "0.1.162"
359
+ __version__ = "0.1.164"
355
360
 
356
361
  __all__ = [
357
362
  "AGENT_LABEL",
@@ -409,6 +414,8 @@ __all__ = [
409
414
  "Capability",
410
415
  "CapabilityMismatchError",
411
416
  "CaseOutcome",
417
+ "CheckpointRefusalError",
418
+ "CheckpointSigner",
412
419
  "Chunk",
413
420
  "Chunker",
414
421
  "ChunkingSpec",
@@ -495,6 +502,7 @@ __all__ = [
495
502
  "ModelCacheConfig",
496
503
  "ModelGateway",
497
504
  "ModelSpec",
505
+ "NonceStore",
498
506
  "NormalizedContains",
499
507
  "OpenAICompatibleEmbedder",
500
508
  "OpenAICompatibleProvider",
@@ -627,6 +635,7 @@ __all__ = [
627
635
  "local_trace_enabled",
628
636
  "map_step",
629
637
  "metric_names",
638
+ "nonce_store_from_env",
630
639
  "normalize",
631
640
  "open_connector",
632
641
  "parallel",
@@ -652,6 +661,7 @@ __all__ = [
652
661
  "rrf_score",
653
662
  "run_evaluation",
654
663
  "run_structured",
664
+ "signer_from_env",
655
665
  "similarity",
656
666
  "sync_support",
657
667
  "tokenize",
@@ -60,8 +60,21 @@ from aid_runtime.agents.memory import (
60
60
  render_context,
61
61
  )
62
62
  from aid_runtime.agents.policy import Principal, evaluate_policy, policy_source
63
+ from aid_runtime.agents.resume import (
64
+ DEFAULT_CHECKPOINT_TTL_MINUTES,
65
+ CheckpointRefusalError,
66
+ CheckpointSigner,
67
+ InProcessNonceStore,
68
+ NonceStore,
69
+ PostgresNonceStore,
70
+ SqliteNonceStore,
71
+ nonce_store_for,
72
+ nonce_store_from_env,
73
+ signer_from_env,
74
+ )
63
75
  from aid_runtime.agents.state import (
64
76
  AgentCheckpoint,
77
+ CheckpointIntegrity,
65
78
  HumanDecision,
66
79
  PendingApproval,
67
80
  RunResult,
@@ -71,6 +84,7 @@ from aid_runtime.agents.state import (
71
84
  )
72
85
 
73
86
  __all__ = [
87
+ "DEFAULT_CHECKPOINT_TTL_MINUTES",
74
88
  "DETECTORS",
75
89
  "GUARDRAIL_ACTIONS",
76
90
  "GUARDRAIL_STAGES",
@@ -82,6 +96,9 @@ __all__ = [
82
96
  "AgentRuntime",
83
97
  "BedrockGuardrailClient",
84
98
  "BedrockGuardrailPolicy",
99
+ "CheckpointIntegrity",
100
+ "CheckpointRefusalError",
101
+ "CheckpointSigner",
85
102
  "DecisionAsker",
86
103
  "DecisionDefinition",
87
104
  "Detection",
@@ -96,16 +113,20 @@ __all__ = [
96
113
  "HumanApproval",
97
114
  "HumanDecision",
98
115
  "InProcessMemoryStore",
116
+ "InProcessNonceStore",
99
117
  "ManagedGuardrailSettings",
100
118
  "MemoryDefinition",
101
119
  "MemoryStore",
102
120
  "ModelArmorGuardrailClient",
103
121
  "ModelArmorGuardrailSettings",
122
+ "NonceStore",
104
123
  "PendingApproval",
124
+ "PostgresNonceStore",
105
125
  "Principal",
106
126
  "RunResult",
107
127
  "RunStatus",
108
128
  "RuntimeSpec",
129
+ "SqliteNonceStore",
109
130
  "StepKind",
110
131
  "StepRecord",
111
132
  "ThreadMemory",
@@ -115,6 +136,9 @@ __all__ = [
115
136
  "evaluate_policy",
116
137
  "managed_guardrail_settings",
117
138
  "model_armor_settings",
139
+ "nonce_store_for",
140
+ "nonce_store_from_env",
118
141
  "policy_source",
119
142
  "render_context",
143
+ "signer_from_env",
120
144
  ]
@@ -68,6 +68,11 @@ from aid_runtime.agents.policy import (
68
68
  evaluate_policy,
69
69
  policy_source,
70
70
  )
71
+ from aid_runtime.agents.resume import (
72
+ CheckpointSigner,
73
+ InProcessNonceStore,
74
+ NonceStore,
75
+ )
71
76
  from aid_runtime.agents.state import (
72
77
  AgentCheckpoint,
73
78
  HumanDecision,
@@ -193,6 +198,8 @@ class AgentRuntime:
193
198
  memory_store: MemoryStore | None = None,
194
199
  tracer: Tracer | None = None,
195
200
  limiter: ConcurrencyLimiter | None = None,
201
+ signer: CheckpointSigner | None = None,
202
+ nonces: NonceStore | None = None,
196
203
  ) -> None:
197
204
  self._spec = spec
198
205
  self._gateway = gateway
@@ -202,6 +209,11 @@ class AgentRuntime:
202
209
  memory_store if memory_store is not None else InProcessMemoryStore()
203
210
  )
204
211
  self._tracer = tracer
212
+ # A run that pauses hands its checkpoint to whoever called `run`, so the app that
213
+ # exposes a resume route must sign. Left `None`, the loop behaves exactly as it did
214
+ # before: a library embedding it directly is not silently given a key.
215
+ self._signer = signer
216
+ self._nonces: NonceStore = nonces if nonces is not None else InProcessNonceStore()
205
217
  self._guardrails = GuardrailEngine(spec.guardrails, decisions=spec.decisions)
206
218
  self._tools_by_name: dict[str, ToolSpec] = {
207
219
  definition.name: definition for definition in spec.tools.values()
@@ -220,6 +232,8 @@ class AgentRuntime:
220
232
  ledger: CostLedger | None = None,
221
233
  budget: Budget | None = None,
222
234
  tracer: Tracer | None = None,
235
+ signer: CheckpointSigner | None = None,
236
+ nonces: NonceStore | None = None,
223
237
  ) -> AgentRuntime:
224
238
  """Build a runtime from an emitted IR document.
225
239
 
@@ -240,6 +254,8 @@ class AgentRuntime:
240
254
  memory_store=memory_store,
241
255
  tracer=tracer,
242
256
  limiter=limiter,
257
+ signer=signer,
258
+ nonces=nonces,
243
259
  )
244
260
 
245
261
  @property
@@ -278,7 +294,7 @@ class AgentRuntime:
278
294
  try:
279
295
  outcome = await self._drive(
280
296
  frame,
281
- principal=principal if principal is not None else Principal(),
297
+ principal=principal if principal is not None else Principal.unauthenticated(),
282
298
  memory_key=key,
283
299
  )
284
300
  except BaseException:
@@ -296,6 +312,7 @@ class AgentRuntime:
296
312
  principal: Principal | None = None,
297
313
  ) -> RunResult:
298
314
  """Continue a paused run from its checkpoint, with a human's answer."""
315
+ checkpoint = await self._accept(checkpoint)
299
316
  resolved = HumanDecision(decision)
300
317
  self._restore_ledger(checkpoint)
301
318
  start_cost = self._gateway.ledger.cost_usd
@@ -304,7 +321,7 @@ class AgentRuntime:
304
321
  outcome = await self._resume(
305
322
  checkpoint,
306
323
  resolved,
307
- principal if principal is not None else Principal(),
324
+ principal if principal is not None else Principal.unauthenticated(),
308
325
  )
309
326
  except BaseException:
310
327
  # Same rule as `run`: a resumed run that fails has been billed too.
@@ -312,6 +329,18 @@ class AgentRuntime:
312
329
  raise
313
330
  return self._wrap(outcome, start_cost, start_tokens)
314
331
 
332
+ async def _accept(self, checkpoint: AgentCheckpoint) -> AgentCheckpoint:
333
+ """Refuse a checkpoint this app did not issue, has expired, or already spent.
334
+
335
+ Called before anything the checkpoint carries is read, so a tampered pending call
336
+ is never authorized, priced or observed. A runtime built without a signer keeps the
337
+ pre-signing behaviour, which is what a direct library embedder already had.
338
+ """
339
+ if self._signer is None:
340
+ return checkpoint
341
+ await self._signer.accept(checkpoint, self._nonces)
342
+ return checkpoint
343
+
315
344
  async def _resume(
316
345
  self,
317
346
  checkpoint: AgentCheckpoint,
@@ -1057,7 +1086,7 @@ class AgentRuntime:
1057
1086
  channel = approval.channel
1058
1087
  else:
1059
1088
  channel = _TOOL_CONFIRMATION
1060
- return AgentCheckpoint(
1089
+ checkpoint = AgentCheckpoint(
1061
1090
  agent_id=frame.agent.id,
1062
1091
  step=frame.step,
1063
1092
  messages=tuple(frame.messages),
@@ -1076,6 +1105,10 @@ class AgentRuntime:
1076
1105
  escalation=escalation,
1077
1106
  guardrails=tuple(frame.guardrails),
1078
1107
  )
1108
+ # Signed here rather than at the route, so every pause path -- approval, tool
1109
+ # confirmation, guardrail escalation, and the nested caller of a delegate -- is
1110
+ # issued by the same key. A second signing site is a second thing to forget.
1111
+ return checkpoint if self._signer is None else self._signer.sign(checkpoint)
1079
1112
 
1080
1113
  def _restore_ledger(self, checkpoint: AgentCheckpoint) -> None:
1081
1114
  """Carry a pause's spend into this process's ledger before resuming.
@@ -36,14 +36,23 @@ _LOGICAL = frozenset({"and", "or"})
36
36
  class Principal:
37
37
  """Who a policy is evaluated for.
38
38
 
39
- Defaults are the anonymous-but-authenticated caller an app with no auth layer
40
- has: ``isAuthenticated()`` is true and both role and scope sets are empty, so
41
- ``hasRole('admin')`` is false rather than undefined.
39
+ ``authenticated`` defaults to **false** on purpose. A default that is authenticated is
40
+ a silent authorization bug: ``isAuthenticated()`` is the weakest policy the security
41
+ gate accepts on a mutating tool, so a caller the app never identified would satisfy it.
42
+ :meth:`unauthenticated` is the caller an app with no auth layer has -- no roles, no
43
+ scopes, and ``isAuthenticated()`` false, which is the closed answer. Pass
44
+ ``authenticated=True`` only from code that actually verified a token.
42
45
  """
43
46
 
44
47
  roles: frozenset[str] = frozenset()
45
48
  scopes: frozenset[str] = frozenset()
46
- authenticated: bool = True
49
+ authenticated: bool = False
50
+
51
+ @classmethod
52
+ def unauthenticated(cls) -> Principal:
53
+ """The caller a route seeds when nothing verified a token: anonymous, fail-closed."""
54
+
55
+ return cls(authenticated=False)
47
56
 
48
57
 
49
58
  def evaluate_policy(node: Mapping[str, Any], principal: Principal) -> bool: