agentx-python 0.8.28__py3-none-any.whl → 0.8.29__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.
@@ -75,6 +75,22 @@ def _resolve_scorer_id(scorer_id: Optional[str], evaluation_settings_id: Optiona
75
75
  return scorer_id or evaluation_settings_id
76
76
 
77
77
 
78
+ # "Argument not given" for update_tool_schema_meta, where None is itself a meaningful value
79
+ # (clear the price).
80
+ _UNSET: object = object()
81
+
82
+
83
+ def _validated_tool_price(value: float) -> float:
84
+ """Local mirror of the engine's check: USD per call, finite and non-negative."""
85
+ try:
86
+ price = float(value)
87
+ except (TypeError, ValueError):
88
+ raise ValueError(f"price_per_call_usd must be a number of USD per call, got {value!r}") from None
89
+ if price != price or price in (float("inf"), float("-inf")) or price < 0:
90
+ raise ValueError(f"price_per_call_usd must be a finite, non-negative number, got {value!r}")
91
+ return price
92
+
93
+
78
94
  class EvaluationsClient:
79
95
  def __init__(
80
96
  self,
@@ -723,13 +739,39 @@ class EvaluationsClient:
723
739
  data = self._request("GET", "/evaluate/tool-schemas", base=self._api_root)
724
740
  return data.get("toolSchemas", []) if isinstance(data, dict) else data
725
741
 
726
- def create_tool_schema(self, *, name: str, definition: str, description: Optional[str] = None) -> dict:
742
+ def create_tool_schema(
743
+ self, *, name: str, definition: str, description: Optional[str] = None,
744
+ price_per_call_usd: Optional[float] = None,
745
+ ) -> dict:
727
746
  payload: dict = {"name": name, "definition": definition}
728
747
  if description is not None:
729
748
  payload["description"] = description
749
+ if price_per_call_usd is not None:
750
+ payload["pricePerCallUsd"] = _validated_tool_price(price_per_call_usd)
730
751
  # Server-side write - no transport retry (see init_run's comment).
731
752
  return self._request("POST", "/evaluate/tool-schemas", base=self._api_root, json=payload, retry=False)
732
753
 
754
+ def update_tool_schema_meta(
755
+ self, tool_schema_id: str, *, description: Optional[str] = None,
756
+ price_per_call_usd: Optional[float] = _UNSET, test_endpoint_url: Optional[str] = _UNSET, # type: ignore[assignment]
757
+ ) -> dict:
758
+ """Metadata-only edit (PATCH): description, per-call price, test endpoint. Never touches
759
+ the version log. ``price_per_call_usd=None`` clears the price (the tool becomes free)."""
760
+ payload: dict = {}
761
+ if description is not None:
762
+ payload["description"] = description
763
+ if price_per_call_usd is not _UNSET:
764
+ payload["pricePerCallUsd"] = None if price_per_call_usd is None else _validated_tool_price(price_per_call_usd)
765
+ if test_endpoint_url is not _UNSET:
766
+ payload["testEndpointUrl"] = test_endpoint_url
767
+ return self._request(
768
+ "PATCH", f"/evaluate/tool-schemas/{tool_schema_id}", base=self._api_root, json=payload, retry=False,
769
+ )
770
+
771
+ def delete_tool_schema(self, tool_schema_id: str) -> None:
772
+ """Deletes the tool schema and its version history."""
773
+ self._request("DELETE", f"/evaluate/tool-schemas/{tool_schema_id}", base=self._api_root, retry=False)
774
+
733
775
  def get_tool_schema_examples(self, tool_schema_id: str, window: Optional[str] = None) -> dict:
734
776
  params = {"window": window} if window else None
735
777
  return self._request(
@@ -19,15 +19,39 @@ class ToolSchemaClient:
19
19
  def list(self) -> List[dict]:
20
20
  return self._client.list_tool_schemas()
21
21
 
22
- def create(self, *, name: str, definition: str, description: Optional[str] = None) -> dict:
23
- return self._client.create_tool_schema(name=name, definition=definition, description=description)
22
+ def create(
23
+ self, *, name: str, definition: str, description: Optional[str] = None,
24
+ price_per_call_usd: Optional[float] = None,
25
+ ) -> dict:
26
+ """``price_per_call_usd`` is what one call of this tool costs you (a paid external API
27
+ billed per request). Every recorded call is charged, failed ones included; the spend
28
+ shows as the "Tool calls" segment of the Overview cost chart and counts toward the
29
+ ``estimatedCostUsd`` alert metric. Leave it unset for a free tool."""
30
+ return self._client.create_tool_schema(
31
+ name=name, definition=definition, description=description, price_per_call_usd=price_per_call_usd,
32
+ )
24
33
 
25
- def get_or_create(self, *, name: str, definition: str, description: Optional[str] = None) -> dict:
26
- """Idempotent register: returns the existing schema of this name if present."""
34
+ def get_or_create(
35
+ self, *, name: str, definition: str, description: Optional[str] = None,
36
+ price_per_call_usd: Optional[float] = None,
37
+ ) -> dict:
38
+ """Idempotent register: returns the existing schema of this name if present (its stored
39
+ price wins - use :meth:`set_price` to change it)."""
27
40
  existing = next((t for t in self.list() if t.get("name") == name), None)
28
41
  if existing:
29
42
  return existing
30
- return self.create(name=name, definition=definition, description=description)
43
+ return self.create(
44
+ name=name, definition=definition, description=description, price_per_call_usd=price_per_call_usd,
45
+ )
46
+
47
+ def set_price(self, tool_schema_id: str, price_per_call_usd: Optional[float]) -> dict:
48
+ """Set (or clear with ``None``) a registered tool's USD price per call. Metadata only -
49
+ the definition's version log is untouched."""
50
+ return self._client.update_tool_schema_meta(tool_schema_id, price_per_call_usd=price_per_call_usd)
51
+
52
+ def delete(self, tool_schema_id: str) -> None:
53
+ """Deletes the tool schema and its version history."""
54
+ self._client.delete_tool_schema(tool_schema_id)
31
55
 
32
56
  def examples(self, tool_schema_id: str, window: Optional[str] = None) -> dict:
33
57
  """Failure evidence recorded against this tool (agent-tool-failure signals, low-rated
agentx/monitor/client.py CHANGED
@@ -360,6 +360,16 @@ class MonitorClient:
360
360
  params[key] = value
361
361
  return self._request("GET", "/metrics", params=params)
362
362
 
363
+ def cost_trend(self, window: str = "7d") -> dict:
364
+ """Overview's "Total cost" chart over a window ("24h", "7d", "30d"): priced spend per
365
+ bucket and in total, stacked by model, with two reserved segments - ``"eval runs"``
366
+ (offline-evaluation spend) and ``"tool calls"`` (registered tools' per-call prices, split
367
+ per tool in ``totalsByTool``). Unpriced models and tools contribute $0."""
368
+ return self._request(
369
+ "GET", "/agent-monitoring/cost-trend",
370
+ base=self._api_root(), params={"window": window},
371
+ )
372
+
363
373
  def topics(self, window: str = "7d") -> dict:
364
374
  """The Topics view's data over a window ("24h", "7d", "30d"): LLM-classified themes of
365
375
  sampled production traffic with per-topic counts and sentiment. Empty until Topics is
agentx/version.py CHANGED
@@ -1,7 +1,7 @@
1
- VERSION = "0.8.28"
1
+ VERSION = "0.8.29"
2
2
 
3
3
  # The AgentX-trace-eval release this SDK version is tested against - what `agentx-trace-eval`
4
4
  # installs and converges to (see agentx/cli.py). Bump together with VERSION when releasing, so
5
5
  # every published SDK names a known-good engine+dashboard pair. Users can override with
6
6
  # AGENTX_TRACE_EVAL_VERSION=<tag|latest>.
7
- ENGINE_VERSION = "v0.3.31"
7
+ ENGINE_VERSION = "v0.3.32"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentx-python
3
- Version: 0.8.28
3
+ Version: 0.8.29
4
4
  Summary: Official Python SDK for AgentX (https://www.agentx.so/)
5
5
  Home-page: https://github.com/AgentX-ai/AgentX-python
6
6
  Author: Robin Wang and AgentX Team
@@ -10,10 +10,10 @@ agentx/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  agentx/testing.py,sha256=0shZEid_vhJgBegpO_loUq6APYDxQrUgD3jvcRdIDV8,7372
11
11
  agentx/traces.py,sha256=Jh07n3GLS1SGRsDoLDTUaAbuMEdvjqxCCMA9gUcSZ0M,2331
12
12
  agentx/util.py,sha256=ivCuFQ5AGUw9fR9fJy5HrSp3lLwwngsDwppnvyZpq9E,1471
13
- agentx/version.py,sha256=GG8-5mWn22akjdeFMAvH6YuyN72ciRGt8EIqmtQjbdw,366
13
+ agentx/version.py,sha256=RwLiFdaKYxE3N-pYulB9jC6smBCKOZZTf_Vh6vqhCrM,366
14
14
  agentx/evaluations/__init__.py,sha256=Erv7RGFlRxGTG4rVb2uHhCqLLEX_iAWKqkZKzK6CumE,262
15
15
  agentx/evaluations/_term.py,sha256=WFpiNzdgDBeJJ-Gg-6X7TwwxllobuE4OqFUTuDQvS3Y,2529
16
- agentx/evaluations/client.py,sha256=7c35tS8zM3fuvFfVDQk5etTTEFiIykmPjuJxkuFyFTY,38013
16
+ agentx/evaluations/client.py,sha256=4Tuhp2GRPci01OIABg-wb6R_IxCy2qYtGxKuqSC8OVE,40075
17
17
  agentx/evaluations/datasets.py,sha256=_yqCdkg6aO6TfWOiicJKlDlFa_tAmCJitRLukW37PuU,17766
18
18
  agentx/evaluations/evaluation_settings.py,sha256=ZyFsPkQ_fwIhtb1cxUUBiCQEdbEinw4rSeI7nlHvk_8,7548
19
19
  agentx/evaluations/models.py,sha256=ENH594WSYBZvDdoqI3QN7wv4Qfwjy3o14fetWBs_ing,35438
@@ -21,7 +21,7 @@ agentx/evaluations/prompts.py,sha256=Yv9v0UUqZcef1GK-TwK7zcEN38zyN5sruGS0UTzF9UA
21
21
  agentx/evaluations/reporting.py,sha256=w6nGG2QMjl_qsGFkK2eJJFW30Qn64RjioaJ45Vy-RpU,6427
22
22
  agentx/evaluations/results.py,sha256=7B3aaJ-LFfmPLz904C5GR8MsAaDc1Kv_Le2kjnpCbGA,5146
23
23
  agentx/evaluations/runner.py,sha256=4k8XgIJhJqEm2tqpXyu27itx-MQnCjQZ1z6g_I6AznA,42343
24
- agentx/evaluations/tool_schemas.py,sha256=ZyrnSOnx9xlSAj4swfDey9ZLS2ly-g21DByTwRAGwNA,2323
24
+ agentx/evaluations/tool_schemas.py,sha256=OWs4ARaVPUDqHe-qSCu4dqgqxs2PubiUj2mHJssYMns,3527
25
25
  agentx/evaluations/tracing.py,sha256=MSJD9bzfInMi7E70mc8mWUc0fx5DLkOgUzRru2mNQoc,1825
26
26
  agentx/evaluations/adapters/__init__.py,sha256=fK8Hx75usbiY03XUSmnLnSrwBXip2CQs24YZcdEgj6w,287
27
27
  agentx/evaluations/adapters/http_endpoint.py,sha256=-Gika9lBcXjtbnyB-uNR6nYEVJhWEPtDazi9ixLvJtg,2059
@@ -46,7 +46,7 @@ agentx/monitor/__init__.py,sha256=3KsLb0wedvh16wa8W2G3Z2bZ-LPxe5xmw2wAYmqtfZA,18
46
46
  agentx/monitor/_transport.py,sha256=ge0pmdvFdUtCJRkTLvAgjuTQVA8YOCYGQNoyRuselRk,2077
47
47
  agentx/monitor/agents.py,sha256=KhsHVhkqa6V0e0lPcuo04fh44_qSaJOaGcD6U6qXSFo,1622
48
48
  agentx/monitor/alert_rules.py,sha256=KIZoxyjPG4snnwmO3h4GEbKtlWULmcwGqNMLsdweXew,9871
49
- agentx/monitor/client.py,sha256=oZctmh77Ki5WnZI6vQaj_tDlmdP6XtkDYt3MKhnvGsU,27563
49
+ agentx/monitor/client.py,sha256=Ey89VQrkgLxMtOUEo4damtFf9v1eziNI3SOl6M1rO6s,28138
50
50
  agentx/monitor/improvement_groups.py,sha256=MrXexaBLPNzZHrqZjiCPfmwa-DSr-RHuFdP73SKrMJM,6143
51
51
  agentx/monitor/judge_scorers.py,sha256=Xyoafo9ljeq5RpLe5HxvsL0Y0FebFQ-2CxYz8-E1Wio,21025
52
52
  agentx/monitor/models.py,sha256=mNBQDXdVthGYHUyEeRgpFdKVOC9uMtdUgBlLfep1E14,9298
@@ -69,9 +69,9 @@ agentx/tracing/eval_scope.py,sha256=ElMbPxpqpQBVuaUnHNlw9RIQu71oyOpd0yR55bDH8eI,
69
69
  agentx/tracing/framework_detect.py,sha256=uV4O7Th-4_2UkdooAyaWCOIA0jwLJbblFQ_ucFDjeJM,2638
70
70
  agentx/tracing/ingest_client.py,sha256=teukTPckFWPg5RhpbGbVDBejBzPIPXUO3_DJcuVh2uc,22660
71
71
  agentx/tracing/tracer.py,sha256=N7rIobHM9KdPU9mqBLVqgk_1mqtCNjBD57uAtXn9DO0,69167
72
- agentx_python-0.8.28.dist-info/licenses/LICENSE,sha256=gZVsM-nLsE8vlaY6NXXsVoo6IlCClxkToAWmhgT3y_s,10762
73
- agentx_python-0.8.28.dist-info/METADATA,sha256=9sFd2gVCfCWgweOoBcTHqM4IUpfHipe0qxYBEiLU4E4,23408
74
- agentx_python-0.8.28.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
75
- agentx_python-0.8.28.dist-info/entry_points.txt,sha256=rQqF1JTY3T1yfviBU1r8PU-5mBdfOk6P4bZ1L4BskIM,172
76
- agentx_python-0.8.28.dist-info/top_level.txt,sha256=s-q-HB9Gb_QdrZNacSeQyF_c25gQooMy7DlxzgLOHPk,7
77
- agentx_python-0.8.28.dist-info/RECORD,,
72
+ agentx_python-0.8.29.dist-info/licenses/LICENSE,sha256=gZVsM-nLsE8vlaY6NXXsVoo6IlCClxkToAWmhgT3y_s,10762
73
+ agentx_python-0.8.29.dist-info/METADATA,sha256=LBFiSds7ivKbcKMSMNWJi6s0J5pJDBbIuIlPWUoVMbg,23408
74
+ agentx_python-0.8.29.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
75
+ agentx_python-0.8.29.dist-info/entry_points.txt,sha256=rQqF1JTY3T1yfviBU1r8PU-5mBdfOk6P4bZ1L4BskIM,172
76
+ agentx_python-0.8.29.dist-info/top_level.txt,sha256=s-q-HB9Gb_QdrZNacSeQyF_c25gQooMy7DlxzgLOHPk,7
77
+ agentx_python-0.8.29.dist-info/RECORD,,