glaip-sdk 0.7.2__py3-none-any.whl → 0.7.3__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.
- glaip_sdk/agents/base.py +32 -9
- {glaip_sdk-0.7.2.dist-info → glaip_sdk-0.7.3.dist-info}/METADATA +1 -1
- {glaip_sdk-0.7.2.dist-info → glaip_sdk-0.7.3.dist-info}/RECORD +6 -6
- {glaip_sdk-0.7.2.dist-info → glaip_sdk-0.7.3.dist-info}/WHEEL +0 -0
- {glaip_sdk-0.7.2.dist-info → glaip_sdk-0.7.3.dist-info}/entry_points.txt +0 -0
- {glaip_sdk-0.7.2.dist-info → glaip_sdk-0.7.3.dist-info}/top_level.txt +0 -0
glaip_sdk/agents/base.py
CHANGED
|
@@ -46,8 +46,6 @@ import inspect
|
|
|
46
46
|
import logging
|
|
47
47
|
import warnings
|
|
48
48
|
from collections.abc import AsyncGenerator
|
|
49
|
-
|
|
50
|
-
|
|
51
49
|
from pathlib import Path
|
|
52
50
|
from typing import TYPE_CHECKING, Any
|
|
53
51
|
|
|
@@ -942,7 +940,16 @@ class Agent:
|
|
|
942
940
|
|
|
943
941
|
if check_local_runtime_available():
|
|
944
942
|
return get_default_runner()
|
|
945
|
-
|
|
943
|
+
|
|
944
|
+
# If agent is not deployed, it *must* use local runtime
|
|
945
|
+
if not self.id:
|
|
946
|
+
raise ValueError(f"{_AGENT_NOT_DEPLOYED_MSG}\n\n{get_local_runtime_missing_message()}")
|
|
947
|
+
|
|
948
|
+
# If agent IS deployed but local execution was forced (local=True)
|
|
949
|
+
raise ValueError(
|
|
950
|
+
f"Local execution override was requested, but local runtime is missing.\n\n"
|
|
951
|
+
f"{get_local_runtime_missing_message()}"
|
|
952
|
+
)
|
|
946
953
|
|
|
947
954
|
def _prepare_local_runner_kwargs(
|
|
948
955
|
self,
|
|
@@ -977,6 +984,7 @@ class Agent:
|
|
|
977
984
|
self,
|
|
978
985
|
message: str,
|
|
979
986
|
verbose: bool = False,
|
|
987
|
+
local: bool = False,
|
|
980
988
|
runtime_config: dict[str, Any] | None = None,
|
|
981
989
|
chat_history: list[dict[str, str]] | None = None,
|
|
982
990
|
**kwargs: Any,
|
|
@@ -989,9 +997,13 @@ class Agent:
|
|
|
989
997
|
- **Local**: When the agent is not deployed and glaip-sdk[local] is installed,
|
|
990
998
|
execution happens locally via aip-agents (no server required).
|
|
991
999
|
|
|
1000
|
+
You can force local execution for a deployed agent by passing `local=True`.
|
|
1001
|
+
|
|
992
1002
|
Args:
|
|
993
1003
|
message: The message to send to the agent.
|
|
994
1004
|
verbose: If True, print streaming output to console. Defaults to False.
|
|
1005
|
+
local: If True, force local execution even if the agent is deployed.
|
|
1006
|
+
Defaults to False.
|
|
995
1007
|
runtime_config: Optional runtime configuration for tools, MCPs, and agents.
|
|
996
1008
|
Keys can be SDK objects, UUIDs, or names. Example:
|
|
997
1009
|
{
|
|
@@ -1013,16 +1025,19 @@ class Agent:
|
|
|
1013
1025
|
RuntimeError: If server-backed execution fails due to client issues.
|
|
1014
1026
|
"""
|
|
1015
1027
|
# Backend routing: deployed agents use server, undeployed use local (if available)
|
|
1016
|
-
if self.id:
|
|
1028
|
+
if self.id and not local:
|
|
1017
1029
|
# Server-backed execution path (agent is deployed)
|
|
1018
1030
|
agent_client, call_kwargs = self._prepare_run_kwargs(
|
|
1019
|
-
message,
|
|
1031
|
+
message,
|
|
1032
|
+
verbose,
|
|
1033
|
+
runtime_config or kwargs.get("runtime_config"),
|
|
1034
|
+
**kwargs,
|
|
1020
1035
|
)
|
|
1021
1036
|
if chat_history is not None:
|
|
1022
1037
|
call_kwargs["chat_history"] = chat_history
|
|
1023
1038
|
return agent_client.run_agent(**call_kwargs)
|
|
1024
1039
|
|
|
1025
|
-
# Local execution path (agent is not deployed)
|
|
1040
|
+
# Local execution path (agent is not deployed OR local=True)
|
|
1026
1041
|
runner = self._get_local_runner_or_raise()
|
|
1027
1042
|
local_kwargs = self._prepare_local_runner_kwargs(message, verbose, runtime_config, chat_history, **kwargs)
|
|
1028
1043
|
return runner.run(**local_kwargs)
|
|
@@ -1031,6 +1046,7 @@ class Agent:
|
|
|
1031
1046
|
self,
|
|
1032
1047
|
message: str,
|
|
1033
1048
|
verbose: bool = False,
|
|
1049
|
+
local: bool = False,
|
|
1034
1050
|
runtime_config: dict[str, Any] | None = None,
|
|
1035
1051
|
chat_history: list[dict[str, str]] | None = None,
|
|
1036
1052
|
**kwargs: Any,
|
|
@@ -1043,9 +1059,13 @@ class Agent:
|
|
|
1043
1059
|
- **Local**: When the agent is not deployed and glaip-sdk[local] is installed,
|
|
1044
1060
|
execution happens locally via aip-agents (no server required).
|
|
1045
1061
|
|
|
1062
|
+
You can force local execution for a deployed agent by passing `local=True`.
|
|
1063
|
+
|
|
1046
1064
|
Args:
|
|
1047
1065
|
message: The message to send to the agent.
|
|
1048
1066
|
verbose: If True, print streaming output to console. Defaults to False.
|
|
1067
|
+
local: If True, force local execution even if the agent is deployed.
|
|
1068
|
+
Defaults to False.
|
|
1049
1069
|
runtime_config: Optional runtime configuration for tools, MCPs, and agents.
|
|
1050
1070
|
Keys can be SDK objects, UUIDs, or names. Example:
|
|
1051
1071
|
{
|
|
@@ -1067,10 +1087,13 @@ class Agent:
|
|
|
1067
1087
|
RuntimeError: If server-backed execution fails due to client issues.
|
|
1068
1088
|
"""
|
|
1069
1089
|
# Backend routing: deployed agents use server, undeployed use local (if available)
|
|
1070
|
-
if self.id:
|
|
1090
|
+
if self.id and not local:
|
|
1071
1091
|
# Server-backed execution path (agent is deployed)
|
|
1072
1092
|
agent_client, call_kwargs = self._prepare_run_kwargs(
|
|
1073
|
-
message,
|
|
1093
|
+
message,
|
|
1094
|
+
verbose,
|
|
1095
|
+
runtime_config or kwargs.get("runtime_config"),
|
|
1096
|
+
**kwargs,
|
|
1074
1097
|
)
|
|
1075
1098
|
if chat_history is not None:
|
|
1076
1099
|
call_kwargs["chat_history"] = chat_history
|
|
@@ -1079,7 +1102,7 @@ class Agent:
|
|
|
1079
1102
|
yield chunk
|
|
1080
1103
|
return
|
|
1081
1104
|
|
|
1082
|
-
# Local execution path (agent is not deployed)
|
|
1105
|
+
# Local execution path (agent is not deployed OR local=True)
|
|
1083
1106
|
runner = self._get_local_runner_or_raise()
|
|
1084
1107
|
local_kwargs = self._prepare_local_runner_kwargs(message, verbose, runtime_config, chat_history, **kwargs)
|
|
1085
1108
|
result = await runner.arun(**local_kwargs)
|
|
@@ -5,7 +5,7 @@ glaip_sdk/exceptions.py,sha256=iAChFClkytXRBLP0vZq1_YjoZxA9i4m4bW1gDLiGR1g,2321
|
|
|
5
5
|
glaip_sdk/icons.py,sha256=J5THz0ReAmDwIiIooh1_G3Le-mwTJyEjhJDdJ13KRxM,524
|
|
6
6
|
glaip_sdk/rich_components.py,sha256=44Z0V1ZQleVh9gUDGwRR5mriiYFnVGOhm7fFxZYbP8c,4052
|
|
7
7
|
glaip_sdk/agents/__init__.py,sha256=VfYov56edbWuySXFEbWJ_jLXgwnFzPk1KB-9-mfsUCc,776
|
|
8
|
-
glaip_sdk/agents/base.py,sha256=
|
|
8
|
+
glaip_sdk/agents/base.py,sha256=GQnzCw2cqlrbxwdoWFfhBcBlEDgubY4tlD6gr1b3zps,44539
|
|
9
9
|
glaip_sdk/cli/__init__.py,sha256=xCCfuF1Yc7mpCDcfhHZTX0vizvtrDSLeT8MJ3V7m5A0,156
|
|
10
10
|
glaip_sdk/cli/account_store.py,sha256=TK4iTV93Q1uD9mCY_2ZMT6EazHKU2jX0qhgWfEM4V-4,18459
|
|
11
11
|
glaip_sdk/cli/agent_config.py,sha256=YAbFKrTNTRqNA6b0i0Q3pH-01rhHDRi5v8dxSFwGSwM,2401
|
|
@@ -203,8 +203,8 @@ glaip_sdk/utils/rendering/steps/format.py,sha256=Chnq7OBaj8XMeBntSBxrX5zSmrYeGcO
|
|
|
203
203
|
glaip_sdk/utils/rendering/steps/manager.py,sha256=BiBmTeQMQhjRMykgICXsXNYh1hGsss-fH9BIGVMWFi0,13194
|
|
204
204
|
glaip_sdk/utils/rendering/viewer/__init__.py,sha256=XrxmE2cMAozqrzo1jtDFm8HqNtvDcYi2mAhXLXn5CjI,457
|
|
205
205
|
glaip_sdk/utils/rendering/viewer/presenter.py,sha256=mlLMTjnyeyPVtsyrAbz1BJu9lFGQSlS-voZ-_Cuugv0,5725
|
|
206
|
-
glaip_sdk-0.7.
|
|
207
|
-
glaip_sdk-0.7.
|
|
208
|
-
glaip_sdk-0.7.
|
|
209
|
-
glaip_sdk-0.7.
|
|
210
|
-
glaip_sdk-0.7.
|
|
206
|
+
glaip_sdk-0.7.3.dist-info/METADATA,sha256=9tLJ5ibX4VkSGKji1SulcZiJ58d6Jefg8ts_UaLdU_E,8365
|
|
207
|
+
glaip_sdk-0.7.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
208
|
+
glaip_sdk-0.7.3.dist-info/entry_points.txt,sha256=65vNPUggyYnVGhuw7RhNJ8Fp2jygTcX0yxJBcBY3iLU,48
|
|
209
|
+
glaip_sdk-0.7.3.dist-info/top_level.txt,sha256=td7yXttiYX2s94-4wFhv-5KdT0rSZ-pnJRSire341hw,10
|
|
210
|
+
glaip_sdk-0.7.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|