glaip-sdk 0.7.13__py3-none-any.whl → 0.7.15__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 +86 -9
- glaip_sdk/cli/commands/agents/__init__.py +14 -17
- glaip_sdk/cli/commands/agents/_common.py +6 -5
- glaip_sdk/cli/commands/agents/create.py +9 -5
- glaip_sdk/client/agents.py +247 -15
- glaip_sdk/client/base.py +25 -0
- glaip_sdk/client/main.py +0 -4
- glaip_sdk/client/payloads/agent/requests.py +6 -1
- glaip_sdk/config/constants.py +22 -2
- glaip_sdk/models/__init__.py +30 -1
- glaip_sdk/models/_provider_mappings.py +101 -0
- glaip_sdk/models/_validation.py +97 -0
- glaip_sdk/models/agent.py +2 -1
- glaip_sdk/models/constants.py +141 -0
- glaip_sdk/models/model.py +170 -0
- glaip_sdk/runner/langgraph.py +212 -30
- glaip_sdk/utils/agent_config.py +8 -2
- glaip_sdk/utils/runtime_config.py +3 -2
- {glaip_sdk-0.7.13.dist-info → glaip_sdk-0.7.15.dist-info}/METADATA +1 -1
- {glaip_sdk-0.7.13.dist-info → glaip_sdk-0.7.15.dist-info}/RECORD +23 -19
- {glaip_sdk-0.7.13.dist-info → glaip_sdk-0.7.15.dist-info}/WHEEL +0 -0
- {glaip_sdk-0.7.13.dist-info → glaip_sdk-0.7.15.dist-info}/entry_points.txt +0 -0
- {glaip_sdk-0.7.13.dist-info → glaip_sdk-0.7.15.dist-info}/top_level.txt +0 -0
glaip_sdk/runner/langgraph.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# pylint: disable=duplicate-code
|
|
1
2
|
"""LangGraph-based runner for local agent execution.
|
|
2
3
|
|
|
3
4
|
This module provides the LangGraphRunner which executes glaip-sdk agents
|
|
@@ -23,21 +24,20 @@ import logging
|
|
|
23
24
|
from dataclasses import dataclass
|
|
24
25
|
from typing import TYPE_CHECKING, Any
|
|
25
26
|
|
|
26
|
-
from gllm_core.utils import LoggerManager
|
|
27
|
-
|
|
28
27
|
from glaip_sdk.client.run_rendering import AgentRunRenderingManager
|
|
29
28
|
from glaip_sdk.hitl import PauseResumeCallback
|
|
29
|
+
from glaip_sdk.models import DEFAULT_MODEL
|
|
30
30
|
from glaip_sdk.runner.base import BaseRunner
|
|
31
31
|
from glaip_sdk.runner.deps import (
|
|
32
32
|
check_local_runtime_available,
|
|
33
33
|
get_local_runtime_missing_message,
|
|
34
34
|
)
|
|
35
35
|
from glaip_sdk.utils.tool_storage_provider import build_tool_output_manager
|
|
36
|
+
from gllm_core.utils import LoggerManager
|
|
36
37
|
|
|
37
38
|
if TYPE_CHECKING:
|
|
38
|
-
from langchain_core.messages import BaseMessage
|
|
39
|
-
|
|
40
39
|
from glaip_sdk.agents.base import Agent
|
|
40
|
+
from langchain_core.messages import BaseMessage
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
_AIP_LOGS_SWALLOWED = False
|
|
@@ -70,6 +70,10 @@ def _swallow_aip_logs(level: int = logging.ERROR) -> None:
|
|
|
70
70
|
logger = LoggerManager().get_logger(__name__)
|
|
71
71
|
|
|
72
72
|
|
|
73
|
+
# Constants for MCP configuration validation
|
|
74
|
+
_MCP_TRANSPORT_KEYS = {"url", "command", "args", "env", "timeout", "headers"}
|
|
75
|
+
|
|
76
|
+
|
|
73
77
|
def _convert_chat_history_to_messages(
|
|
74
78
|
chat_history: list[dict[str, str]] | None,
|
|
75
79
|
) -> list[BaseMessage]:
|
|
@@ -85,7 +89,11 @@ def _convert_chat_history_to_messages(
|
|
|
85
89
|
if not chat_history:
|
|
86
90
|
return []
|
|
87
91
|
|
|
88
|
-
from langchain_core.messages import
|
|
92
|
+
from langchain_core.messages import ( # noqa: PLC0415
|
|
93
|
+
AIMessage,
|
|
94
|
+
HumanMessage,
|
|
95
|
+
SystemMessage,
|
|
96
|
+
)
|
|
89
97
|
|
|
90
98
|
messages: list[BaseMessage] = []
|
|
91
99
|
for msg in chat_history:
|
|
@@ -120,7 +128,7 @@ class LangGraphRunner(BaseRunner):
|
|
|
120
128
|
Defaults to "gpt-4o-mini".
|
|
121
129
|
"""
|
|
122
130
|
|
|
123
|
-
default_model: str =
|
|
131
|
+
default_model: str = DEFAULT_MODEL
|
|
124
132
|
|
|
125
133
|
def run(
|
|
126
134
|
self,
|
|
@@ -258,7 +266,9 @@ class LangGraphRunner(BaseRunner):
|
|
|
258
266
|
|
|
259
267
|
# Build the local LangGraphReactAgent from the glaip_sdk Agent
|
|
260
268
|
local_agent = self.build_langgraph_agent(
|
|
261
|
-
agent,
|
|
269
|
+
agent,
|
|
270
|
+
runtime_config=runtime_config,
|
|
271
|
+
pause_resume_callback=pause_resume_callback,
|
|
262
272
|
)
|
|
263
273
|
|
|
264
274
|
# Convert chat history to LangChain messages for the agent
|
|
@@ -306,10 +316,17 @@ class LangGraphRunner(BaseRunner):
|
|
|
306
316
|
raise
|
|
307
317
|
|
|
308
318
|
# Use shared finalizer to avoid code duplication
|
|
309
|
-
from glaip_sdk.client.run_rendering import
|
|
319
|
+
from glaip_sdk.client.run_rendering import ( # noqa: PLC0415
|
|
320
|
+
finalize_render_manager,
|
|
321
|
+
)
|
|
310
322
|
|
|
311
323
|
return finalize_render_manager(
|
|
312
|
-
render_manager,
|
|
324
|
+
render_manager,
|
|
325
|
+
renderer,
|
|
326
|
+
final_text,
|
|
327
|
+
stats_usage,
|
|
328
|
+
started_monotonic,
|
|
329
|
+
finished_monotonic,
|
|
313
330
|
)
|
|
314
331
|
|
|
315
332
|
def build_langgraph_agent(
|
|
@@ -339,7 +356,6 @@ class LangGraphRunner(BaseRunner):
|
|
|
339
356
|
ValueError: If agent has unsupported tools, MCPs, or sub-agents for local mode.
|
|
340
357
|
"""
|
|
341
358
|
from aip_agents.agent import LangGraphReactAgent # noqa: PLC0415
|
|
342
|
-
|
|
343
359
|
from glaip_sdk.runner.tool_adapter import LangChainToolAdapter # noqa: PLC0415
|
|
344
360
|
|
|
345
361
|
# Adapt tools for local execution
|
|
@@ -364,6 +380,9 @@ class LangGraphRunner(BaseRunner):
|
|
|
364
380
|
merged_agent_config = self._merge_agent_config(agent, normalized_config)
|
|
365
381
|
agent_config_params, agent_config_kwargs = self._apply_agent_config(merged_agent_config)
|
|
366
382
|
|
|
383
|
+
# Resolve model and merge its configuration into agent kwargs
|
|
384
|
+
model_string = self._resolve_local_model(agent, agent_config_kwargs)
|
|
385
|
+
|
|
367
386
|
tool_output_manager = self._resolve_tool_output_manager(
|
|
368
387
|
agent,
|
|
369
388
|
merged_agent_config,
|
|
@@ -382,7 +401,7 @@ class LangGraphRunner(BaseRunner):
|
|
|
382
401
|
name=agent.name,
|
|
383
402
|
instruction=agent.instruction,
|
|
384
403
|
description=agent.description,
|
|
385
|
-
model=
|
|
404
|
+
model=model_string,
|
|
386
405
|
tools=langchain_tools,
|
|
387
406
|
agents=sub_agent_instances if sub_agent_instances else None,
|
|
388
407
|
tool_configs=tool_configs if tool_configs else None,
|
|
@@ -434,7 +453,9 @@ class LangGraphRunner(BaseRunner):
|
|
|
434
453
|
hitl_enabled = merged_agent_config.get("hitl_enabled", False)
|
|
435
454
|
if hitl_enabled:
|
|
436
455
|
try:
|
|
437
|
-
from aip_agents.agent.hitl.manager import
|
|
456
|
+
from aip_agents.agent.hitl.manager import ( # noqa: PLC0415
|
|
457
|
+
ApprovalManager,
|
|
458
|
+
)
|
|
438
459
|
from glaip_sdk.hitl import LocalPromptHandler # noqa: PLC0415
|
|
439
460
|
|
|
440
461
|
local_agent.hitl_manager = ApprovalManager(
|
|
@@ -443,7 +464,10 @@ class LangGraphRunner(BaseRunner):
|
|
|
443
464
|
# Store callback reference for setting renderer later
|
|
444
465
|
if pause_resume_callback:
|
|
445
466
|
local_agent._pause_resume_callback = pause_resume_callback
|
|
446
|
-
logger.debug(
|
|
467
|
+
logger.debug(
|
|
468
|
+
"HITL manager injected for agent '%s' (hitl_enabled=True)",
|
|
469
|
+
agent_name,
|
|
470
|
+
)
|
|
447
471
|
except ImportError as e:
|
|
448
472
|
# Missing dependencies - fail fast
|
|
449
473
|
raise ImportError("Local HITL requires aip_agents. Install with: pip install 'glaip-sdk[local]'") from e
|
|
@@ -451,7 +475,10 @@ class LangGraphRunner(BaseRunner):
|
|
|
451
475
|
# Other errors during HITL setup - fail fast
|
|
452
476
|
raise RuntimeError(f"Failed to initialize HITL manager for agent '{agent_name}'") from e
|
|
453
477
|
else:
|
|
454
|
-
logger.debug(
|
|
478
|
+
logger.debug(
|
|
479
|
+
"HITL manager not injected for agent '%s' (hitl_enabled=False)",
|
|
480
|
+
agent_name,
|
|
481
|
+
)
|
|
455
482
|
|
|
456
483
|
def _build_sub_agents(
|
|
457
484
|
self,
|
|
@@ -727,6 +754,7 @@ class LangGraphRunner(BaseRunner):
|
|
|
727
754
|
"""
|
|
728
755
|
direct_params = {}
|
|
729
756
|
kwargs_params = {}
|
|
757
|
+
config_dict = {}
|
|
730
758
|
|
|
731
759
|
# Direct constructor parameters
|
|
732
760
|
if "planning" in agent_config:
|
|
@@ -738,19 +766,86 @@ class LangGraphRunner(BaseRunner):
|
|
|
738
766
|
# Kwargs parameters (passed through **kwargs to BaseAgent)
|
|
739
767
|
if "enable_pii" in agent_config:
|
|
740
768
|
kwargs_params["enable_pii"] = agent_config["enable_pii"]
|
|
769
|
+
config_dict["enable_pii"] = agent_config["enable_pii"]
|
|
741
770
|
|
|
742
771
|
if "memory" in agent_config:
|
|
743
772
|
# Map "memory" to "memory_backend" for aip-agents compatibility
|
|
744
773
|
kwargs_params["memory_backend"] = agent_config["memory"]
|
|
774
|
+
config_dict["memory_backend"] = agent_config["memory"]
|
|
745
775
|
|
|
746
776
|
# Additional memory-related settings
|
|
747
777
|
memory_settings = ["agent_id", "memory_namespace", "save_interaction_to_memory"]
|
|
748
778
|
for key in memory_settings:
|
|
749
779
|
if key in agent_config:
|
|
750
780
|
kwargs_params[key] = agent_config[key]
|
|
781
|
+
config_dict[key] = agent_config[key]
|
|
782
|
+
|
|
783
|
+
# Ensure we pass a config dictionary to BaseAgent, which uses it for
|
|
784
|
+
# LM configuration (api keys, etc.) and other settings.
|
|
785
|
+
if config_dict:
|
|
786
|
+
kwargs_params["config"] = config_dict
|
|
751
787
|
|
|
752
788
|
return direct_params, kwargs_params
|
|
753
789
|
|
|
790
|
+
def _convert_model_for_local(self, model: Any) -> tuple[str, dict[str, Any]]:
|
|
791
|
+
"""Convert model to aip_agents format for local execution.
|
|
792
|
+
|
|
793
|
+
Args:
|
|
794
|
+
model: Model object or string identifier.
|
|
795
|
+
|
|
796
|
+
Returns:
|
|
797
|
+
Tuple of (model_string, config_dict).
|
|
798
|
+
"""
|
|
799
|
+
from glaip_sdk.models._validation import ( # noqa: PLC0415
|
|
800
|
+
convert_model_for_local_execution,
|
|
801
|
+
)
|
|
802
|
+
|
|
803
|
+
return convert_model_for_local_execution(model)
|
|
804
|
+
|
|
805
|
+
def _resolve_local_model(self, agent: Agent, agent_config_kwargs: dict[str, Any]) -> str:
|
|
806
|
+
"""Resolve model string and merge its configuration into agent kwargs.
|
|
807
|
+
|
|
808
|
+
This method extracts model-specific credentials and hyperparameters from a Model
|
|
809
|
+
object and merges them into the 'config' dictionary within agent_config_kwargs.
|
|
810
|
+
This is required because BaseAgent expects LM settings (api keys, etc.) to be
|
|
811
|
+
inside the 'config' parameter, not top-level kwargs.
|
|
812
|
+
|
|
813
|
+
Example:
|
|
814
|
+
If agent has:
|
|
815
|
+
- model = Model(id="deepinfra/model", credentials="key-123")
|
|
816
|
+
- agent_config_kwargs = {"enable_pii": True, "config": {"enable_pii": True}}
|
|
817
|
+
|
|
818
|
+
_resolve_local_model will:
|
|
819
|
+
1. Resolve model_string to "openai-compatible/model"
|
|
820
|
+
2. Extract model_config as {"lm_api_key": "key-123"}
|
|
821
|
+
3. Update agent_config_kwargs["config"] to:
|
|
822
|
+
{"enable_pii": True, "lm_api_key": "key-123"}
|
|
823
|
+
|
|
824
|
+
Args:
|
|
825
|
+
agent: The glaip_sdk Agent.
|
|
826
|
+
agent_config_kwargs: Agent config kwargs to update (modified in-place).
|
|
827
|
+
|
|
828
|
+
Returns:
|
|
829
|
+
The model identifier string for local execution.
|
|
830
|
+
"""
|
|
831
|
+
model_to_use = agent.model or self.default_model
|
|
832
|
+
model_string, model_config = self._convert_model_for_local(model_to_use)
|
|
833
|
+
|
|
834
|
+
if model_config:
|
|
835
|
+
# Normalize config to a dict early to simplify merging
|
|
836
|
+
config_val = agent_config_kwargs.get("config", {})
|
|
837
|
+
if hasattr(config_val, "model_dump"):
|
|
838
|
+
config_val = config_val.model_dump()
|
|
839
|
+
|
|
840
|
+
if not isinstance(config_val, dict):
|
|
841
|
+
config_val = {}
|
|
842
|
+
|
|
843
|
+
# Use a single merge path for model configuration
|
|
844
|
+
config_val.update(model_config)
|
|
845
|
+
agent_config_kwargs["config"] = config_val
|
|
846
|
+
|
|
847
|
+
return model_string
|
|
848
|
+
|
|
754
849
|
def _apply_runtime_mcp_configs(
|
|
755
850
|
self,
|
|
756
851
|
base_configs: dict[str, Any],
|
|
@@ -779,39 +874,126 @@ class LangGraphRunner(BaseRunner):
|
|
|
779
874
|
base_config: dict[str, Any],
|
|
780
875
|
override: dict[str, Any] | None,
|
|
781
876
|
) -> dict[str, Any]:
|
|
782
|
-
"""Merge a single MCP config with runtime override.
|
|
877
|
+
"""Merge a single MCP config with a runtime override, handling normalization and parity fixes.
|
|
878
|
+
|
|
879
|
+
This method orchestrates the merging of base MCP settings (from the object definition)
|
|
880
|
+
with runtime overrides. It enforces Platform parity by prioritizing the nested 'config'
|
|
881
|
+
block while maintaining robustness for local development by auto-fixing flat transport keys.
|
|
882
|
+
|
|
883
|
+
The merge follows these priority rules (highest to lowest):
|
|
884
|
+
1. Misplaced flat keys in the override (e.g., 'url' at top level) - Auto-fixed with warning.
|
|
885
|
+
2. Nested 'config' block in the override (Matches Platform/Constructor schema).
|
|
886
|
+
3. Authentication objects in the override (Converted to HTTP headers).
|
|
887
|
+
4. Structural settings in the override (e.g., 'allowed_tools').
|
|
888
|
+
5. Base configuration from the MCP object definition.
|
|
889
|
+
|
|
890
|
+
Examples:
|
|
891
|
+
>>> # 1. Strict Nested Style (Recommended)
|
|
892
|
+
>>> override = {"config": {"url": "https://new.api"}, "allowed_tools": ["t1"]}
|
|
893
|
+
>>> self._merge_single_mcp_config("mcp", base, override)
|
|
894
|
+
>>> # Result: {"url": "https://new.api", "allowed_tools": ["t1"], ...}
|
|
895
|
+
|
|
896
|
+
>>> # 2. Flat Legacy Style (Auto-fixed with warning)
|
|
897
|
+
>>> override = {"url": "https://new.api"}
|
|
898
|
+
>>> self._merge_single_mcp_config("mcp", base, override)
|
|
899
|
+
>>> # Result: {"url": "https://new.api", ...}
|
|
900
|
+
|
|
901
|
+
>>> # 3. Header Merging (Preserves Auth)
|
|
902
|
+
>>> base = {"headers": {"Authorization": "Bearer token"}}
|
|
903
|
+
>>> override = {"headers": {"X-Custom": "val"}}
|
|
904
|
+
>>> self._merge_single_mcp_config("mcp", base, override)
|
|
905
|
+
>>> # Result: {"headers": {"Authorization": "Bearer token", "X-Custom": "val"}, ...}
|
|
783
906
|
|
|
784
907
|
Args:
|
|
785
|
-
server_name: Name of the MCP server.
|
|
786
|
-
base_config: Base
|
|
787
|
-
override: Optional runtime
|
|
908
|
+
server_name: Name of the MCP server being configured.
|
|
909
|
+
base_config: Base configuration dictionary derived from the MCP object.
|
|
910
|
+
override: Optional dictionary of runtime overrides.
|
|
788
911
|
|
|
789
912
|
Returns:
|
|
790
|
-
|
|
913
|
+
A fully merged and normalized configuration dictionary ready for the local runner.
|
|
791
914
|
"""
|
|
792
915
|
merged = base_config.copy()
|
|
793
916
|
|
|
794
917
|
if not override:
|
|
795
918
|
return merged
|
|
796
919
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
920
|
+
# 1. Check for misplaced keys and warn (DX/Parity guidance)
|
|
921
|
+
self._warn_if_mcp_override_misplaced(server_name, override)
|
|
922
|
+
|
|
923
|
+
# 2. Apply Authentication (Converted to headers)
|
|
924
|
+
self._apply_mcp_auth_override(server_name, merged, override)
|
|
800
925
|
|
|
801
|
-
#
|
|
802
|
-
if "
|
|
803
|
-
|
|
804
|
-
if headers:
|
|
805
|
-
merged["headers"] = headers
|
|
806
|
-
logger.debug("Applied runtime authentication headers for MCP '%s'", server_name)
|
|
926
|
+
# 3. Apply Transport Settings (Nested 'config')
|
|
927
|
+
if "config" in override and isinstance(override["config"], dict):
|
|
928
|
+
merged.update(override["config"])
|
|
807
929
|
|
|
808
|
-
#
|
|
930
|
+
# 4. Apply Structural Settings (e.g., allowed_tools)
|
|
931
|
+
if "allowed_tools" in override:
|
|
932
|
+
merged["allowed_tools"] = override["allowed_tools"]
|
|
933
|
+
|
|
934
|
+
# 5. Preserve unknown top-level keys (backward compatibility)
|
|
935
|
+
known_keys = _MCP_TRANSPORT_KEYS | {"config", "authentication", "allowed_tools"}
|
|
809
936
|
for key, value in override.items():
|
|
810
|
-
if key
|
|
937
|
+
if key not in known_keys:
|
|
811
938
|
merged[key] = value
|
|
812
939
|
|
|
940
|
+
# 6. Apply Auto-fix for misplaced keys (Local Success)
|
|
941
|
+
for key in [k for k in override if k in _MCP_TRANSPORT_KEYS]:
|
|
942
|
+
val = override[key]
|
|
943
|
+
# Special case: Merge headers instead of overwriting to preserve auth
|
|
944
|
+
if key == "headers" and isinstance(val, dict) and isinstance(merged.get("headers"), dict):
|
|
945
|
+
merged["headers"].update(val)
|
|
946
|
+
else:
|
|
947
|
+
merged[key] = val
|
|
948
|
+
|
|
813
949
|
return merged
|
|
814
950
|
|
|
951
|
+
def _warn_if_mcp_override_misplaced(self, server_name: str, override: dict[str, Any]) -> None:
|
|
952
|
+
"""Log a warning if transport keys are found at the top level of an override.
|
|
953
|
+
|
|
954
|
+
Args:
|
|
955
|
+
server_name: Name of the MCP server.
|
|
956
|
+
override: The raw override dictionary.
|
|
957
|
+
"""
|
|
958
|
+
misplaced = [k for k in override if k in _MCP_TRANSPORT_KEYS]
|
|
959
|
+
if misplaced:
|
|
960
|
+
logger.warning(
|
|
961
|
+
"MCP '%s' override contains transport keys at the top level: %s. "
|
|
962
|
+
"This structure is inconsistent with the Platform and MCP constructor. "
|
|
963
|
+
"Transport settings should be nested within a 'config' dictionary. "
|
|
964
|
+
"Example: mcp_configs={'%s': {'config': {'%s': '...'}}}. "
|
|
965
|
+
"Automatically merging top-level keys for local execution parity.",
|
|
966
|
+
server_name,
|
|
967
|
+
misplaced,
|
|
968
|
+
server_name,
|
|
969
|
+
misplaced[0],
|
|
970
|
+
)
|
|
971
|
+
|
|
972
|
+
def _apply_mcp_auth_override(
|
|
973
|
+
self,
|
|
974
|
+
server_name: str,
|
|
975
|
+
merged_config: dict[str, Any],
|
|
976
|
+
override: dict[str, Any],
|
|
977
|
+
) -> None:
|
|
978
|
+
"""Convert authentication override to headers and apply to config.
|
|
979
|
+
|
|
980
|
+
Args:
|
|
981
|
+
server_name: Name of the MCP server.
|
|
982
|
+
merged_config: The configuration being built (mutated in place).
|
|
983
|
+
override: The raw override dictionary.
|
|
984
|
+
"""
|
|
985
|
+
if "authentication" not in override:
|
|
986
|
+
return
|
|
987
|
+
|
|
988
|
+
from glaip_sdk.runner.mcp_adapter.mcp_config_builder import ( # noqa: PLC0415
|
|
989
|
+
MCPConfigBuilder,
|
|
990
|
+
)
|
|
991
|
+
|
|
992
|
+
headers = MCPConfigBuilder.build_headers_from_auth(override["authentication"])
|
|
993
|
+
if headers:
|
|
994
|
+
merged_config["headers"] = headers
|
|
995
|
+
logger.debug("Applied runtime authentication headers for MCP '%s'", server_name)
|
|
996
|
+
|
|
815
997
|
def _validate_sub_agent_for_local_mode(self, sub_agent: Any) -> None:
|
|
816
998
|
"""Validate that a sub-agent reference is supported for local execution.
|
|
817
999
|
|
glaip_sdk/utils/agent_config.py
CHANGED
|
@@ -83,7 +83,9 @@ def resolve_language_model_selection(merged_data: dict[str, Any], cli_model: str
|
|
|
83
83
|
"""
|
|
84
84
|
# Priority 1: CLI --model flag
|
|
85
85
|
if cli_model:
|
|
86
|
-
|
|
86
|
+
from glaip_sdk.models._validation import _validate_model # noqa: PLC0415
|
|
87
|
+
|
|
88
|
+
return {"model": _validate_model(cli_model)}, False
|
|
87
89
|
|
|
88
90
|
# Priority 2: language_model_id from import
|
|
89
91
|
if merged_data.get("language_model_id"):
|
|
@@ -92,7 +94,11 @@ def resolve_language_model_selection(merged_data: dict[str, Any], cli_model: str
|
|
|
92
94
|
# Priority 3: Legacy lm_name from agent_config
|
|
93
95
|
agent_config = merged_data.get("agent_config") or {}
|
|
94
96
|
if isinstance(agent_config, dict) and agent_config.get("lm_name"):
|
|
95
|
-
|
|
97
|
+
from glaip_sdk.models._validation import _validate_model # noqa: PLC0415
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
"model": _validate_model(agent_config["lm_name"])
|
|
101
|
+
}, True # Strip LM identity when extracting from agent_config
|
|
96
102
|
|
|
97
103
|
# No LM selection found
|
|
98
104
|
return {}, False
|
|
@@ -10,6 +10,7 @@ Authors:
|
|
|
10
10
|
from __future__ import annotations
|
|
11
11
|
|
|
12
12
|
from typing import TYPE_CHECKING
|
|
13
|
+
from collections.abc import Mapping
|
|
13
14
|
|
|
14
15
|
from glaip_sdk.utils.resource_refs import is_uuid
|
|
15
16
|
from gllm_core.utils import LoggerManager
|
|
@@ -379,14 +380,14 @@ def get_name_from_key(key: object) -> str | None:
|
|
|
379
380
|
raise ValueError(f"Unable to resolve config key: {key!r}")
|
|
380
381
|
|
|
381
382
|
|
|
382
|
-
def normalize_local_config_keys(config:
|
|
383
|
+
def normalize_local_config_keys(config: Mapping[object, object]) -> dict[str, object]:
|
|
383
384
|
"""Normalize all keys in a config dict to names for local mode.
|
|
384
385
|
|
|
385
386
|
Converts instance/class/string keys to string names without using
|
|
386
387
|
registry. UUID keys are skipped with a warning.
|
|
387
388
|
|
|
388
389
|
Args:
|
|
389
|
-
config: Dict with instance/class/string keys and any values.
|
|
390
|
+
config: Dict/Mapping with instance/class/string keys and any values.
|
|
390
391
|
|
|
391
392
|
Returns:
|
|
392
393
|
Dict with string name keys only. UUID keys are omitted.
|
|
@@ -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=OCJP2yBOo1rYqUAzpwdcEb2ZjIGHj9-ivDvldzfQX48,50813
|
|
9
9
|
glaip_sdk/cli/__init__.py,sha256=xCCfuF1Yc7mpCDcfhHZTX0vizvtrDSLeT8MJ3V7m5A0,156
|
|
10
10
|
glaip_sdk/cli/account_store.py,sha256=u_memecwEQssustZs2wYBrHbEmKUlDfmmL-zO1F3n3A,19034
|
|
11
11
|
glaip_sdk/cli/agent_config.py,sha256=YAbFKrTNTRqNA6b0i0Q3pH-01rhHDRi5v8dxSFwGSwM,2401
|
|
@@ -33,9 +33,9 @@ glaip_sdk/cli/commands/configure.py,sha256=ZToy6LSQ3ulEBrB9YpuWiIAiOQ2XQ11MxPNtN
|
|
|
33
33
|
glaip_sdk/cli/commands/models.py,sha256=kZKqwv2uzfyz8n_7b0hYTT8waaVZMDzVoSXtRvWa9jk,2042
|
|
34
34
|
glaip_sdk/cli/commands/transcripts_original.py,sha256=6KEAP_mMdoNgydpunxLjYl6QJIY-CJorwLTBSF3Cfuo,26416
|
|
35
35
|
glaip_sdk/cli/commands/update.py,sha256=QYz51JdYSbzbLVIH3-Q-qh5MIY4o-LtpbbfMwHYuExA,6658
|
|
36
|
-
glaip_sdk/cli/commands/agents/__init__.py,sha256=
|
|
37
|
-
glaip_sdk/cli/commands/agents/_common.py,sha256=
|
|
38
|
-
glaip_sdk/cli/commands/agents/create.py,sha256=
|
|
36
|
+
glaip_sdk/cli/commands/agents/__init__.py,sha256=W_fOLZMuTod4atEn4Pryl6Kjp19-qcbnJzFnwfgv-dQ,3361
|
|
37
|
+
glaip_sdk/cli/commands/agents/_common.py,sha256=HztukkGoeS_jZ8fHkrijLofdgSe3ic6uYlUaVoPeAvs,17850
|
|
38
|
+
glaip_sdk/cli/commands/agents/create.py,sha256=uCbDfLtCHZwZl1Z-aiMEXoJAWZaKJybZQU1rKReGkzM,5002
|
|
39
39
|
glaip_sdk/cli/commands/agents/delete.py,sha256=WgNOr_JHqD8EF4jBU0vmUphIyAlbLHWbx68KuINxnz0,1684
|
|
40
40
|
glaip_sdk/cli/commands/agents/get.py,sha256=vwYa2GIFgxGPTmNiIPv3EceJ2NI3S92e6qaAVrgJm48,2682
|
|
41
41
|
glaip_sdk/cli/commands/agents/list.py,sha256=u4gGYYMLJZatKVtpIovcxqzU8caIyvZCuou1GzePcAo,4696
|
|
@@ -106,10 +106,10 @@ glaip_sdk/cli/transcript/viewer.py,sha256=Y4G40WR6v1g4TfxRbGSZqdrqhLcqBxoWkQgToQ
|
|
|
106
106
|
glaip_sdk/client/__init__.py,sha256=s2REOumgE8Z8lA9dWJpwXqpgMdzSELSuCQkZ7sYngX0,381
|
|
107
107
|
glaip_sdk/client/_schedule_payloads.py,sha256=9BXa75CCx3clsKgwmG9AWyvhPY6kVwzQtoLvTTw40CQ,2759
|
|
108
108
|
glaip_sdk/client/agent_runs.py,sha256=tZSFEZZ3Yx0uYRgnwkLe-X0TlmgKJQ-ivzb6SrVnxY8,4862
|
|
109
|
-
glaip_sdk/client/agents.py,sha256=
|
|
110
|
-
glaip_sdk/client/base.py,sha256=
|
|
109
|
+
glaip_sdk/client/agents.py,sha256=nnR9gSWBTLNxnifednnSIrJy734EdziAArZH7E7HNGg,58497
|
|
110
|
+
glaip_sdk/client/base.py,sha256=_LAAaCLLPGi2tpsGIpAJqcbEIUShnGLoB2hyWwcRMa8,19133
|
|
111
111
|
glaip_sdk/client/hitl.py,sha256=dO_q-43miI0oGrJDyUrZ9MbettQp0hai4kjvPaYm010,3545
|
|
112
|
-
glaip_sdk/client/main.py,sha256=
|
|
112
|
+
glaip_sdk/client/main.py,sha256=QbFBA7tlX4znMCp860-gw23Fhv9GAabSeMRoxX2tavc,9184
|
|
113
113
|
glaip_sdk/client/mcps.py,sha256=-JdaIkg0QE3egJ8p93eoOPULup8KbM2WRCcwlvqlqrA,14492
|
|
114
114
|
glaip_sdk/client/run_rendering.py,sha256=BKe9a_KnL58XNcGlLvbhJAZBh57e8-ykYiqp0bbS4ZE,28860
|
|
115
115
|
glaip_sdk/client/schedules.py,sha256=ZfPzCYzk4YRuPkjkTTgLe5Rqa07mi-h2WmP4H91mMZ0,14113
|
|
@@ -117,9 +117,9 @@ glaip_sdk/client/shared.py,sha256=esHlsR0LEfL-pFDaWebQjKKOLl09jsRY-2pllBUn4nU,52
|
|
|
117
117
|
glaip_sdk/client/tools.py,sha256=NzQTIsn-bjYN9EfGWCBqqawCIVs7auaccFv7BM_3oCc,23871
|
|
118
118
|
glaip_sdk/client/validators.py,sha256=ioF9VCs-LG2yLkaRDd7Hff74lojDZZ0_Q3CiLbdm1RY,8381
|
|
119
119
|
glaip_sdk/client/payloads/agent/__init__.py,sha256=gItEH2zt2secVq6n60oGA-ztdE5mc0GLECn-QMX47ew,558
|
|
120
|
-
glaip_sdk/client/payloads/agent/requests.py,sha256=
|
|
120
|
+
glaip_sdk/client/payloads/agent/requests.py,sha256=zmyKtR9UuUNwGHzInBHqeurrfrUsshchFafe_5tiEX8,17375
|
|
121
121
|
glaip_sdk/client/payloads/agent/responses.py,sha256=1eRMI4JAIGqTB5zY_7D9ILQDRHPXR06U7JqHSmRp3Qs,1243
|
|
122
|
-
glaip_sdk/config/constants.py,sha256=
|
|
122
|
+
glaip_sdk/config/constants.py,sha256=AWxzOwy8QLv6wYSaOvv5xqAOb7ksgfMB2lkj0f0F1FM,1801
|
|
123
123
|
glaip_sdk/guardrails/__init__.py,sha256=C1gpL2himmv0FfAsR1ywuvBkwXP54-ziPeqqdAo207k,2677
|
|
124
124
|
glaip_sdk/guardrails/serializer.py,sha256=x4WDaGH-kmaPHnIJNi3aJjToYf4Ru_3mIh3yxSWO25U,2832
|
|
125
125
|
glaip_sdk/hitl/__init__.py,sha256=hi_SwW1oBimNnSFPo9Yc-mZWVPzpytlnDWNq2h1_fPo,1572
|
|
@@ -129,11 +129,15 @@ glaip_sdk/hitl/local.py,sha256=7Qf-O62YcVXpOHdckm1-g4wwvHQCvwg4D1ikK-xwgqA,4642
|
|
|
129
129
|
glaip_sdk/hitl/remote.py,sha256=cdO-wWwRGdyb0HYNMwIvHfvKwOqhqp-l7efnaC9b85M,18914
|
|
130
130
|
glaip_sdk/mcps/__init__.py,sha256=4jYrt8K__oxrxexHRcmnRBXt-W_tbJN61H9Kf2lVh4Q,551
|
|
131
131
|
glaip_sdk/mcps/base.py,sha256=jWwHjDF67_mtDGRp9p5SolANjVeB8jt1PSwPBtX876M,11654
|
|
132
|
-
glaip_sdk/models/__init__.py,sha256=
|
|
133
|
-
glaip_sdk/models/
|
|
132
|
+
glaip_sdk/models/__init__.py,sha256=UUMCfUE17l8XEGak2zMm0GIMIyJd2tXb_KdHL4wSFpo,3646
|
|
133
|
+
glaip_sdk/models/_provider_mappings.py,sha256=aHpFHzT4estAv4x_cjTibinHifM-btOg44jZjRBG97I,3045
|
|
134
|
+
glaip_sdk/models/_validation.py,sha256=URPDiDLmgKKW4AXQO4QjZlw7Bq27dVeRJkup0TB48qE,2882
|
|
135
|
+
glaip_sdk/models/agent.py,sha256=rZarI1268hh_XuM1AKjuX3YN9_b1z--8e9cFKx0KRlg,1524
|
|
134
136
|
glaip_sdk/models/agent_runs.py,sha256=rK0fTpivukyiqIxrS86evgNtfEwV8Xecq_NeUakFUFw,3829
|
|
135
137
|
glaip_sdk/models/common.py,sha256=O30MEGO2nKcGhKbnPNkoGzwNvDVUBjM-uU-Tpigaz5Y,1180
|
|
138
|
+
glaip_sdk/models/constants.py,sha256=dRO1IWgdhaDYwoKu5jGZmcEovPKvFeCjWHCE_VWg2Xk,4429
|
|
136
139
|
glaip_sdk/models/mcp.py,sha256=ti_8MUf4k7qbR1gPs9JhqhybMcLUhZxEELtHQrTv2-U,944
|
|
140
|
+
glaip_sdk/models/model.py,sha256=l8VFKwOH-sjWh6looiDKGpAkIL535pK5rt9LC-TvqMY,5616
|
|
137
141
|
glaip_sdk/models/schedule.py,sha256=gfL_b9abaWToMtnCD_iXOsmonQ1sq2dZoLcInvCzZ2o,7248
|
|
138
142
|
glaip_sdk/models/tool.py,sha256=w3nL2DqyCtGgDPCd40Asi9obRGghQjLlC9Vt_p32Mpc,951
|
|
139
143
|
glaip_sdk/payload_schemas/__init__.py,sha256=nTJmzwn2BbEpzZdq-8U24eVHQHxqYO3_-SABMV9lS_Q,142
|
|
@@ -147,7 +151,7 @@ glaip_sdk/registry/tool.py,sha256=c0Ja4rFYMOKs_1yjDLDZxCId4IjQzprwXzX0iIL8Fio,14
|
|
|
147
151
|
glaip_sdk/runner/__init__.py,sha256=orJ3nLR9P-n1qMaAMWZ_xRS4368YnDpdltg-bX5BlUk,2210
|
|
148
152
|
glaip_sdk/runner/base.py,sha256=KIjcSAyDCP9_mn2H4rXR5gu1FZlwD9pe0gkTBmr6Yi4,2663
|
|
149
153
|
glaip_sdk/runner/deps.py,sha256=Du3hr2R5RHOYCRAv7RVmx661x-ayVXIeZ8JD7ODirTA,3884
|
|
150
|
-
glaip_sdk/runner/langgraph.py,sha256=
|
|
154
|
+
glaip_sdk/runner/langgraph.py,sha256=HB1n6w44LdyE7OSB2iSEtwhm_IeD7fGi_20erCZurX4,40869
|
|
151
155
|
glaip_sdk/runner/logging_config.py,sha256=OrQgW23t42qQRqEXKH8U4bFg4JG5EEkUJTlbvtU65iE,2528
|
|
152
156
|
glaip_sdk/runner/mcp_adapter/__init__.py,sha256=Rdttfg3N6kg3-DaTCKqaGXKByZyBt0Mwf6FV8s_5kI8,462
|
|
153
157
|
glaip_sdk/runner/mcp_adapter/base_mcp_adapter.py,sha256=ic56fKgb3zgVZZQm3ClWUZi7pE1t4EVq8mOg6AM6hdA,1374
|
|
@@ -161,7 +165,7 @@ glaip_sdk/schedules/base.py,sha256=ZRKWknoxQOYMhX8mjQ7S7oqpy6Wr0xdbzcgIrycsEQ8,9
|
|
|
161
165
|
glaip_sdk/tools/__init__.py,sha256=rhGzEqQFCzeMrxmikBuNrMz4PyYczwic28boDKVmoHs,585
|
|
162
166
|
glaip_sdk/tools/base.py,sha256=KRaWWX5cKAvEKtBr4iSOaKQlQ973A4pNOW2KVvA1aYs,17353
|
|
163
167
|
glaip_sdk/utils/__init__.py,sha256=5a1kNLtUriwd1qAT6RU083GOyABS7LMZQacDP4yS9S4,2830
|
|
164
|
-
glaip_sdk/utils/agent_config.py,sha256=
|
|
168
|
+
glaip_sdk/utils/agent_config.py,sha256=T4YbLaNYq2HzlkXCmwEmErKoDtxu-2KKcmFvnhqAMhw,7484
|
|
165
169
|
glaip_sdk/utils/bundler.py,sha256=fLumFj1MqqqGA1Mwn05v_cEKPALv3rIPEMvaURpxZ80,15171
|
|
166
170
|
glaip_sdk/utils/client.py,sha256=otPUOIDvLCCsvFBNR8YMZFtRrORggmvvlFjl3YeeTqQ,3121
|
|
167
171
|
glaip_sdk/utils/client_utils.py,sha256=hzHxxNuM37mK4HhgIdS0qg4AqjAA5ai2irPO6Nr1Uzo,15350
|
|
@@ -175,7 +179,7 @@ glaip_sdk/utils/import_resolver.py,sha256=X2qUV4_XmwStccGjnQ0YcxXAFyxZzwaKpfxjAW
|
|
|
175
179
|
glaip_sdk/utils/instructions.py,sha256=MTk93lsq3I8aRnvnRMSXXNMzcpnaIM_Pm3Aiiiq3GBc,2997
|
|
176
180
|
glaip_sdk/utils/resource_refs.py,sha256=vF34kyAtFBLnaKnQVrsr2st1JiSxVbIZ4yq0DelJvCI,5966
|
|
177
181
|
glaip_sdk/utils/run_renderer.py,sha256=d_VMI6LbvHPUUeRmGqh5wK_lHqDEIAcym2iqpbtDad0,1365
|
|
178
|
-
glaip_sdk/utils/runtime_config.py,sha256=
|
|
182
|
+
glaip_sdk/utils/runtime_config.py,sha256=frbnCVCRVMNXiQODOBZtDSkbys18xayZzpkhJjlpJEs,14117
|
|
179
183
|
glaip_sdk/utils/serialization.py,sha256=z-qpvWLSBrGK3wbUclcA1UIKLXJedTnMSwPdq-FF4lo,13308
|
|
180
184
|
glaip_sdk/utils/sync.py,sha256=71egWp5qm_8tYpWZyGazvnP4NnyW16rcmzjGVicmQEE,6043
|
|
181
185
|
glaip_sdk/utils/tool_detection.py,sha256=B7xze014TZyqWI4JqLhkZrbtT5h32CjQEXRswtdcljI,9808
|
|
@@ -212,8 +216,8 @@ glaip_sdk/utils/rendering/steps/format.py,sha256=Chnq7OBaj8XMeBntSBxrX5zSmrYeGcO
|
|
|
212
216
|
glaip_sdk/utils/rendering/steps/manager.py,sha256=BiBmTeQMQhjRMykgICXsXNYh1hGsss-fH9BIGVMWFi0,13194
|
|
213
217
|
glaip_sdk/utils/rendering/viewer/__init__.py,sha256=XrxmE2cMAozqrzo1jtDFm8HqNtvDcYi2mAhXLXn5CjI,457
|
|
214
218
|
glaip_sdk/utils/rendering/viewer/presenter.py,sha256=mlLMTjnyeyPVtsyrAbz1BJu9lFGQSlS-voZ-_Cuugv0,5725
|
|
215
|
-
glaip_sdk-0.7.
|
|
216
|
-
glaip_sdk-0.7.
|
|
217
|
-
glaip_sdk-0.7.
|
|
218
|
-
glaip_sdk-0.7.
|
|
219
|
-
glaip_sdk-0.7.
|
|
219
|
+
glaip_sdk-0.7.15.dist-info/METADATA,sha256=L7wF6kfY6yiNHvUsl6gGSVhFjMGllD9K3ZHA3UmIbkA,8528
|
|
220
|
+
glaip_sdk-0.7.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
221
|
+
glaip_sdk-0.7.15.dist-info/entry_points.txt,sha256=NkhO6FfgX9Zrjn63GuKphf-dLw7KNJvucAcXc7P3aMk,54
|
|
222
|
+
glaip_sdk-0.7.15.dist-info/top_level.txt,sha256=td7yXttiYX2s94-4wFhv-5KdT0rSZ-pnJRSire341hw,10
|
|
223
|
+
glaip_sdk-0.7.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|