agentx-python 0.8.25__py3-none-any.whl → 0.8.26__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.
@@ -7,4 +7,5 @@
7
7
  # from agentx.integrations.anthropic import patch_anthropic_client
8
8
  # from agentx.integrations.google_adk import AgentXADKPlugin
9
9
  # from agentx.integrations.google_genai import patch_genai_client
10
+ # from agentx.integrations.nvidia_nim import patch_nim_client
10
11
  # from agentx.integrations.moveworks import MoveworksImporter # Data API pull sync, not in-process
@@ -0,0 +1,70 @@
1
+ """
2
+ NVIDIA NIM integration for AgentX production tracing.
3
+
4
+ NIM (NVIDIA Inference Microservices) serves models behind an OpenAI-compatible
5
+ ``/v1/chat/completions`` API, so the client you patch is the ordinary ``openai``
6
+ Python client pointed at a NIM endpoint - a local NIM container
7
+ (``http://localhost:8000/v1``) or NVIDIA's hosted API
8
+ (``https://integrate.api.nvidia.com/v1``). This module reuses the OpenAI patch
9
+ machinery verbatim and differs in exactly one way: traces are stamped
10
+ ``framework="nvidia-nim"``, so NIM traffic gets its own row in Monitor's
11
+ Platforms chart and the framework filters instead of blending into "openai".
12
+
13
+ Usage::
14
+
15
+ from agentx.integrations.nvidia_nim import patch_nim_client
16
+ import openai
17
+
18
+ nim = openai.OpenAI(
19
+ base_url="http://localhost:8000/v1", # or https://integrate.api.nvidia.com/v1
20
+ api_key=os.environ.get("NVIDIA_API_KEY", "not-needed-for-local-nim"),
21
+ )
22
+ patch_nim_client(nim, agentx.tracer, name="nim-agent")
23
+
24
+ # All subsequent nim.chat.completions.create() calls are now traced.
25
+
26
+ Works with both ``openai.OpenAI`` and ``openai.AsyncOpenAI`` clients. Token
27
+ usage comes straight off the response's OpenAI-shaped ``usage`` block; NIM
28
+ reports no prompt-cache fields, so cache token counts stay unset.
29
+
30
+ Streaming calls (``stream=True``) are passed through untouched and are not
31
+ currently traced - same posture as ``patch_openai_client``, see its docstring.
32
+
33
+ Requires: ``pip install "agentx-python[nvidia-nim]"`` (installs the ``openai``
34
+ client package; there is no separate NIM SDK dependency).
35
+ """
36
+ from __future__ import annotations
37
+
38
+ from typing import Any, Dict, Optional
39
+
40
+ from agentx.tracing.tracer import Tracer
41
+ from agentx.integrations.openai import _patch_chat_completions_create
42
+
43
+ NIM_FRAMEWORK = "nvidia-nim"
44
+
45
+
46
+ def patch_nim_client(
47
+ client: Any,
48
+ tracer: Tracer,
49
+ name: str = "nim-agent",
50
+ metadata: Optional[Dict[str, Any]] = None,
51
+ session_id: Optional[str] = None,
52
+ ) -> None:
53
+ """
54
+ Monkey-patch ``client.chat.completions.create`` on an OpenAI-compatible
55
+ client pointed at a NIM endpoint, sending a trace for every non-streaming
56
+ call with ``framework="nvidia-nim"``.
57
+
58
+ The original method is still called and its return value passed through
59
+ unchanged. Sync and async clients both work; ``stream=True`` calls pass
60
+ through untraced. Patching is idempotent - and because it shares the guard
61
+ with ``patch_openai_client``, whichever of the two patched a given client
62
+ first wins (patch each client with the integration that matches where its
63
+ ``base_url`` actually points).
64
+ """
65
+ chat = getattr(client, "chat", None)
66
+ completions = getattr(chat, "completions", None) if chat is not None else None
67
+ if completions is None:
68
+ raise ValueError("Provided client does not have a .chat.completions attribute")
69
+
70
+ _patch_chat_completions_create(completions, tracer, name, metadata, session_id, framework=NIM_FRAMEWORK)
@@ -113,7 +113,11 @@ def _patch_chat_completions_create(
113
113
  name: str,
114
114
  metadata: Optional[Dict[str, Any]],
115
115
  session_id: Optional[str],
116
+ framework: str = "openai",
116
117
  ) -> None:
118
+ # `framework` exists for OpenAI-compatible endpoints served by other vendors
119
+ # (agentx.integrations.nvidia_nim stamps "nvidia-nim" through here) - the request/response
120
+ # shapes are identical, so they share this machinery instead of duplicating it.
117
121
  original = completions_resource.create
118
122
  if getattr(original, "_agentx_patched", False):
119
123
  return # already patched
@@ -148,7 +152,7 @@ def _patch_chat_completions_create(
148
152
  finish_llm_call(
149
153
  tracer,
150
154
  name=name,
151
- framework="openai",
155
+ framework=framework,
152
156
  metadata=metadata,
153
157
  session_id=session_id,
154
158
  start_t=start_t,
agentx/version.py CHANGED
@@ -1,7 +1,7 @@
1
- VERSION = "0.8.25"
1
+ VERSION = "0.8.26"
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.28"
7
+ ENGINE_VERSION = "v0.3.29"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentx-python
3
- Version: 0.8.25
3
+ Version: 0.8.26
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
@@ -23,6 +23,8 @@ Provides-Extra: openai-agents
23
23
  Requires-Dist: openai-agents>=0.0.3; extra == "openai-agents"
24
24
  Provides-Extra: openai
25
25
  Requires-Dist: openai>=1.0.0; extra == "openai"
26
+ Provides-Extra: nvidia-nim
27
+ Requires-Dist: openai>=1.0.0; extra == "nvidia-nim"
26
28
  Provides-Extra: anthropic
27
29
  Requires-Dist: anthropic>=0.25.0; extra == "anthropic"
28
30
  Provides-Extra: google-adk
@@ -250,6 +252,7 @@ extra:
250
252
  | CrewAI | `pip install "agentx-python[crewai]"` | `AgentXCrewObserver` |
251
253
  | OpenAI Agents SDK | `pip install "agentx-python[openai-agents]"` | `AgentXTracingProcessor` |
252
254
  | OpenAI (raw client) | `pip install "agentx-python[openai]"` | `patch_openai_client` |
255
+ | NVIDIA NIM | `pip install "agentx-python[nvidia-nim]"` | `patch_nim_client` |
253
256
  | Anthropic | `pip install "agentx-python[anthropic]"` | `patch_anthropic_client` |
254
257
  | Google ADK | `pip install "agentx-python[google-adk]"` | `AgentXADKPlugin` |
255
258
  | Google GenAI (Gemini) | `pip install "agentx-python[google-genai]"` | `patch_genai_client` |
@@ -10,7 +10,7 @@ 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=5NwobACaQAFSlFPHs5YxWk1ukEuHv1RHNtfpjXDLuHA,366
13
+ agentx/version.py,sha256=mHuhKZSPSp8Xp5Pq7q93wgdcMtBUM_OBt-nWG4Qoh6g,366
14
14
  agentx/evaluations/__init__.py,sha256=Erv7RGFlRxGTG4rVb2uHhCqLLEX_iAWKqkZKzK6CumE,262
15
15
  agentx/evaluations/_term.py,sha256=WFpiNzdgDBeJJ-Gg-6X7TwwxllobuE4OqFUTuDQvS3Y,2529
16
16
  agentx/evaluations/client.py,sha256=7c35tS8zM3fuvFfVDQk5etTTEFiIykmPjuJxkuFyFTY,38013
@@ -27,7 +27,7 @@ agentx/evaluations/adapters/__init__.py,sha256=fK8Hx75usbiY03XUSmnLnSrwBXip2CQs2
27
27
  agentx/evaluations/adapters/http_endpoint.py,sha256=-Gika9lBcXjtbnyB-uNR6nYEVJhWEPtDazi9ixLvJtg,2059
28
28
  agentx/evaluations/adapters/precomputed.py,sha256=vxnQELmpiU2NkQATfiVjG7v1ZmmkrEA70Y11ijfYtHw,1208
29
29
  agentx/evaluations/adapters/raw.py,sha256=FkDq_mdf21-xt5EHnGyIGcS6VZxkEkFcmM9VTd-T5sA,1130
30
- agentx/integrations/__init__.py,sha256=W-EcQhHE01-SGPeKTB2AgfvUyRzNP4BqUMMtP2qQ4Q0,647
30
+ agentx/integrations/__init__.py,sha256=p-YHLIudYxQj1bBj77NiVPsP0VQHemX5E59phkI3Y-Q,711
31
31
  agentx/integrations/_traced_call.py,sha256=OuFmSLw5vjI54gpdte7-zOt7gld7faQmvhuoh_3OPlo,6861
32
32
  agentx/integrations/anthropic.py,sha256=z6o9cC9rBzxxbF1UBiMr-kjEgDUO-BCuPOFoqGN3qF4,10451
33
33
  agentx/integrations/autogen.py,sha256=V1kvTjxQqOG9KsYd4dztaRYH7zTknW0_fqzKjIQG5dk,9507
@@ -39,7 +39,8 @@ agentx/integrations/langchain.py,sha256=YDeEFT2irhoEvydwt3QjbmTpk_AZZbYPS9euOR18
39
39
  agentx/integrations/litellm.py,sha256=eW8iCaNq0feRbZma8iOvmJ28WiAO7ZaRmlpPjHAtcvo,7072
40
40
  agentx/integrations/llamaindex.py,sha256=ruzMiC2TC3Xhub4xoXKPHjsvzV1sQ3QqhjkAdMxUUi4,18001
41
41
  agentx/integrations/moveworks.py,sha256=IyBswLE5LwMSp1VbIvG5izYV5BvXmv4atZelnrDn8SE,25670
42
- agentx/integrations/openai.py,sha256=1KLs-hJaeW2emHPwNkmC3zcGksL3zd87uWbcLGRW704,6644
42
+ agentx/integrations/nvidia_nim.py,sha256=bvS6ebEnQZT1DVlIjQQ2RKLI4uPPTdlMKINgDwj0Z-o,2961
43
+ agentx/integrations/openai.py,sha256=edJL-HXTO7w-vvIZGQChMu0AnPCY5z0duplIi8z2gXE,6936
43
44
  agentx/integrations/openai_agents.py,sha256=KSOQ55eRPFxxkqm7p4Dsz6HcJ_9uUEwlyywPI8dwbvY,14852
44
45
  agentx/monitor/__init__.py,sha256=Rkk-Xv1ymXwDFbx8fetmcOzXfSU1bvsazI_-x5Ati5g,1715
45
46
  agentx/monitor/_transport.py,sha256=ge0pmdvFdUtCJRkTLvAgjuTQVA8YOCYGQNoyRuselRk,2077
@@ -67,9 +68,9 @@ agentx/tracing/eval_scope.py,sha256=ElMbPxpqpQBVuaUnHNlw9RIQu71oyOpd0yR55bDH8eI,
67
68
  agentx/tracing/framework_detect.py,sha256=uV4O7Th-4_2UkdooAyaWCOIA0jwLJbblFQ_ucFDjeJM,2638
68
69
  agentx/tracing/ingest_client.py,sha256=teukTPckFWPg5RhpbGbVDBejBzPIPXUO3_DJcuVh2uc,22660
69
70
  agentx/tracing/tracer.py,sha256=NS0bs5HbDDK3l0Z95KVKV3xCNJT7LINS0EoPFM-wzIk,68543
70
- agentx_python-0.8.25.dist-info/licenses/LICENSE,sha256=gZVsM-nLsE8vlaY6NXXsVoo6IlCClxkToAWmhgT3y_s,10762
71
- agentx_python-0.8.25.dist-info/METADATA,sha256=8N9cFzwTIJc93T1hKF1XbrjrBb8Ho_kcrgnFTWlZVJU,22806
72
- agentx_python-0.8.25.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
73
- agentx_python-0.8.25.dist-info/entry_points.txt,sha256=rQqF1JTY3T1yfviBU1r8PU-5mBdfOk6P4bZ1L4BskIM,172
74
- agentx_python-0.8.25.dist-info/top_level.txt,sha256=s-q-HB9Gb_QdrZNacSeQyF_c25gQooMy7DlxzgLOHPk,7
75
- agentx_python-0.8.25.dist-info/RECORD,,
71
+ agentx_python-0.8.26.dist-info/licenses/LICENSE,sha256=gZVsM-nLsE8vlaY6NXXsVoo6IlCClxkToAWmhgT3y_s,10762
72
+ agentx_python-0.8.26.dist-info/METADATA,sha256=JH0SY8e_dBGzmK92xd_Cas62qpPweH0BoBLbDmE7xPA,22986
73
+ agentx_python-0.8.26.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
74
+ agentx_python-0.8.26.dist-info/entry_points.txt,sha256=rQqF1JTY3T1yfviBU1r8PU-5mBdfOk6P4bZ1L4BskIM,172
75
+ agentx_python-0.8.26.dist-info/top_level.txt,sha256=s-q-HB9Gb_QdrZNacSeQyF_c25gQooMy7DlxzgLOHPk,7
76
+ agentx_python-0.8.26.dist-info/RECORD,,