agentex-sdk 0.4.18__py3-none-any.whl → 0.4.20__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.
Files changed (130) hide show
  1. agentex/__init__.py +0 -1
  2. agentex/_utils/_typing.py +3 -1
  3. agentex/_version.py +1 -1
  4. agentex/lib/adk/__init__.py +3 -0
  5. agentex/lib/adk/_modules/acp.py +3 -1
  6. agentex/lib/adk/_modules/agent_task_tracker.py +3 -1
  7. agentex/lib/adk/_modules/agents.py +3 -1
  8. agentex/lib/adk/_modules/events.py +3 -1
  9. agentex/lib/adk/_modules/messages.py +3 -1
  10. agentex/lib/adk/_modules/state.py +3 -1
  11. agentex/lib/adk/_modules/streaming.py +3 -1
  12. agentex/lib/adk/_modules/tasks.py +4 -2
  13. agentex/lib/adk/_modules/tracing.py +3 -1
  14. agentex/lib/adk/providers/__init__.py +2 -2
  15. agentex/lib/adk/providers/_modules/litellm.py +10 -11
  16. agentex/lib/adk/providers/_modules/openai.py +27 -28
  17. agentex/lib/adk/providers/_modules/sgp.py +5 -6
  18. agentex/lib/adk/utils/_modules/client.py +4 -1
  19. agentex/lib/adk/utils/_modules/templating.py +5 -6
  20. agentex/lib/cli/commands/agents.py +21 -21
  21. agentex/lib/cli/commands/init.py +3 -3
  22. agentex/lib/cli/commands/main.py +3 -3
  23. agentex/lib/cli/commands/secrets.py +10 -10
  24. agentex/lib/cli/commands/tasks.py +26 -28
  25. agentex/lib/cli/commands/uv.py +1 -1
  26. agentex/lib/cli/debug/__init__.py +1 -1
  27. agentex/lib/cli/debug/debug_config.py +1 -2
  28. agentex/lib/cli/debug/debug_handlers.py +6 -4
  29. agentex/lib/cli/handlers/agent_handlers.py +15 -16
  30. agentex/lib/cli/handlers/cleanup_handlers.py +1 -1
  31. agentex/lib/cli/handlers/deploy_handlers.py +41 -55
  32. agentex/lib/cli/handlers/run_handlers.py +13 -16
  33. agentex/lib/cli/handlers/secret_handlers.py +25 -25
  34. agentex/lib/cli/templates/temporal/project/acp.py.j2 +11 -8
  35. agentex/lib/cli/utils/auth_utils.py +3 -2
  36. agentex/lib/cli/utils/credential_utils.py +1 -1
  37. agentex/lib/cli/utils/kubectl_utils.py +3 -3
  38. agentex/lib/cli/utils/kubernetes_secrets_utils.py +4 -4
  39. agentex/lib/cli/utils/path_utils.py +2 -2
  40. agentex/lib/core/adapters/llm/adapter_litellm.py +9 -4
  41. agentex/lib/core/adapters/llm/adapter_sgp.py +10 -7
  42. agentex/lib/core/adapters/llm/port.py +1 -1
  43. agentex/lib/core/adapters/streams/adapter_redis.py +7 -4
  44. agentex/lib/core/adapters/streams/port.py +1 -1
  45. agentex/lib/core/clients/temporal/temporal_client.py +34 -34
  46. agentex/lib/core/clients/temporal/types.py +1 -1
  47. agentex/lib/core/clients/temporal/utils.py +9 -12
  48. agentex/lib/core/services/adk/acp/acp.py +6 -6
  49. agentex/lib/core/services/adk/agent_task_tracker.py +1 -1
  50. agentex/lib/core/services/adk/agents.py +1 -1
  51. agentex/lib/core/services/adk/events.py +1 -1
  52. agentex/lib/core/services/adk/messages.py +5 -6
  53. agentex/lib/core/services/adk/providers/litellm.py +10 -10
  54. agentex/lib/core/services/adk/providers/openai.py +75 -43
  55. agentex/lib/core/services/adk/providers/sgp.py +3 -3
  56. agentex/lib/core/services/adk/state.py +5 -1
  57. agentex/lib/core/services/adk/streaming.py +19 -19
  58. agentex/lib/core/services/adk/tasks.py +8 -2
  59. agentex/lib/core/services/adk/tracing.py +3 -2
  60. agentex/lib/core/services/adk/utils/templating.py +4 -2
  61. agentex/lib/core/temporal/activities/__init__.py +27 -27
  62. agentex/lib/core/temporal/activities/activity_helpers.py +1 -1
  63. agentex/lib/core/temporal/activities/adk/acp/acp_activities.py +4 -4
  64. agentex/lib/core/temporal/activities/adk/agent_task_tracker_activities.py +1 -1
  65. agentex/lib/core/temporal/activities/adk/agents_activities.py +2 -2
  66. agentex/lib/core/temporal/activities/adk/events_activities.py +1 -1
  67. agentex/lib/core/temporal/activities/adk/messages_activities.py +3 -3
  68. agentex/lib/core/temporal/activities/adk/providers/litellm_activities.py +4 -4
  69. agentex/lib/core/temporal/activities/adk/providers/sgp_activities.py +1 -1
  70. agentex/lib/core/temporal/activities/adk/state_activities.py +1 -1
  71. agentex/lib/core/temporal/activities/adk/streaming_activities.py +3 -3
  72. agentex/lib/core/temporal/activities/adk/tasks_activities.py +2 -2
  73. agentex/lib/core/temporal/activities/adk/tracing_activities.py +1 -1
  74. agentex/lib/core/temporal/activities/adk/utils/templating_activities.py +1 -1
  75. agentex/lib/core/temporal/services/temporal_task_service.py +7 -7
  76. agentex/lib/core/temporal/workers/worker.py +31 -40
  77. agentex/lib/core/temporal/workflows/workflow.py +2 -2
  78. agentex/lib/core/tracing/__init__.py +2 -2
  79. agentex/lib/core/tracing/processors/agentex_tracing_processor.py +6 -6
  80. agentex/lib/core/tracing/processors/sgp_tracing_processor.py +16 -16
  81. agentex/lib/core/tracing/processors/tracing_processor_interface.py +1 -1
  82. agentex/lib/core/tracing/trace.py +7 -7
  83. agentex/lib/core/tracing/tracer.py +2 -2
  84. agentex/lib/core/tracing/tracing_processor_manager.py +43 -13
  85. agentex/lib/environment_variables.py +5 -4
  86. agentex/lib/sdk/config/agent_config.py +2 -2
  87. agentex/lib/sdk/config/agent_manifest.py +8 -8
  88. agentex/lib/sdk/config/environment_config.py +10 -2
  89. agentex/lib/sdk/config/project_config.py +6 -6
  90. agentex/lib/sdk/config/validation.py +2 -2
  91. agentex/lib/sdk/fastacp/base/base_acp_server.py +31 -13
  92. agentex/lib/sdk/fastacp/fastacp.py +14 -15
  93. agentex/lib/sdk/fastacp/impl/agentic_base_acp.py +4 -5
  94. agentex/lib/sdk/fastacp/impl/sync_acp.py +7 -7
  95. agentex/lib/sdk/fastacp/impl/temporal_acp.py +28 -19
  96. agentex/lib/sdk/fastacp/tests/conftest.py +18 -16
  97. agentex/lib/sdk/fastacp/tests/run_tests.py +1 -1
  98. agentex/lib/sdk/fastacp/tests/test_base_acp_server.py +4 -4
  99. agentex/lib/sdk/fastacp/tests/test_fastacp_factory.py +8 -8
  100. agentex/lib/sdk/fastacp/tests/test_integration.py +15 -14
  101. agentex/lib/sdk/state_machine/__init__.py +1 -1
  102. agentex/lib/sdk/state_machine/noop_workflow.py +5 -3
  103. agentex/lib/sdk/state_machine/state_machine.py +18 -12
  104. agentex/lib/sdk/utils/messages.py +5 -5
  105. agentex/lib/types/acp.py +2 -2
  106. agentex/lib/types/agent_configs.py +1 -1
  107. agentex/lib/types/converters.py +4 -2
  108. agentex/lib/types/credentials.py +1 -1
  109. agentex/lib/types/fastacp.py +4 -5
  110. agentex/lib/types/tracing.py +1 -1
  111. agentex/lib/utils/completions.py +5 -5
  112. agentex/lib/utils/console.py +1 -1
  113. agentex/lib/utils/debug.py +10 -5
  114. agentex/lib/utils/dev_tools/async_messages.py +11 -12
  115. agentex/lib/utils/iterables.py +1 -1
  116. agentex/lib/utils/json_schema.py +4 -4
  117. agentex/lib/utils/logging.py +62 -14
  118. agentex/lib/utils/mcp.py +1 -0
  119. agentex/lib/utils/model_utils.py +4 -5
  120. agentex/lib/utils/registration.py +5 -4
  121. agentex/resources/agents.py +11 -4
  122. agentex/types/agent_rpc_response.py +3 -3
  123. agentex/types/data_content.py +1 -1
  124. agentex/types/tool_request_content.py +1 -1
  125. agentex/types/tool_response_content.py +0 -1
  126. {agentex_sdk-0.4.18.dist-info → agentex_sdk-0.4.20.dist-info}/METADATA +4 -1
  127. {agentex_sdk-0.4.18.dist-info → agentex_sdk-0.4.20.dist-info}/RECORD +130 -130
  128. {agentex_sdk-0.4.18.dist-info → agentex_sdk-0.4.20.dist-info}/WHEEL +0 -0
  129. {agentex_sdk-0.4.18.dist-info → agentex_sdk-0.4.20.dist-info}/entry_points.txt +0 -0
  130. {agentex_sdk-0.4.18.dist-info → agentex_sdk-0.4.20.dist-info}/licenses/LICENSE +0 -0
@@ -4,7 +4,6 @@ Debug configuration models for AgentEx CLI debugging.
4
4
 
5
5
  import socket
6
6
  from enum import Enum
7
- from typing import Optional
8
7
 
9
8
  from agentex.lib.utils.model_utils import BaseModel
10
9
 
@@ -62,7 +61,7 @@ class DebugConfig(BaseModel):
62
61
  def create_both_debug(
63
62
  cls,
64
63
  worker_port: int = 5678,
65
- acp_port: int = 5679,
64
+ _acp_port: int = 5679,
66
65
  wait_for_attach: bool = False,
67
66
  auto_port: bool = True
68
67
  ) -> "DebugConfig":
@@ -4,19 +4,21 @@ Debug process handlers for AgentEx CLI.
4
4
  Provides debug-enabled versions of ACP server and temporal worker startup.
5
5
  """
6
6
 
7
- import asyncio
8
7
  import sys
8
+ import asyncio
9
+ import asyncio.subprocess
10
+ from typing import TYPE_CHECKING, Dict
9
11
  from pathlib import Path
10
- from typing import Dict, TYPE_CHECKING
11
12
 
12
13
  from rich.console import Console
13
14
 
14
15
  if TYPE_CHECKING:
15
- import asyncio.subprocess
16
+ pass
16
17
 
17
- from .debug_config import DebugConfig, resolve_debug_port
18
18
  from agentex.lib.utils.logging import make_logger
19
19
 
20
+ from .debug_config import DebugConfig, resolve_debug_port
21
+
20
22
  logger = make_logger(__name__)
21
23
  console = Console()
22
24
 
@@ -2,14 +2,13 @@ from __future__ import annotations
2
2
 
3
3
  from pathlib import Path
4
4
 
5
- from python_on_whales import DockerException, docker
6
5
  from rich.console import Console
6
+ from python_on_whales import DockerException, docker
7
7
 
8
- from agentex.lib.cli.handlers.run_handlers import RunError
9
- from agentex.lib.cli.handlers.run_handlers import run_agent as _run_agent
10
8
  from agentex.lib.cli.debug import DebugConfig
11
- from agentex.lib.sdk.config.agent_manifest import AgentManifest
12
9
  from agentex.lib.utils.logging import make_logger
10
+ from agentex.lib.cli.handlers.run_handlers import RunError, run_agent as _run_agent
11
+ from agentex.lib.sdk.config.agent_manifest import AgentManifest
13
12
 
14
13
  logger = make_logger(__name__)
15
14
  console = Console()
@@ -25,9 +24,9 @@ def build_agent(
25
24
  repository_name: str | None,
26
25
  platforms: list[str],
27
26
  push: bool = False,
28
- secret: str = None,
29
- tag: str = None,
30
- build_args: list[str] = None,
27
+ secret: str | None = None,
28
+ tag: str | None = None,
29
+ build_args: list[str] | None = None,
31
30
  ) -> str:
32
31
  """Build the agent locally and optionally push to registry
33
32
 
@@ -66,14 +65,14 @@ def build_agent(
66
65
  # Log build context information for debugging
67
66
  logger.info(f"Build context path: {build_context.path}")
68
67
  logger.info(
69
- f"Dockerfile path: {build_context.path / build_context.dockerfile_path}"
68
+ f"Dockerfile path: {build_context.path / build_context.dockerfile_path}" # type: ignore[operator]
70
69
  )
71
70
 
72
71
  try:
73
72
  # Prepare build arguments
74
73
  docker_build_kwargs = {
75
74
  "context_path": str(build_context.path),
76
- "file": str(build_context.path / build_context.dockerfile_path),
75
+ "file": str(build_context.path / build_context.dockerfile_path), # type: ignore[operator]
77
76
  "tags": [image_name],
78
77
  "platforms": platforms,
79
78
  }
@@ -129,23 +128,23 @@ def build_agent(
129
128
 
130
129
  def run_agent(manifest_path: str, debug_config: "DebugConfig | None" = None):
131
130
  """Run an agent locally from the given manifest"""
132
- import asyncio
133
- import signal
134
131
  import sys
132
+ import signal
133
+ import asyncio
135
134
 
136
135
  # Flag to track if we're shutting down
137
136
  shutting_down = False
138
137
 
139
- def signal_handler(signum, frame):
138
+ def signal_handler(signum, _frame):
140
139
  """Handle signals by raising KeyboardInterrupt"""
141
140
  nonlocal shutting_down
142
141
  if shutting_down:
143
142
  # If we're already shutting down and get another signal, force exit
144
- print(f"\nForce exit on signal {signum}")
143
+ logger.info(f"Force exit on signal {signum}")
145
144
  sys.exit(1)
146
-
145
+
147
146
  shutting_down = True
148
- print(f"\nReceived signal {signum}, shutting down...")
147
+ logger.info(f"Received signal {signum}, shutting down...")
149
148
  raise KeyboardInterrupt()
150
149
 
151
150
  # Set up signal handling for the main thread
@@ -155,7 +154,7 @@ def run_agent(manifest_path: str, debug_config: "DebugConfig | None" = None):
155
154
  try:
156
155
  asyncio.run(_run_agent(manifest_path, debug_config))
157
156
  except KeyboardInterrupt:
158
- print("Shutdown completed.")
157
+ logger.info("Shutdown completed.")
159
158
  sys.exit(0)
160
159
  except RunError as e:
161
160
  raise RuntimeError(str(e)) from e
@@ -1,5 +1,5 @@
1
- import asyncio
2
1
  import os
2
+ import asyncio
3
3
 
4
4
  from rich.console import Console
5
5
 
@@ -1,22 +1,21 @@
1
1
  import os
2
- import subprocess
3
2
  import tempfile
4
- from pathlib import Path
3
+ import subprocess
5
4
  from typing import Any
5
+ from pathlib import Path
6
6
 
7
7
  import yaml
8
- from pydantic import BaseModel, Field
8
+ from pydantic import Field, BaseModel
9
9
  from rich.console import Console
10
10
 
11
- from agentex.lib.cli.utils.exceptions import DeploymentError, HelmError
12
- from agentex.lib.sdk.config.environment_config import AgentEnvironmentConfig
13
- from agentex.lib.cli.utils.kubectl_utils import check_and_switch_cluster_context
14
- from agentex.lib.cli.utils.path_utils import calculate_docker_acp_module, PathResolutionError
11
+ from agentex.lib.utils.logging import make_logger
12
+ from agentex.lib.cli.utils.exceptions import HelmError, DeploymentError
13
+ from agentex.lib.cli.utils.path_utils import PathResolutionError, calculate_docker_acp_module
15
14
  from agentex.lib.environment_variables import EnvVarKeys
15
+ from agentex.lib.cli.utils.kubectl_utils import check_and_switch_cluster_context
16
16
  from agentex.lib.sdk.config.agent_config import AgentConfig
17
17
  from agentex.lib.sdk.config.agent_manifest import AgentManifest
18
-
19
- from agentex.lib.utils.logging import make_logger
18
+ from agentex.lib.sdk.config.environment_config import AgentEnvironmentConfig
20
19
 
21
20
  logger = make_logger(__name__)
22
21
  console = Console()
@@ -26,43 +25,35 @@ AGENTEX_AGENTS_HELM_CHART_VERSION = "0.1.7-v4-beta"
26
25
 
27
26
 
28
27
  class InputDeployOverrides(BaseModel):
29
- repository: str | None = Field(
30
- default=None, description="Override the repository for deployment"
31
- )
32
- image_tag: str | None = Field(
33
- default=None, description="Override the image tag for deployment"
34
- )
28
+ repository: str | None = Field(default=None, description="Override the repository for deployment")
29
+ image_tag: str | None = Field(default=None, description="Override the image tag for deployment")
35
30
 
36
31
 
37
32
  def check_helm_installed() -> bool:
38
33
  """Check if helm is installed and available"""
39
34
  try:
40
- result = subprocess.run(
41
- ["helm", "version", "--short"], capture_output=True, text=True, check=True
42
- )
35
+ result = subprocess.run(["helm", "version", "--short"], capture_output=True, text=True, check=True)
43
36
  logger.info(f"Helm version: {result.stdout.strip()}")
44
37
  return True
45
38
  except (subprocess.CalledProcessError, FileNotFoundError):
46
39
  return False
47
40
 
48
41
 
49
- def add_helm_repo() -> None:
42
+ def add_helm_repo(helm_repository_name: str, helm_repository_url: str) -> None:
50
43
  """Add the agentex helm repository if not already added"""
51
44
  try:
52
45
  # Check if repo already exists
53
- result = subprocess.run(
54
- ["helm", "repo", "list"], capture_output=True, text=True, check=True
55
- )
46
+ result = subprocess.run(["helm", "repo", "list"], capture_output=True, text=True, check=True)
56
47
 
57
- if "scale-egp" not in result.stdout:
48
+ if helm_repository_name not in result.stdout:
58
49
  console.print("Adding agentex helm repository...")
59
50
  subprocess.run(
60
51
  [
61
52
  "helm",
62
53
  "repo",
63
54
  "add",
64
- "scale-egp",
65
- "https://scale-egp-helm-charts-us-west-2.s3.amazonaws.com/charts",
55
+ helm_repository_name,
56
+ helm_repository_url,
66
57
  ],
67
58
  check=True,
68
59
  )
@@ -76,7 +67,6 @@ def add_helm_repo() -> None:
76
67
  raise HelmError(f"Failed to add helm repository: {e}") from e
77
68
 
78
69
 
79
-
80
70
  def convert_env_vars_dict_to_list(env_vars: dict[str, str]) -> list[dict[str, str]]:
81
71
  """Convert a dictionary of environment variables to a list of dictionaries"""
82
72
  return [{"name": key, "value": value} for key, value in env_vars.items()]
@@ -170,11 +160,11 @@ def merge_deployment_configs(
170
160
  # Priority: manifest -> environments.yaml -> secrets (highest)
171
161
  all_env_vars: dict[str, str] = {}
172
162
  secret_env_vars: list[dict[str, str]] = []
173
-
163
+
174
164
  # Start with agent_config env vars from manifest
175
165
  if agent_config.env:
176
166
  all_env_vars.update(agent_config.env)
177
-
167
+
178
168
  # Override with environment config env vars if they exist
179
169
  if agent_env_config and agent_env_config.helm_overrides and "env" in agent_env_config.helm_overrides:
180
170
  env_overrides = agent_env_config.helm_overrides["env"]
@@ -186,8 +176,6 @@ def merge_deployment_configs(
186
176
  env_override_dict[str(env_var["name"])] = str(env_var["value"])
187
177
  all_env_vars.update(env_override_dict)
188
178
 
189
-
190
-
191
179
  # Handle credentials and check for conflicts
192
180
  if agent_config.credentials:
193
181
  for credential in agent_config.credentials:
@@ -200,7 +188,7 @@ def merge_deployment_configs(
200
188
  env_var_name = credential.env_var_name
201
189
  secret_name = credential.secret_name
202
190
  secret_key = credential.secret_key
203
-
191
+
204
192
  # Check if the environment variable name conflicts with existing env vars
205
193
  if env_var_name in all_env_vars:
206
194
  logger.warning(
@@ -209,7 +197,7 @@ def merge_deployment_configs(
209
197
  )
210
198
  # Remove from regular env vars since secret takes precedence
211
199
  del all_env_vars[env_var_name]
212
-
200
+
213
201
  secret_env_vars.append(
214
202
  {
215
203
  "name": env_var_name,
@@ -223,13 +211,14 @@ def merge_deployment_configs(
223
211
  # Add auth principal env var if environment config is set
224
212
  if agent_env_config.auth:
225
213
  from agentex.lib.cli.utils.auth_utils import _encode_principal_context_from_env_config
214
+
226
215
  encoded_principal = _encode_principal_context_from_env_config(agent_env_config.auth)
227
216
  logger.info(f"Encoding auth principal from {agent_env_config.auth}")
228
217
  if encoded_principal:
229
218
  all_env_vars[EnvVarKeys.AUTH_PRINCIPAL_B64.value] = encoded_principal
230
219
  else:
231
220
  raise DeploymentError(f"Auth principal unable to be encoded for agent_env_config: {agent_env_config}")
232
-
221
+
233
222
  logger.info(f"Defined agent helm overrides: {agent_env_config.helm_overrides}")
234
223
  logger.info(f"Before-merge helm values: {helm_values}")
235
224
  if agent_env_config.helm_overrides:
@@ -240,7 +229,7 @@ def merge_deployment_configs(
240
229
  # Environment variable precedence: manifest -> environments.yaml -> secrets (highest)
241
230
  if all_env_vars:
242
231
  helm_values["env"] = convert_env_vars_dict_to_list(all_env_vars)
243
-
232
+
244
233
  if secret_env_vars:
245
234
  helm_values["secretEnvVars"] = secret_env_vars
246
235
 
@@ -253,30 +242,25 @@ def merge_deployment_configs(
253
242
 
254
243
  # Handle image pull secrets
255
244
  if manifest.deployment and manifest.deployment.imagePullSecrets:
256
- pull_secrets = [
257
- pull_secret.model_dump()
258
- for pull_secret in manifest.deployment.imagePullSecrets
259
- ]
245
+ pull_secrets = [pull_secret.model_dump() for pull_secret in manifest.deployment.imagePullSecrets]
260
246
  helm_values["global"]["imagePullSecrets"] = pull_secrets
261
247
  helm_values["imagePullSecrets"] = pull_secrets
262
248
 
263
249
  # Add dynamic ACP command based on manifest configuration if command is not set in helm overrides
264
- helm_overrides_command = agent_env_config and agent_env_config.helm_overrides and "command" in agent_env_config.helm_overrides
250
+ helm_overrides_command = (
251
+ agent_env_config and agent_env_config.helm_overrides and "command" in agent_env_config.helm_overrides
252
+ )
265
253
  if not helm_overrides_command:
266
254
  add_acp_command_to_helm_values(helm_values, manifest, manifest_path)
267
-
268
- print("Deploying with the following helm values: ", helm_values)
255
+
256
+ logger.info("Deploying with the following helm values: %s", helm_values)
269
257
  return helm_values
270
258
 
271
259
 
272
260
  def _deep_merge(base_dict: dict[str, Any], override_dict: dict[str, Any]) -> None:
273
261
  """Deep merge override_dict into base_dict"""
274
262
  for key, value in override_dict.items():
275
- if (
276
- key in base_dict
277
- and isinstance(base_dict[key], dict)
278
- and isinstance(value, dict)
279
- ):
263
+ if key in base_dict and isinstance(base_dict[key], dict) and isinstance(value, dict):
280
264
  _deep_merge(base_dict[key], value)
281
265
  else:
282
266
  base_dict[key] = value
@@ -318,8 +302,14 @@ def deploy_agent(
318
302
  else:
319
303
  console.print(f"[yellow]⚠[/yellow] No environments.yaml found, skipping environment-specific config")
320
304
 
305
+ if agent_env_config:
306
+ helm_repository_name = agent_env_config.helm_repository_name
307
+ helm_repository_url = agent_env_config.helm_repository_url
308
+ else:
309
+ helm_repository_name = "scale-egp"
310
+ helm_repository_url = "https://scale-egp-helm-charts-us-west-2.s3.amazonaws.com/charts"
321
311
  # Add helm repository/update
322
- add_helm_repo()
312
+ add_helm_repo(helm_repository_name, helm_repository_url)
323
313
 
324
314
  # Merge configurations
325
315
  helm_values = merge_deployment_configs(manifest, agent_env_config, deploy_overrides, manifest_path)
@@ -349,7 +339,7 @@ def deploy_agent(
349
339
  "helm",
350
340
  "upgrade",
351
341
  release_name,
352
- "scale-egp/agentex-agent",
342
+ f"{helm_repository_name}/agentex-agent",
353
343
  "--version",
354
344
  AGENTEX_AGENTS_HELM_CHART_VERSION,
355
345
  "-f",
@@ -371,7 +361,7 @@ def deploy_agent(
371
361
  "helm",
372
362
  "install",
373
363
  release_name,
374
- "scale-egp/agentex-agent",
364
+ f"{helm_repository_name}/agentex-agent",
375
365
  "--version",
376
366
  AGENTEX_AGENTS_HELM_CHART_VERSION,
377
367
  "-f",
@@ -389,12 +379,8 @@ def deploy_agent(
389
379
 
390
380
  # Show success message with helpful commands
391
381
  console.print("\n[green]🎉 Deployment completed successfully![/green]")
392
- console.print(
393
- f"[blue]Check deployment status:[/blue] helm status {release_name} -n {namespace}"
394
- )
395
- console.print(
396
- f"[blue]View logs:[/blue] kubectl logs -l app.kubernetes.io/name=agentex-agent -n {namespace}"
397
- )
382
+ console.print(f"[blue]Check deployment status:[/blue] helm status {release_name} -n {namespace}")
383
+ console.print(f"[blue]View logs:[/blue] kubectl logs -l app.kubernetes.io/name=agentex-agent -n {namespace}")
398
384
 
399
385
  except subprocess.CalledProcessError as e:
400
386
  raise HelmError(
@@ -1,26 +1,21 @@
1
- import asyncio
2
1
  import os
3
2
  import sys
3
+ import asyncio
4
4
  from pathlib import Path
5
5
 
6
- from rich.console import Console
7
6
  from rich.panel import Panel
7
+ from rich.console import Console
8
8
 
9
- from agentex.lib.cli.handlers.cleanup_handlers import (
10
- cleanup_agent_workflows,
11
- should_cleanup_on_restart
12
- )
9
+ # Import debug functionality
10
+ from agentex.lib.cli.debug import DebugConfig, start_acp_server_debug, start_temporal_worker_debug
11
+ from agentex.lib.utils.logging import make_logger
13
12
  from agentex.lib.cli.utils.path_utils import (
14
13
  get_file_paths,
15
14
  calculate_uvicorn_target_for_local,
16
15
  )
17
-
18
16
  from agentex.lib.environment_variables import EnvVarKeys
19
17
  from agentex.lib.sdk.config.agent_manifest import AgentManifest
20
-
21
- # Import debug functionality
22
- from agentex.lib.cli.debug import DebugConfig, start_acp_server_debug, start_temporal_worker_debug
23
- from agentex.lib.utils.logging import make_logger
18
+ from agentex.lib.cli.handlers.cleanup_handlers import cleanup_agent_workflows, should_cleanup_on_restart
24
19
 
25
20
  logger = make_logger(__name__)
26
21
  console = Console()
@@ -242,6 +237,8 @@ async def start_temporal_worker(
242
237
  async def stream_process_output(process: asyncio.subprocess.Process, prefix: str):
243
238
  """Stream process output with prefix"""
244
239
  try:
240
+ if process.stdout is None:
241
+ return
245
242
  while True:
246
243
  line = await process.stdout.readline()
247
244
  if not line:
@@ -297,11 +294,11 @@ async def run_agent(manifest_path: str, debug_config: "DebugConfig | None" = Non
297
294
  manifest_dir = Path(manifest_path).parent
298
295
  if debug_config and debug_config.should_debug_acp():
299
296
  acp_process = await start_acp_server_debug(
300
- file_paths["acp"], manifest.local_development.agent.port, agent_env, debug_config
297
+ file_paths["acp"], manifest.local_development.agent.port, agent_env, debug_config # type: ignore[union-attr]
301
298
  )
302
299
  else:
303
300
  acp_process = await start_acp_server(
304
- file_paths["acp"], manifest.local_development.agent.port, agent_env, manifest_dir
301
+ file_paths["acp"], manifest.local_development.agent.port, agent_env, manifest_dir # type: ignore[union-attr]
305
302
  )
306
303
  process_manager.add_process(acp_process)
307
304
 
@@ -325,7 +322,7 @@ async def run_agent(manifest_path: str, debug_config: "DebugConfig | None" = Non
325
322
  tasks.append(worker_task)
326
323
 
327
324
  console.print(
328
- f"\n[green]✓ Agent running at: http://localhost:{manifest.local_development.agent.port}[/green]"
325
+ f"\n[green]✓ Agent running at: http://localhost:{manifest.local_development.agent.port}[/green]" # type: ignore[union-attr]
329
326
  )
330
327
  console.print("[dim]Press Ctrl+C to stop[/dim]\n")
331
328
 
@@ -369,8 +366,8 @@ def create_agent_environment(manifest: AgentManifest) -> dict[str, str]:
369
366
  "REDIS_URL": "redis://localhost:6379",
370
367
  "AGENT_NAME": manifest.agent.name,
371
368
  "ACP_TYPE": manifest.agent.acp_type,
372
- "ACP_URL": f"http://{manifest.local_development.agent.host_address}",
373
- "ACP_PORT": str(manifest.local_development.agent.port),
369
+ "ACP_URL": f"http://{manifest.local_development.agent.host_address}", # type: ignore[union-attr]
370
+ "ACP_PORT": str(manifest.local_development.agent.port), # type: ignore[union-attr]
374
371
  }
375
372
 
376
373
  # Add authorization principal if set - for local development, auth is optional
@@ -1,28 +1,19 @@
1
- import base64
2
1
  import json
3
- from collections import defaultdict
4
- from pathlib import Path
2
+ import base64
5
3
  from typing import Any
4
+ from pathlib import Path
5
+ from collections import defaultdict
6
6
 
7
- import questionary
8
- import typer
9
7
  import yaml
10
- from kubernetes.client.rest import ApiException
8
+ import typer
9
+ import questionary
11
10
  from rich.console import Console
11
+ from kubernetes.client.rest import ApiException
12
12
 
13
+ from agentex.lib.utils.logging import make_logger
14
+ from agentex.lib.types.credentials import CredentialMapping
13
15
  from agentex.lib.cli.utils.cli_utils import handle_questionary_cancellation
14
16
  from agentex.lib.cli.utils.kubectl_utils import get_k8s_client
15
- from agentex.lib.cli.utils.kubernetes_secrets_utils import (
16
- KUBERNETES_SECRET_TO_MANIFEST_KEY,
17
- KUBERNETES_SECRET_TYPE_DOCKERCONFIGJSON,
18
- KUBERNETES_SECRET_TYPE_OPAQUE,
19
- VALID_SECRET_TYPES,
20
- create_image_pull_secret_with_data,
21
- create_secret_with_data,
22
- get_secret_data,
23
- update_image_pull_secret_with_data,
24
- update_secret_with_data,
25
- )
26
17
  from agentex.lib.sdk.config.agent_config import AgentConfig
27
18
  from agentex.lib.sdk.config.agent_manifest import AgentManifest
28
19
  from agentex.lib.sdk.config.deployment_config import (
@@ -30,8 +21,17 @@ from agentex.lib.sdk.config.deployment_config import (
30
21
  ImagePullSecretConfig,
31
22
  InjectedSecretsValues,
32
23
  )
33
- from agentex.lib.types.credentials import CredentialMapping
34
- from agentex.lib.utils.logging import make_logger
24
+ from agentex.lib.cli.utils.kubernetes_secrets_utils import (
25
+ VALID_SECRET_TYPES,
26
+ KUBERNETES_SECRET_TYPE_OPAQUE,
27
+ KUBERNETES_SECRET_TO_MANIFEST_KEY,
28
+ KUBERNETES_SECRET_TYPE_DOCKERCONFIGJSON,
29
+ get_secret_data,
30
+ create_secret_with_data,
31
+ update_secret_with_data,
32
+ create_image_pull_secret_with_data,
33
+ update_image_pull_secret_with_data,
34
+ )
35
35
 
36
36
  logger = make_logger(__name__)
37
37
  console = Console()
@@ -131,16 +131,16 @@ def interactive_secret_input(secret_name: str, secret_key: str) -> str:
131
131
  return handle_questionary_cancellation(result, "text input")
132
132
 
133
133
 
134
- def get_secret(name: str, namespace: str, context: str | None = None) -> dict:
134
+ def get_secret(name: str, namespace: str, context: str | None = None) -> dict[str, Any]:
135
135
  """Get details about a secret"""
136
136
  v1 = get_k8s_client(context)
137
137
 
138
138
  try:
139
139
  secret = v1.read_namespaced_secret(name=name, namespace=namespace)
140
140
  return {
141
- "name": secret.metadata.name,
141
+ "name": secret.metadata.name, # type: ignore[union-attr]
142
142
  "namespace": namespace,
143
- "created": secret.metadata.creation_timestamp.isoformat(),
143
+ "created": secret.metadata.creation_timestamp.isoformat(), # type: ignore[union-attr]
144
144
  "exists": True,
145
145
  }
146
146
  except ApiException as e:
@@ -173,7 +173,7 @@ def delete_secret(name: str, namespace: str, context: str | None = None) -> None
173
173
 
174
174
  def get_kubernetes_secrets_by_type(
175
175
  namespace: str, context: str | None = None
176
- ) -> dict[str, list[dict]]:
176
+ ) -> dict[str, list[dict[str, Any]]]:
177
177
  """List metadata about secrets in the namespace"""
178
178
  v1 = get_k8s_client(context)
179
179
 
@@ -218,7 +218,7 @@ def sync_user_defined_secrets(
218
218
  cluster_secret_names = {secret["name"] for secret in found_secrets}
219
219
  # Get the secrets from the manifest
220
220
  agent_config: AgentConfig = manifest_obj.agent
221
- manifest_credentials: list[CredentialMapping] = agent_config.credentials or []
221
+ manifest_credentials: list[CredentialMapping] = agent_config.credentials or [] # type: ignore[assignment]
222
222
 
223
223
  if not manifest_credentials:
224
224
  console.print("[yellow]No credentials found in manifest[/yellow]")
@@ -465,7 +465,7 @@ def sync_image_pull_secrets(
465
465
  }
466
466
 
467
467
  # Get the secrets from the manifest
468
- deployment_config: DeploymentConfig = manifest_obj.deployment
468
+ deployment_config: DeploymentConfig = manifest_obj.deployment # type: ignore[assignment]
469
469
  manifest_image_pull_secrets: list[ImagePullSecretConfig] = (
470
470
  deployment_config.imagePullSecrets or []
471
471
  )
@@ -5,23 +5,26 @@ import sys
5
5
  if os.getenv("AGENTEX_DEBUG_ENABLED") == "true":
6
6
  try:
7
7
  import debugpy
8
+ from agentex.lib.utils.logging import make_logger
9
+
10
+ logger = make_logger(__name__)
8
11
  debug_port = int(os.getenv("AGENTEX_DEBUG_PORT", "5679"))
9
12
  debug_type = os.getenv("AGENTEX_DEBUG_TYPE", "acp")
10
13
  wait_for_attach = os.getenv("AGENTEX_DEBUG_WAIT_FOR_ATTACH", "false").lower() == "true"
11
-
14
+
12
15
  # Configure debugpy
13
16
  debugpy.configure(subProcess=False)
14
17
  debugpy.listen(debug_port)
15
-
16
- print(f"🐛 [{debug_type.upper()}] Debug server listening on port {debug_port}")
17
-
18
+
19
+ logger.info(f"🐛 [{debug_type.upper()}] Debug server listening on port {debug_port}")
20
+
18
21
  if wait_for_attach:
19
- print(f"⏳ [{debug_type.upper()}] Waiting for debugger to attach...")
22
+ logger.info(f"⏳ [{debug_type.upper()}] Waiting for debugger to attach...")
20
23
  debugpy.wait_for_client()
21
- print(f"✅ [{debug_type.upper()}] Debugger attached!")
24
+ logger.info(f"✅ [{debug_type.upper()}] Debugger attached!")
22
25
  else:
23
- print(f"📡 [{debug_type.upper()}] Ready for debugger attachment")
24
-
26
+ logger.info(f"📡 [{debug_type.upper()}] Ready for debugger attachment")
27
+
25
28
  except ImportError:
26
29
  print("❌ debugpy not available. Install with: pip install debugpy")
27
30
  sys.exit(1)
@@ -1,13 +1,14 @@
1
- import base64
2
1
  import json
2
+ import base64
3
3
  from typing import Any, Dict
4
4
 
5
5
  from agentex.lib.sdk.config.agent_manifest import AgentManifest
6
6
  from agentex.lib.sdk.config.environment_config import AgentAuthConfig
7
7
 
8
+
8
9
  # DEPRECATED: Old function for backward compatibility
9
10
  # Will be removed in future version
10
- def _encode_principal_context(manifest: AgentManifest) -> str | None:
11
+ def _encode_principal_context(manifest: AgentManifest) -> str | None: # noqa: ARG001
11
12
  """
12
13
  DEPRECATED: This function is deprecated as AgentManifest no longer contains auth.
13
14
  Use _encode_principal_context_from_env_config instead.
@@ -1,7 +1,7 @@
1
1
  import subprocess
2
2
 
3
+ from rich.prompt import Prompt, Confirm
3
4
  from rich.console import Console
4
- from rich.prompt import Confirm, Prompt
5
5
 
6
6
  from agentex.lib.types.credentials import CredentialMapping
7
7
 
@@ -1,11 +1,11 @@
1
1
  import subprocess
2
2
 
3
3
  from kubernetes import client, config
4
- from kubernetes.client.rest import ApiException
5
4
  from rich.console import Console
5
+ from kubernetes.client.rest import ApiException
6
6
 
7
- from agentex.lib.cli.utils.exceptions import DeploymentError
8
7
  from agentex.lib.utils.logging import make_logger
8
+ from agentex.lib.cli.utils.exceptions import DeploymentError
9
9
 
10
10
  logger = make_logger(__name__)
11
11
  console = Console()
@@ -59,7 +59,7 @@ def list_available_contexts() -> list[str]:
59
59
  """List all available kubectl contexts"""
60
60
  try:
61
61
  contexts, _ = config.list_kube_config_contexts()
62
- return [ctx["name"] for ctx in contexts]
62
+ return [ctx["name"] for ctx in contexts] # type: ignore[index]
63
63
  except Exception as e:
64
64
  raise DeploymentError(f"Failed to list kubectl contexts: {e}") from e
65
65
 
@@ -1,11 +1,11 @@
1
1
  import base64
2
2
 
3
3
  from kubernetes import client
4
- from kubernetes.client.rest import ApiException
5
4
  from rich.console import Console
5
+ from kubernetes.client.rest import ApiException
6
6
 
7
- from agentex.lib.cli.utils.kubectl_utils import get_k8s_client
8
7
  from agentex.lib.utils.logging import make_logger
8
+ from agentex.lib.cli.utils.kubectl_utils import get_k8s_client
9
9
 
10
10
  logger = make_logger(__name__)
11
11
  console = Console()
@@ -172,11 +172,11 @@ def get_secret_data(
172
172
  v1 = get_k8s_client(context)
173
173
  try:
174
174
  secret = v1.read_namespaced_secret(name=name, namespace=namespace)
175
- if secret.data:
175
+ if secret.data: # type: ignore[union-attr]
176
176
  # Decode base64 data
177
177
  return {
178
178
  key: base64.b64decode(value).decode("utf-8")
179
- for key, value in secret.data.items()
179
+ for key, value in secret.data.items() # type: ignore[union-attr]
180
180
  }
181
181
  return {}
182
182
  except ApiException as e: