agentx-python 0.6.34__tar.gz → 0.6.36__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.
Potentially problematic release.
This version of agentx-python might be problematic. Click here for more details.
- {agentx_python-0.6.34 → agentx_python-0.6.36}/PKG-INFO +1 -1
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/agentx.py +29 -17
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/client.py +28 -3
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/datasets.py +4 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/evaluation_settings.py +17 -1
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/models.py +1 -1
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/runner.py +16 -11
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/export.py +5 -3
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/feedback.py +5 -3
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/monitor/client.py +19 -2
- agentx_python-0.6.36/agentx/monitor/judge_scorers.py +334 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/monitor/online_evaluators.py +21 -2
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/monitor/scorers.py +4 -2
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/outcomes.py +4 -2
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/projects.py +5 -2
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/traces.py +4 -2
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/tracing/ingest_client.py +46 -6
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/tracing/tracer.py +5 -3
- agentx_python-0.6.36/agentx/version.py +1 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx_python.egg-info/PKG-INFO +1 -1
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx_python.egg-info/SOURCES.txt +3 -0
- agentx_python-0.6.36/tests/test_deep_dive_fixes.py +85 -0
- agentx_python-0.6.36/tests/test_judge_scorers.py +270 -0
- agentx_python-0.6.34/agentx/version.py +0 -1
- {agentx_python-0.6.34 → agentx_python-0.6.36}/LICENSE +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/README.md +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/__init__.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/cli.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/__init__.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/_term.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/adapters/__init__.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/adapters/http_endpoint.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/adapters/precomputed.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/adapters/raw.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/prompts.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/reporting.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/results.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/tool_schemas.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/evaluations/tracing.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/exceptions.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/__init__.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/_traced_call.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/anthropic.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/autogen.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/crewai.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/databricks.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/google_adk.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/google_genai.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/langchain.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/litellm.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/llamaindex.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/moveworks.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/openai.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/integrations/openai_agents.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/monitor/__init__.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/monitor/agents.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/monitor/models.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/monitor/patterns.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/monitor/profile.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/monitor/sessions.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/monitor/signals.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/py.typed +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/resources/__init__.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/resources/agent.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/resources/conversation.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/resources/workforce.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/tracing/__init__.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/tracing/ci_types.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx/util.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx_python.egg-info/dependency_links.txt +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx_python.egg-info/entry_points.txt +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx_python.egg-info/not-zip-safe +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx_python.egg-info/requires.txt +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/agentx_python.egg-info/top_level.txt +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/setup.cfg +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/setup.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/tests/test_integration.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/tests/test_integrations.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/tests/test_selfhost_analysis_fallback.py +0 -0
- {agentx_python-0.6.34 → agentx_python-0.6.36}/tests/test_span_tree.py +0 -0
|
@@ -20,10 +20,12 @@ class AgentX:
|
|
|
20
20
|
if self.api_key and not os.getenv("AGENTX_API_KEY"):
|
|
21
21
|
os.environ["AGENTX_API_KEY"] = self.api_key
|
|
22
22
|
|
|
23
|
-
# base_url overrides AGENTX_API_BASE_URL env var (and the SDK default)
|
|
23
|
+
# base_url overrides AGENTX_API_BASE_URL env var (and the SDK default). It is
|
|
24
|
+
# deliberately NOT written back into os.environ: the constructor used to do that, which
|
|
25
|
+
# made the last-constructed client silently re-point every other client in the process
|
|
26
|
+
# (deep-dive round 3, bug #1). Each sub-client below receives this value explicitly and
|
|
27
|
+
# captures it at construction instead.
|
|
24
28
|
self.base_url = base_url or os.getenv("AGENTX_API_BASE_URL")
|
|
25
|
-
if self.base_url:
|
|
26
|
-
os.environ["AGENTX_API_BASE_URL"] = self.base_url
|
|
27
29
|
|
|
28
30
|
self.workspace_id = workspace_id or os.getenv("AGENTX_WORKSPACE_ID")
|
|
29
31
|
|
|
@@ -58,29 +60,29 @@ class AgentX:
|
|
|
58
60
|
|
|
59
61
|
# Report real, after-the-fact outcomes ("the ticket got reopened") against traces - the
|
|
60
62
|
# ground truth behind the dashboard's Judge Calibration card. Self-host only.
|
|
61
|
-
self.outcomes = OutcomesClient(api_key=self.api_key)
|
|
63
|
+
self.outcomes = OutcomesClient(api_key=self.api_key, base_url=self.base_url)
|
|
62
64
|
|
|
63
65
|
from agentx.projects import ProjectsClient
|
|
64
66
|
|
|
65
67
|
# Project CRUD (self-host): isolated tenants with their own API keys (P1.1).
|
|
66
|
-
self.projects = ProjectsClient(api_key=self.api_key)
|
|
68
|
+
self.projects = ProjectsClient(api_key=self.api_key, base_url=self.base_url)
|
|
67
69
|
|
|
68
70
|
from agentx.traces import TracesClient
|
|
69
71
|
|
|
70
72
|
# The read side of tracing: trace-by-id detail and paginated listing (P1.2).
|
|
71
|
-
self.traces = TracesClient(api_key=self.api_key)
|
|
73
|
+
self.traces = TracesClient(api_key=self.api_key, base_url=self.base_url)
|
|
72
74
|
|
|
73
75
|
from agentx.export import ExportClient
|
|
74
76
|
|
|
75
77
|
# Bulk NDJSON egress for backup/migration (P2.1): manifest, per-entity streaming, and
|
|
76
78
|
# directory dumps. Self-host only.
|
|
77
|
-
self.export = ExportClient(api_key=self.api_key)
|
|
79
|
+
self.export = ExportClient(api_key=self.api_key, base_url=self.base_url)
|
|
78
80
|
|
|
79
81
|
from agentx.feedback import FeedbackClient
|
|
80
82
|
|
|
81
83
|
# Forward end-user votes ("up"/"down") on traced responses - a "down" raises a signal
|
|
82
84
|
# directly, and every vote feeds Judge Calibration alongside outcomes. Self-host only.
|
|
83
|
-
self.feedback = FeedbackClient(api_key=self.api_key)
|
|
85
|
+
self.feedback = FeedbackClient(api_key=self.api_key, base_url=self.base_url)
|
|
84
86
|
|
|
85
87
|
_ingest_client = IngestClient(
|
|
86
88
|
api_key=self.api_key,
|
|
@@ -92,13 +94,23 @@ class AgentX:
|
|
|
92
94
|
|
|
93
95
|
@classmethod
|
|
94
96
|
def from_env(cls) -> "AgentX":
|
|
95
|
-
"""Create an AgentX client
|
|
96
|
-
|
|
97
|
+
"""Create an AgentX client from the environment: AGENTX_API_KEY plus, for the base URL,
|
|
98
|
+
the first of AGENTX_API_BASE_URL / AGENTX_SELFHOST_BASE_URL / BASE_URL that is set.
|
|
99
|
+
The fallbacks match the conventions the self-host samples and .env files already use,
|
|
100
|
+
so from_env works wherever an explicit AgentX(base_url=...) would."""
|
|
101
|
+
import os
|
|
102
|
+
|
|
103
|
+
base_url = (
|
|
104
|
+
os.getenv("AGENTX_API_BASE_URL")
|
|
105
|
+
or os.getenv("AGENTX_SELFHOST_BASE_URL")
|
|
106
|
+
or os.getenv("BASE_URL")
|
|
107
|
+
)
|
|
108
|
+
return cls(base_url=base_url) if base_url else cls()
|
|
97
109
|
|
|
98
110
|
def get_agent(self, id: str) -> Agent:
|
|
99
|
-
url = f"{api_base()}/access/agents/{id}"
|
|
111
|
+
url = f"{self.base_url or api_base()}/access/agents/{id}"
|
|
100
112
|
# Make a GET request to the AgentX API
|
|
101
|
-
response = requests.get(url, headers=get_headers())
|
|
113
|
+
response = requests.get(url, headers=get_headers(self.api_key))
|
|
102
114
|
# Check if response was successful
|
|
103
115
|
if response.status_code == 200:
|
|
104
116
|
return Agent(**response.json())
|
|
@@ -106,9 +118,9 @@ class AgentX:
|
|
|
106
118
|
raise Exception(f"Failed to retrieve agent: {response.reason}")
|
|
107
119
|
|
|
108
120
|
def list_agents(self) -> List[Agent]:
|
|
109
|
-
url = f"{api_base()}/access/agents"
|
|
121
|
+
url = f"{self.base_url or api_base()}/access/agents"
|
|
110
122
|
# Make a GET request to the AgentX API
|
|
111
|
-
response = requests.get(url, headers=get_headers())
|
|
123
|
+
response = requests.get(url, headers=get_headers(self.api_key))
|
|
112
124
|
# Check if response was successful
|
|
113
125
|
if response.status_code == 200:
|
|
114
126
|
return [Agent(**agent) for agent in response.json()]
|
|
@@ -146,7 +158,7 @@ class AgentX:
|
|
|
146
158
|
"""
|
|
147
159
|
from agentx.exceptions import AgentXAPIError, AgentXAuthError, AgentXConnectionError
|
|
148
160
|
|
|
149
|
-
base = api_base()
|
|
161
|
+
base = (self.base_url or api_base()).rstrip("/")
|
|
150
162
|
# /monitor/patterns: the cheapest key-authenticated endpoint that exists on both the
|
|
151
163
|
# hosted API and the self-host engine's SDK-facing router.
|
|
152
164
|
url = f"{base}/monitor/patterns"
|
|
@@ -173,8 +185,8 @@ class AgentX:
|
|
|
173
185
|
|
|
174
186
|
def get_profile(self):
|
|
175
187
|
"""Get the current user's profile information."""
|
|
176
|
-
url = f"{api_base()}/access/getProfile"
|
|
177
|
-
response = requests.get(url, headers=get_headers())
|
|
188
|
+
url = f"{self.base_url or api_base()}/access/getProfile"
|
|
189
|
+
response = requests.get(url, headers=get_headers(self.api_key))
|
|
178
190
|
if response.status_code == 200:
|
|
179
191
|
return response.json()
|
|
180
192
|
else:
|
|
@@ -59,6 +59,15 @@ class AgentXValidationError(AgentXEvaluationsError):
|
|
|
59
59
|
pass
|
|
60
60
|
|
|
61
61
|
|
|
62
|
+
def _resolve_scorer_id(scorer_id: Optional[str], evaluation_settings_id: Optional[str]) -> Optional[str]:
|
|
63
|
+
"""One grader, two spellings: ``scorer_id`` is the post-consolidation name for what the wire
|
|
64
|
+
still calls ``evaluationSettingsId`` (the ids are identical by design). Both kwargs are
|
|
65
|
+
accepted everywhere a run picks its grader; passing both with different values is a bug."""
|
|
66
|
+
if scorer_id and evaluation_settings_id and scorer_id != evaluation_settings_id:
|
|
67
|
+
raise ValueError("Pass either scorer_id or evaluation_settings_id (they are the same id), not two different ids")
|
|
68
|
+
return scorer_id or evaluation_settings_id
|
|
69
|
+
|
|
70
|
+
|
|
62
71
|
class EvaluationsClient:
|
|
63
72
|
def __init__(
|
|
64
73
|
self,
|
|
@@ -100,11 +109,21 @@ class EvaluationsClient:
|
|
|
100
109
|
from agentx.evaluations.prompts import PromptClient
|
|
101
110
|
|
|
102
111
|
self.datasets = DatasetClient(self)
|
|
103
|
-
|
|
112
|
+
# Legacy view of an LLM Judge Scorer's offline profile - constructed lazily so its
|
|
113
|
+
# DeprecationWarning fires on first USE, not for every client that never touches it.
|
|
114
|
+
self._settings: "EvaluationSettingsClient | None" = None
|
|
104
115
|
self.prompts = PromptClient(self)
|
|
105
116
|
from agentx.evaluations.tool_schemas import ToolSchemaClient
|
|
106
117
|
self.tool_schemas = ToolSchemaClient(self)
|
|
107
118
|
|
|
119
|
+
@property
|
|
120
|
+
def settings(self) -> "EvaluationSettingsClient":
|
|
121
|
+
if self._settings is None:
|
|
122
|
+
from agentx.evaluations.evaluation_settings import EvaluationSettingsClient
|
|
123
|
+
|
|
124
|
+
self._settings = EvaluationSettingsClient(self)
|
|
125
|
+
return self._settings
|
|
126
|
+
|
|
108
127
|
# ------------------------------------------------------------------
|
|
109
128
|
# Low-level HTTP
|
|
110
129
|
# ------------------------------------------------------------------
|
|
@@ -275,10 +294,16 @@ class EvaluationsClient:
|
|
|
275
294
|
dataset_id: str,
|
|
276
295
|
subject: EvaluationSubject,
|
|
277
296
|
python_version: Optional[str] = None,
|
|
297
|
+
scorer_id: Optional[str] = None,
|
|
278
298
|
evaluation_settings_id: Optional[str] = None,
|
|
279
299
|
) -> EvaluationRun:
|
|
300
|
+
"""``scorer_id`` names the LLM Judge Scorer grading this run (its id doubles as the
|
|
301
|
+
wire's ``evaluationSettingsId``). ``evaluation_settings_id`` is the pre-consolidation
|
|
302
|
+
alias and keeps working."""
|
|
280
303
|
from agentx.version import VERSION
|
|
281
304
|
|
|
305
|
+
grader_id = _resolve_scorer_id(scorer_id, evaluation_settings_id)
|
|
306
|
+
|
|
282
307
|
payload = {
|
|
283
308
|
"datasetId": dataset_id,
|
|
284
309
|
"evaluationSubject": subject.model_dump(by_alias=True, exclude_none=True),
|
|
@@ -290,8 +315,8 @@ class EvaluationsClient:
|
|
|
290
315
|
"pythonVersion": python_version or _python_version(),
|
|
291
316
|
},
|
|
292
317
|
}
|
|
293
|
-
if
|
|
294
|
-
payload["evaluationSettingsId"] =
|
|
318
|
+
if grader_id:
|
|
319
|
+
payload["evaluationSettingsId"] = grader_id
|
|
295
320
|
data = self._request("POST", "/runs", json=self._with_workspace(payload))
|
|
296
321
|
return EvaluationRun(**data)
|
|
297
322
|
|
|
@@ -290,6 +290,7 @@ class DatasetClient:
|
|
|
290
290
|
rouge_score: bool = False,
|
|
291
291
|
similarity_model: Optional[str] = None,
|
|
292
292
|
sovereignty_models: Optional[List[str]] = None,
|
|
293
|
+
code_scorers: Optional[List[Dict[str, Any]]] = None,
|
|
293
294
|
) -> DatasetBuilder:
|
|
294
295
|
return DatasetBuilder(
|
|
295
296
|
self._client,
|
|
@@ -307,6 +308,9 @@ class DatasetClient:
|
|
|
307
308
|
rouge_score=rouge_score,
|
|
308
309
|
similarity_model=similarity_model,
|
|
309
310
|
sovereignty_models=sovereignty_models,
|
|
311
|
+
# Was documented (evaluation/code-scorers.mdx) but not forwarded - DatasetBuilder
|
|
312
|
+
# itself always accepted it. Fixed with the judge-scorer unification.
|
|
313
|
+
code_scorers=code_scorers,
|
|
310
314
|
)
|
|
311
315
|
|
|
312
316
|
def from_csv(self, path: str, name: str, **kwargs) -> DatasetBuilder:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
import warnings
|
|
4
5
|
from typing import Any, Dict, List, Optional, TYPE_CHECKING
|
|
5
6
|
|
|
6
7
|
from agentx.evaluations.models import EvaluationSettings
|
|
@@ -81,10 +82,25 @@ class EvaluationSettingsBuilder:
|
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
class EvaluationSettingsClient:
|
|
84
|
-
"""Thin wrapper surfaced as client.evaluations.settings
|
|
85
|
+
"""Thin wrapper surfaced as ``client.evaluations.settings``.
|
|
86
|
+
|
|
87
|
+
Note: an evaluation-settings record is the judge rubric + OFFLINE profile of an
|
|
88
|
+
**LLM Judge Scorer** - the unified entity at ``client.monitor.judge_scorers``, which also
|
|
89
|
+
carries the optional online (live-traffic) profile. This client keeps working unchanged;
|
|
90
|
+
prefer ``judge_scorers`` for new code so both profiles live in one place -
|
|
91
|
+
``client.monitor.judge_scorers.builder(...)`` has the same snake_case ergonomics as the
|
|
92
|
+
builder below, plus tool_context, thresholds, and the live profile in one call."""
|
|
85
93
|
|
|
86
94
|
def __init__(self, client: "EvaluationsClient"):
|
|
87
95
|
self._client = client
|
|
96
|
+
# Soft deprecation: hidden by default (DeprecationWarning), visible under -W or pytest.
|
|
97
|
+
warnings.warn(
|
|
98
|
+
"client.evaluations.settings is the legacy view of an LLM Judge Scorer's offline "
|
|
99
|
+
"profile; prefer client.monitor.judge_scorers, which manages the judge rubric, "
|
|
100
|
+
"offline profile, and online (live-traffic) profile as one entity.",
|
|
101
|
+
DeprecationWarning,
|
|
102
|
+
stacklevel=3,
|
|
103
|
+
)
|
|
88
104
|
|
|
89
105
|
def builder(
|
|
90
106
|
self,
|
|
@@ -94,7 +94,7 @@ class Dataset(BaseModel):
|
|
|
94
94
|
|
|
95
95
|
class EvaluationSettings(BaseModel):
|
|
96
96
|
"""A standalone, reusable grading config - no dataset/questions attached.
|
|
97
|
-
Created via ``client.
|
|
97
|
+
Created via ``client.monitor.judge_scorers.builder(...).publish()`` (or the legacy ``client.evaluations.settings.builder``) and run
|
|
98
98
|
against any dataset by passing its id as ``evaluation_settings_id`` to
|
|
99
99
|
``client.evaluations.run(...)``."""
|
|
100
100
|
|
|
@@ -421,10 +421,15 @@ class EvaluationsRunner:
|
|
|
421
421
|
def __init__(self, client: EvaluationsClient):
|
|
422
422
|
self._client = client
|
|
423
423
|
self.datasets = client.datasets
|
|
424
|
-
self.settings = client.settings
|
|
425
424
|
self.prompts = client.prompts
|
|
426
425
|
self.tool_schemas = client.tool_schemas
|
|
427
426
|
|
|
427
|
+
@property
|
|
428
|
+
def settings(self):
|
|
429
|
+
# Deferred: touching client.settings eagerly here would fire its legacy-surface
|
|
430
|
+
# DeprecationWarning for every runner, used or not.
|
|
431
|
+
return self._client.settings
|
|
432
|
+
|
|
428
433
|
def list_models(self, provider: Optional[str] = None) -> List[ModelInfo]:
|
|
429
434
|
"""List the LLM models AgentX supports - the same set selectable for
|
|
430
435
|
the Sovereignty & Portability Index. Pass ``provider`` (e.g. "Google")
|
|
@@ -482,24 +487,24 @@ class EvaluationsRunner:
|
|
|
482
487
|
self,
|
|
483
488
|
dataset_id: str,
|
|
484
489
|
subject: Union[Dict[str, Any], EvaluationSubject],
|
|
490
|
+
scorer_id: Optional[str] = None,
|
|
485
491
|
evaluation_settings_id: Optional[str] = None,
|
|
486
492
|
) -> EvaluationRunContext:
|
|
487
|
-
"""Start a run of ``dataset_id`` against ``subject``. Pass
|
|
488
|
-
``
|
|
489
|
-
|
|
490
|
-
|
|
493
|
+
"""Start a run of ``dataset_id`` against ``subject``. Pass ``scorer_id`` (an LLM Judge
|
|
494
|
+
Scorer's id, e.g. from ``client.monitor.judge_scorers``) to grade with a specific
|
|
495
|
+
scorer instead of the dataset's default. ``evaluation_settings_id`` is the
|
|
496
|
+
pre-consolidation alias for the same id and keeps working."""
|
|
497
|
+
from agentx.evaluations.client import _resolve_scorer_id
|
|
498
|
+
|
|
491
499
|
if isinstance(subject, dict):
|
|
492
500
|
subject = EvaluationSubject(**subject)
|
|
493
501
|
|
|
502
|
+
grader_id = _resolve_scorer_id(scorer_id, evaluation_settings_id)
|
|
494
503
|
dataset = self._client.get_dataset(dataset_id)
|
|
495
504
|
evaluation_settings = (
|
|
496
|
-
self._client.get_evaluation_settings(
|
|
497
|
-
if evaluation_settings_id
|
|
498
|
-
else None
|
|
499
|
-
)
|
|
500
|
-
run = self._client.init_run(
|
|
501
|
-
dataset_id, subject, evaluation_settings_id=evaluation_settings_id
|
|
505
|
+
self._client.get_evaluation_settings(grader_id) if grader_id else None
|
|
502
506
|
)
|
|
507
|
+
run = self._client.init_run(dataset_id, subject, scorer_id=grader_id)
|
|
503
508
|
logger.info(
|
|
504
509
|
"Started evaluation run %s on dataset %s (%d case(s), %d repetition(s))",
|
|
505
510
|
run.run_id,
|
|
@@ -36,13 +36,15 @@ class ExportClient:
|
|
|
36
36
|
(``pg_dump`` / SQLite file copy). There is deliberately no blind row-import endpoint.
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
|
-
def __init__(self, api_key: Optional[str] = None):
|
|
39
|
+
def __init__(self, api_key: Optional[str] = None, base_url: Optional[str] = None):
|
|
40
40
|
self._api_key = api_key
|
|
41
|
+
# Captured once at construction (deep-dive round 3, bug #1).
|
|
42
|
+
self._base_url = (base_url or api_base()).rstrip("/")
|
|
41
43
|
|
|
42
44
|
def manifest(self) -> List[Dict[str, Any]]:
|
|
43
45
|
"""The exportable entities with live row counts: ``[{entity, rows, path}, ...]``."""
|
|
44
46
|
resp = requests.get(
|
|
45
|
-
f"{
|
|
47
|
+
f"{self._base_url}/export", headers=get_headers(self._api_key), timeout=30
|
|
46
48
|
)
|
|
47
49
|
if resp.status_code >= 400:
|
|
48
50
|
raise AgentXExportError(f"Export manifest failed ({resp.status_code}): {resp.text[:200]}")
|
|
@@ -54,7 +56,7 @@ class ExportClient:
|
|
|
54
56
|
timestamp column, e.g. ``createdAt`` for traces, ``lastSeenAt`` for signals)."""
|
|
55
57
|
params = {"since": since} if since else None
|
|
56
58
|
resp = requests.get(
|
|
57
|
-
f"{
|
|
59
|
+
f"{self._base_url}/export/{entity}",
|
|
58
60
|
headers=get_headers(self._api_key),
|
|
59
61
|
params=params,
|
|
60
62
|
stream=True,
|
|
@@ -26,8 +26,10 @@ class FeedbackClient:
|
|
|
26
26
|
reopened", reported by a workflow); feedback is a human vote with up/down semantics.
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
|
-
def __init__(self, api_key: Optional[str] = None):
|
|
29
|
+
def __init__(self, api_key: Optional[str] = None, base_url: Optional[str] = None):
|
|
30
30
|
self._api_key = api_key
|
|
31
|
+
# Captured once at construction (deep-dive round 3, bug #1).
|
|
32
|
+
self._base_url = (base_url or api_base()).rstrip("/")
|
|
31
33
|
|
|
32
34
|
def report(
|
|
33
35
|
self,
|
|
@@ -61,7 +63,7 @@ class FeedbackClient:
|
|
|
61
63
|
payload["endUserId"] = end_user_id
|
|
62
64
|
|
|
63
65
|
resp = requests.post(
|
|
64
|
-
f"{
|
|
66
|
+
f"{self._base_url}/feedback",
|
|
65
67
|
headers={**get_headers(self._api_key), "Content-Type": "application/json"},
|
|
66
68
|
json=payload,
|
|
67
69
|
timeout=10,
|
|
@@ -79,7 +81,7 @@ class FeedbackClient:
|
|
|
79
81
|
"""All votes recorded on one trace, oldest first (``GET /feedback/trace/:traceId``) -
|
|
80
82
|
the same rows the dashboard's trace dialog shows as up/down chips."""
|
|
81
83
|
resp = requests.get(
|
|
82
|
-
f"{
|
|
84
|
+
f"{self._base_url}/feedback/trace/{trace_id}",
|
|
83
85
|
headers=get_headers(self._api_key),
|
|
84
86
|
timeout=10,
|
|
85
87
|
)
|
|
@@ -85,9 +85,18 @@ class MonitorClient:
|
|
|
85
85
|
from agentx.monitor.scorers import ScorersClient
|
|
86
86
|
# Scorers-catalog administration as code: template enable/disable, code/external scorer
|
|
87
87
|
# CRUD and dry runs - full parity with the dashboard's Scorers page (P1.3).
|
|
88
|
-
|
|
88
|
+
# Handed this client's own resolved API root, never the process-global default, so a
|
|
89
|
+
# second AgentX() with a different base_url can't re-point it (deep-dive bug #1).
|
|
90
|
+
self.scorers = ScorersClient(api_key=api_key, base_url=self._api_root())
|
|
91
|
+
from agentx.monitor.judge_scorers import JudgeScorersClient
|
|
92
|
+
# The unified LLM Judge Scorer (rubric + offline/online profiles in one entity) - the
|
|
93
|
+
# surface that matches the product; evaluations.settings and online_evaluators below
|
|
94
|
+
# remain as its profile-level views.
|
|
95
|
+
self.judge_scorers = JudgeScorersClient(api_key=api_key, base_url=self._api_root())
|
|
89
96
|
self.profile = MonitorProfileClient(self)
|
|
90
|
-
|
|
97
|
+
# Legacy view of an LLM Judge Scorer's online profile - constructed lazily so its
|
|
98
|
+
# DeprecationWarning fires on first USE, not for every client that never touches it.
|
|
99
|
+
self._online_evaluators: "MonitorOnlineEvaluatorClient | None" = None
|
|
91
100
|
from agentx.monitor.sessions import MonitorSessionClient
|
|
92
101
|
from agentx.monitor.agents import MonitorAgentClient
|
|
93
102
|
self.sessions = MonitorSessionClient(self)
|
|
@@ -171,6 +180,14 @@ class MonitorClient:
|
|
|
171
180
|
data = self._request("POST", "/online-evaluators", json=self._with_workspace(payload))
|
|
172
181
|
return MonitorOnlineEvaluator(**data["evaluator"])
|
|
173
182
|
|
|
183
|
+
@property
|
|
184
|
+
def online_evaluators(self) -> "MonitorOnlineEvaluatorClient":
|
|
185
|
+
if self._online_evaluators is None:
|
|
186
|
+
from agentx.monitor.online_evaluators import MonitorOnlineEvaluatorClient
|
|
187
|
+
|
|
188
|
+
self._online_evaluators = MonitorOnlineEvaluatorClient(self)
|
|
189
|
+
return self._online_evaluators
|
|
190
|
+
|
|
174
191
|
def list_online_evaluators(self) -> List[MonitorOnlineEvaluator]:
|
|
175
192
|
data = self._request("GET", "/online-evaluators", params=self._workspace_params())
|
|
176
193
|
return [MonitorOnlineEvaluator(**e) for e in data.get("evaluators", [])]
|