reasoning-deployment-service 0.4.3__py3-none-any.whl → 0.4.4__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.

Potentially problematic release.


This version of reasoning-deployment-service might be problematic. Click here for more details.

@@ -766,6 +766,76 @@ class ReasoningEngineDeploymentService:
766
766
  )
767
767
 
768
768
  return matches[0]
769
+
770
+ def patch_agent_space_metadata_and_auth(
771
+ self,
772
+ agent_id: str,
773
+ new_display_name: Optional[str] = None,
774
+ new_description: Optional[str] = None,
775
+ new_reasoning_engine: Optional[str] = None,
776
+ new_authorizations: Optional[list[str]] = None,
777
+ ) -> dict:
778
+ """
779
+ Patch only metadata (displayName, description) and linkage fields
780
+ (reasoningEngine, authorizations) for an existing Agent Space agent.
781
+ """
782
+ url = (
783
+ f"{DISCOVERY_ENGINE_URL}/projects/{self._project_id}/locations/global/"
784
+ f"collections/default_collection/engines/{self._agent_space_engine}/"
785
+ f"assistants/default_assistant/agents/{agent_id}"
786
+ )
787
+ headers = self._get_headers()
788
+
789
+ # GET current agent
790
+ resp = self._http.get(url, headers=headers, timeout=60)
791
+ resp.raise_for_status()
792
+ agent_data = resp.json()
793
+
794
+ # Prepare PATCH payload
795
+ patch_payload = {}
796
+
797
+ if new_display_name:
798
+ patch_payload["displayName"] = new_display_name
799
+ if new_description:
800
+ patch_payload["description"] = new_description
801
+
802
+ adk_def = agent_data.get("adkAgentDefinition", {})
803
+ patch_adk_def = {}
804
+
805
+ if new_reasoning_engine:
806
+ patch_adk_def.setdefault("provisionedReasoningEngine", {})[
807
+ "reasoningEngine"
808
+ ] = new_reasoning_engine
809
+
810
+ if new_authorizations is not None:
811
+ patch_adk_def["authorizations"] = new_authorizations
812
+
813
+ if patch_adk_def:
814
+ patch_payload["adkAgentDefinition"] = patch_adk_def
815
+
816
+ # Build updateMask
817
+ update_mask = []
818
+ if "displayName" in patch_payload:
819
+ update_mask.append("display_name")
820
+ if "description" in patch_payload:
821
+ update_mask.append("description")
822
+ if "adkAgentDefinition" in patch_payload:
823
+ if "provisionedReasoningEngine" in patch_payload["adkAgentDefinition"]:
824
+ update_mask.append("adk_agent_definition.provisioned_reasoning_engine")
825
+ if "authorizations" in patch_payload["adkAgentDefinition"]:
826
+ update_mask.append("adk_agent_definition.authorizations")
827
+
828
+ if not update_mask:
829
+ self.info("[AGENT PATCH] Nothing to update.")
830
+ return agent_data
831
+
832
+ patch_url = f"{url}?updateMask={','.join(update_mask)}"
833
+ self.info(f"[AGENT PATCH] PATCH {patch_url} with payload={json.dumps(patch_payload, indent=2)}")
834
+
835
+ patch_resp = self._http.patch(patch_url, headers=headers, json=patch_payload, timeout=60)
836
+ patch_resp.raise_for_status()
837
+
838
+ return patch_resp.json()
769
839
 
770
840
  def one_github_deployment_to_go(self):
771
841
  """
@@ -877,7 +947,6 @@ class ReasoningEngineDeploymentService:
877
947
  "tokenUri": "https://oauth2.googleapis.com/token",
878
948
  }
879
949
  }
880
- # remove None to keep payload clean
881
950
  if patch_payload["serverSideOauth2"]["clientSecret"] is None:
882
951
  patch_payload["serverSideOauth2"].pop("clientSecret", None)
883
952
 
@@ -899,59 +968,38 @@ class ReasoningEngineDeploymentService:
899
968
  self.info("[AUTH] No authorization_id configured; skipping authorization step.")
900
969
 
901
970
  # -----------------------------
902
- # 3) Agent Space Agent (create or update by displayName under engine)
971
+ # 3) Agent Space Agent (create or update)
903
972
  # -----------------------------
904
973
  self.info(f"[AGENT] Resolving by display_name={self._agent_space_name}")
905
974
  existing_agent = self.find_agent_space_agents_by_display(self._agent_space_name)
906
975
  self.info(f"[AGENT] find_agent_space_agents_by_display -> {json.dumps(existing_agent, indent=2)}")
907
976
 
908
- headers, payload = self._get_agent_space_payload(engine_rn)
909
- headers_log = headers.copy()
910
- if "Authorization" in headers_log:
911
- headers_log["Authorization"] = "Bearer ***"
912
- self.info(f"[AGENT] request headers={json.dumps(headers_log)}")
913
- self.info(f"[AGENT] payload={json.dumps(payload, indent=2)}")
914
-
915
977
  if not existing_agent:
916
- self.info(f"[AGENT] '{self._agent_space_name}' not found. Creating...")
978
+ # Fresh create
979
+ headers, payload = self._get_agent_space_payload(engine_rn)
917
980
  create_url = self._get_agent_space_agent_url_new()
918
981
  self.info(f"[AGENT] POST {create_url}")
919
982
  cr = self._http.post(create_url, headers=headers, json=payload, timeout=90)
920
- self.info(f"[AGENT] POST status={cr.status_code} ct={cr.headers.get('content-type','')}")
921
- try:
922
- self.info(f"[AGENT] POST body={json.dumps(cr.json(), indent=2)[:4000]}")
923
- except Exception:
924
- self.info(f"[AGENT] POST text={(cr.text or '')[:1000]}")
925
- if cr.status_code >= 400:
926
- self.error(f"[AGENT] Creation failed [{cr.status_code}].")
927
- cr.raise_for_status()
928
-
929
- try:
930
- j = cr.json() or {}
931
- except Exception:
932
- j = {}
933
- agent_name = j.get("name")
934
- self.info(f"[AGENT] create response name={agent_name}")
983
+ self.info(f"[AGENT] POST status={cr.status_code}")
984
+ cr.raise_for_status()
985
+ agent_name = (cr.json() or {}).get("name")
935
986
  if agent_name:
936
987
  self._write_engine_deployment({"agent_space_id": agent_name})
937
988
  self.info(f"[AGENT] Created: {agent_name}")
938
989
  else:
939
990
  self.warning("[AGENT] Created but response missing name. Verify in console.")
940
991
  else:
941
- self.info(f"[AGENT] '{self._agent_space_name}' exists. Updating...")
942
- patch_url = f"{DISCOVERY_ENGINE_URL}/{existing_agent['full_name']}"
943
- self.info(f"[AGENT] PATCH {patch_url}")
944
- ur = self._http.patch(patch_url, headers=headers, json=payload, timeout=90)
945
- self.info("payload")
946
- self.info(payload)
947
- self.info(f"[AGENT] PATCH status={ur.status_code} ct={ur.headers.get('content-type','')}")
948
- try:
949
- self.info(f"[AGENT] PATCH body={json.dumps(ur.json(), indent=2)[:4000]}")
950
- except Exception:
951
- self.info(f"[AGENT] PATCH text={(ur.text or '')[:1000]}")
952
- if ur.status_code >= 400:
953
- self.error(f"[AGENT] Update failed [{ur.status_code}].")
954
- ur.raise_for_status()
955
- self.info("[AGENT] Agent Space agent updated.")
992
+ # Safe patch using our new helper
993
+ self.info(f"[AGENT] '{self._agent_space_name}' exists. Patching metadata and auth only...")
994
+ patched = self.patch_agent_space_metadata_and_auth(
995
+ agent_id=existing_agent["id"],
996
+ new_display_name=self._agent_space_name,
997
+ new_description=self._agent_space_description,
998
+ new_reasoning_engine=engine_rn,
999
+ new_authorizations=[
1000
+ f"projects/{self._project_id}/locations/global/authorizations/{self._authorization_id}"
1001
+ ] if self._authorization_id else None,
1002
+ )
1003
+ self.info(f"[AGENT] PATCH result -> {json.dumps(patched, indent=2)[:2000]}")
956
1004
 
957
1005
  self.info("GitHub deployment completed successfully.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reasoning-deployment-service
3
- Version: 0.4.3
3
+ Version: 0.4.4
4
4
  Summary: Deployment helper for Vertex AI Reasoning Engines & Agent Spaces
5
5
  Author-email: Sergio Estrada <sergio.estrada@accenture.com>
6
6
  License: Apache-2.0
@@ -1,5 +1,5 @@
1
1
  reasoning_deployment_service/__init__.py,sha256=xDuKt9gGviQiTV6vXBdkBvygnlAOIrwnUjVaMGZy0L4,670
2
- reasoning_deployment_service/reasoning_deployment_service.py,sha256=Bug9Ea_Vk4egMyTUt9C8Jfx0BQv57gSjOJBZx4tQQl8,42304
2
+ reasoning_deployment_service/reasoning_deployment_service.py,sha256=IEYDkhjZa0xE2uxTqsF5n5DHPhagHpnbeicHycrdkjk,43897
3
3
  reasoning_deployment_service/runner.py,sha256=Y_SPGp26eoXRr8Ql6ugRF7jNYq3OwaytFIivuym6ICA,5428
4
4
  reasoning_deployment_service/cli_editor/__init__.py,sha256=bN8NPkw8riB92pj2lAwJZuEMOQIO_RRuge0ehnJTW1I,118
5
5
  reasoning_deployment_service/cli_editor/api_client.py,sha256=Kzx5iYp0MmowggrSmPLE7I2kt1-8xvdGBAgde9a1gCY,33681
@@ -22,8 +22,8 @@ reasoning_deployment_service/gui_editor/src/ui/authorization_view.py,sha256=BoNc
22
22
  reasoning_deployment_service/gui_editor/src/ui/reasoning_engine_view.py,sha256=tCvSPEf4dW0NRdAqfs3yT5Pa873gYeLzCMMIt2r2T4o,14644
23
23
  reasoning_deployment_service/gui_editor/src/ui/reasoning_engines_view.py,sha256=IRjFlBbY98usAZa0roOonjvWQOsF6NBW4bBg_k8KnKI,7860
24
24
  reasoning_deployment_service/gui_editor/src/ui/ui_components.py,sha256=HdQHy-oSZ3GobQ3FNdH7y_w3ANbFiuf2rMoflAmff0A,55366
25
- reasoning_deployment_service-0.4.3.dist-info/METADATA,sha256=rijIu4VInnB_noffloRO73jVUbrHW0wwDTGLAiKXzKg,5302
26
- reasoning_deployment_service-0.4.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
- reasoning_deployment_service-0.4.3.dist-info/entry_points.txt,sha256=onGKjR5ONTtRv3aqEtK863iw9Ty1kLcjfZlsplkRZrA,84
28
- reasoning_deployment_service-0.4.3.dist-info/top_level.txt,sha256=GKuQS1xHUYLZbatw9DmcYdBxxLhWhhGkV4FmFxgKdp0,29
29
- reasoning_deployment_service-0.4.3.dist-info/RECORD,,
25
+ reasoning_deployment_service-0.4.4.dist-info/METADATA,sha256=kB2YwVjqXGrfOw2J2u8G50qeV89W0coPI8r1K5Ucg6s,5302
26
+ reasoning_deployment_service-0.4.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
+ reasoning_deployment_service-0.4.4.dist-info/entry_points.txt,sha256=onGKjR5ONTtRv3aqEtK863iw9Ty1kLcjfZlsplkRZrA,84
28
+ reasoning_deployment_service-0.4.4.dist-info/top_level.txt,sha256=GKuQS1xHUYLZbatw9DmcYdBxxLhWhhGkV4FmFxgKdp0,29
29
+ reasoning_deployment_service-0.4.4.dist-info/RECORD,,