aid-runtime-python 0.1.104__py3-none-any.whl → 0.1.106__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.
aid_runtime/__init__.py CHANGED
@@ -310,7 +310,7 @@ from aid_runtime.types import (
310
310
  )
311
311
 
312
312
  #: Kept in sync with ``pyproject.toml`` by a test, so the two cannot drift.
313
- __version__ = "0.1.104"
313
+ __version__ = "0.1.106"
314
314
 
315
315
  __all__ = [
316
316
  "ANTHROPIC_VERSION",
@@ -10,9 +10,10 @@ Agents release this runtime was built and measured against. It is a bare constan
10
10
  rather than a range because a range is the thing pinning exists to prevent: the
11
11
  harness's middleware stack, its recursion accounting and its interrupt payload all
12
12
  move between releases, so an unpinned backend would change behaviour under a
13
- stored eval baseline. ``pyproject.toml`` installs the same version, and
14
- :func:`check_engine` compares the IR's ``engineVersion`` against *this* constant,
15
- not against whatever wheel happens to be importable.
13
+ stored eval baseline. ``pyproject.toml``'s ``deepagents`` extra is the only
14
+ declaration of it -- this module reads it back from the installed metadata --
15
+ and :func:`check_engine` compares the IR's ``engineVersion`` against *this*
16
+ constant, not against whatever wheel happens to be importable.
16
17
 
17
18
  **Fail closed, in one place.** Every reason a ``deepagents`` agent cannot run --
18
19
  unknown engine, transfer declared, missing pin, mismatched pin, missing extra --
@@ -25,7 +26,8 @@ meaning nothing at all.
25
26
 
26
27
  from __future__ import annotations
27
28
 
28
- from importlib.metadata import PackageNotFoundError
29
+ import re
30
+ from importlib.metadata import PackageNotFoundError, requires
29
31
  from importlib.metadata import version as distribution_version
30
32
 
31
33
  from aid_runtime.agents.ir import AgentDefinition
@@ -54,17 +56,15 @@ DEEPAGENTS = "deepagents"
54
56
  #: The closed set of engines the IR may name.
55
57
  ENGINES = frozenset({NATIVE, DEEPAGENTS})
56
58
 
57
- #: The one authoritative pin. Measured from PyPI, mirrored in
58
- #: ``pyproject.toml``'s ``deepagents`` extra, and compared against the IR's
59
- #: ``engineVersion`` at run time.
60
- DEEPAGENTS_PIN = "0.7.32"
61
-
62
- #: The optional extra that installs the harness.
63
- DEEPAGENTS_EXTRA = "aid-runtime-python[deepagents]"
64
-
65
59
  #: The distribution the extra installs.
66
60
  DEEPAGENTS_DISTRIBUTION = "deepagents"
67
61
 
62
+ #: This runtime's own distribution, which carries the ``deepagents`` extra.
63
+ _OWN_DISTRIBUTION = "aid-runtime-python"
64
+
65
+ #: An exact ``deepagents==<version>`` requirement, however the extra is spelled.
66
+ _PIN_REQUIREMENT = re.compile(r"^\s*deepagents\s*==\s*([^\s;,]+)", re.IGNORECASE)
67
+
68
68
 
69
69
  def installed_deepagents_version() -> str | None:
70
70
  """The installed ``deepagents`` version, or ``None`` when the extra is absent.
@@ -80,6 +80,40 @@ def installed_deepagents_version() -> str | None:
80
80
  return None
81
81
 
82
82
 
83
+ def _declared_deepagents_pin() -> str | None:
84
+ """The exact pin the ``deepagents`` extra declares, or ``None`` if unresolvable.
85
+
86
+ ``pyproject.toml`` is the *only* declaration of the pin. It used to be copied
87
+ into this module as a literal, which meant a dependency bump moved the extra
88
+ and left the constant behind: the runtime then refused specs pinned to the
89
+ version it was actually installing, and the suite failed on an assertion that
90
+ compared two copies of the number rather than any behaviour.
91
+ """
92
+ try:
93
+ requirements = requires(_OWN_DISTRIBUTION) or ()
94
+ except PackageNotFoundError:
95
+ return None
96
+ for requirement in requirements:
97
+ match = _PIN_REQUIREMENT.match(requirement)
98
+ if match is not None:
99
+ return match.group(1)
100
+ return None
101
+
102
+
103
+ #: The one authoritative pin, compared against the IR's ``engineVersion`` at run
104
+ #: time. Declared once, in the ``deepagents`` extra; this module reads it back.
105
+ #:
106
+ #: The fallbacks cover an import from a source tree with no installed metadata:
107
+ #: the installed harness is the release the app will actually run, so it is right
108
+ #: in every case where the backend can run at all. The final literal is
109
+ #: unreachable for a runnable backend, because :func:`check_engine` raises
110
+ #: :class:`~aid_runtime.errors.DeepAgentsUnavailableError` when the extra is absent.
111
+ DEEPAGENTS_PIN = _declared_deepagents_pin() or installed_deepagents_version() or "0.7.32"
112
+
113
+ #: The optional extra that installs the harness.
114
+ DEEPAGENTS_EXTRA = f"{_OWN_DISTRIBUTION}[deepagents]"
115
+
116
+
83
117
  def check_engine(agent: AgentDefinition) -> str:
84
118
  """Validate this agent's engine, or raise the reason it cannot run.
85
119
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aid-runtime-python
3
- Version: 0.1.104
3
+ Version: 0.1.106
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
@@ -1,4 +1,4 @@
1
- aid_runtime/__init__.py,sha256=eq23NN-pxh_Az4KXJT_CnUPcc0gRRYBt7KJje-opsUA,13238
1
+ aid_runtime/__init__.py,sha256=hVHjSY0uhESPdIM9zjNGPeXPFSZpbOpfEun5gBFqSZk,13238
2
2
  aid_runtime/cache.py,sha256=jhw_EBd9dfWEUzYeibOvIkVBqqiLUjqF5WKEPz9GkhE,6836
3
3
  aid_runtime/concurrency.py,sha256=z0tFQHw35ttFLKfazGBjCMPOLQOnUotE_OPpvR1piH4,2829
4
4
  aid_runtime/control.py,sha256=y6wPn0fqYJv0nVSsjzpzfiaq1Y7zBoMxCpdrEuqkfvg,17529
@@ -18,7 +18,7 @@ aid_runtime/types.py,sha256=cVYgmacDIhStQT5dX_X67-q57sPBBaWC5nybtGVqVsw,10389
18
18
  aid_runtime/agents/__init__.py,sha256=hna-peyTFCRuF9TM9_lKy5b4O12cJnsQPrMcDncSCcg,2865
19
19
  aid_runtime/agents/chat_model.py,sha256=fZdCmSpoECuBVGZE1s8NmT2erT33RhDuLh3yJM6kAJE,14808
20
20
  aid_runtime/agents/deep_agents.py,sha256=ZM6ZSc92arCvtsYGsIGdF-NryqN_tvXtRqbdlHaGpeE,26948
21
- aid_runtime/agents/engine.py,sha256=RQUV49u7MLDmirnFv8YsRGdIutzUGsGaLA6Y2JT5wj0,4129
21
+ aid_runtime/agents/engine.py,sha256=3cXCYY806URDblYD500cfw7873IoVCy8BH1d4h2YAsc,5789
22
22
  aid_runtime/agents/guardrails.py,sha256=FC8RX8YUeUHgw9Kh24NavkSIkaXayPeVpFri-OZGi0Y,30200
23
23
  aid_runtime/agents/ir.py,sha256=pDWIia4t7rzRqJO3ZBsOrl24_uBTWT03NFKOEPV1JrU,29355
24
24
  aid_runtime/agents/loop.py,sha256=T-QnC9BQ9K3RyZfHdAuzWiwMXBpQjDLGdHrLgf2fnFM,52608
@@ -55,7 +55,7 @@ aid_runtime/retrieval/rerank.py,sha256=L4ICBi9YHDzhnKVtImKh5Wzre1HDzS8at-AKDkXBJ
55
55
  aid_runtime/retrieval/retriever.py,sha256=5I8BocFaJ292cqh9-Gz2NRB4OwBHa-pitAB6--5ARBE,19890
56
56
  aid_runtime/retrieval/stores.py,sha256=VEi68AaMHcQjdAbWOHflp3jCl1_1db71rIzZjTouLlo,5857
57
57
  aid_runtime/retrieval/types.py,sha256=bke4W2q8ecGFvF2tj8y1tfFq8EtGb6iiPVbT-l02a98,19860
58
- aid_runtime_python-0.1.104.dist-info/METADATA,sha256=Ww_lHgIGoLzxwimB3MAZVpygU_BJg3FLc3XQkHeLk7E,17006
59
- aid_runtime_python-0.1.104.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
60
- aid_runtime_python-0.1.104.dist-info/top_level.txt,sha256=QvODgNVRDDMmLcTnoIQ4jYnhqf-N4b9sHWEmaUUxp44,12
61
- aid_runtime_python-0.1.104.dist-info/RECORD,,
58
+ aid_runtime_python-0.1.106.dist-info/METADATA,sha256=HlYgzWvSe_VdlbuQkoAgTeStd_tfBi4d3eqO-pFSVx8,17006
59
+ aid_runtime_python-0.1.106.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
60
+ aid_runtime_python-0.1.106.dist-info/top_level.txt,sha256=QvODgNVRDDMmLcTnoIQ4jYnhqf-N4b9sHWEmaUUxp44,12
61
+ aid_runtime_python-0.1.106.dist-info/RECORD,,