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
@@ -2,11 +2,11 @@ from enum import Enum
2
2
 
3
3
  from temporalio import activity
4
4
 
5
- from agentex.lib.core.services.adk.streaming import StreamingService
6
- from agentex.types.task_message_update import TaskMessageUpdate
7
5
  from agentex.lib.utils.logging import make_logger
8
- from agentex.lib.utils.model_utils import BaseModel
9
6
  from agentex.lib.utils.temporal import heartbeat_if_in_workflow
7
+ from agentex.lib.utils.model_utils import BaseModel
8
+ from agentex.types.task_message_update import TaskMessageUpdate
9
+ from agentex.lib.core.services.adk.streaming import StreamingService
10
10
 
11
11
  logger = make_logger(__name__)
12
12
 
@@ -2,10 +2,10 @@ from enum import Enum
2
2
 
3
3
  from temporalio import activity
4
4
 
5
- from agentex.lib.core.services.adk.tasks import TasksService
6
5
  from agentex.types.task import Task
7
6
  from agentex.lib.types.tracing import BaseModelWithTraceParams
8
7
  from agentex.lib.utils.logging import make_logger
8
+ from agentex.lib.core.services.adk.tasks import TasksService
9
9
 
10
10
  logger = make_logger(__name__)
11
11
 
@@ -40,7 +40,7 @@ class TasksActivities:
40
40
 
41
41
  @activity.defn(name=TasksActivityName.DELETE_TASK)
42
42
  async def delete_task(self, params: DeleteTaskParams) -> Task:
43
- return await self._tasks_service.delete_task(
43
+ return await self._tasks_service.delete_task( # type: ignore[return-value]
44
44
  task_id=params.task_id,
45
45
  task_name=params.task_name,
46
46
  trace_id=params.trace_id,
@@ -3,10 +3,10 @@ from typing import Any
3
3
 
4
4
  from temporalio import activity
5
5
 
6
- from agentex.lib.core.services.adk.tracing import TracingService
7
6
  from agentex.types.span import Span
8
7
  from agentex.lib.utils.logging import make_logger
9
8
  from agentex.lib.utils.model_utils import BaseModel
9
+ from agentex.lib.core.services.adk.tracing import TracingService
10
10
 
11
11
  logger = make_logger(__name__)
12
12
 
@@ -3,8 +3,8 @@ from typing import Any
3
3
 
4
4
  from temporalio import activity
5
5
 
6
- from agentex.lib.core.services.adk.utils.templating import TemplatingService
7
6
  from agentex.lib.types.tracing import BaseModelWithTraceParams
7
+ from agentex.lib.core.services.adk.utils.templating import TemplatingService
8
8
 
9
9
 
10
10
  class JinjaActivityName(str, Enum):
@@ -1,13 +1,13 @@
1
1
  from typing import Any
2
- from agentex.lib.core.clients.temporal.temporal_client import TemporalClient
3
- from agentex.lib.core.clients.temporal.types import WorkflowState
4
- from agentex.lib.core.temporal.types.workflow import SignalName
5
- from agentex.lib.environment_variables import EnvironmentVariables
6
- from agentex.lib.types.acp import CreateTaskParams
7
- from agentex.lib.types.acp import SendEventParams
2
+
3
+ from agentex.types.task import Task
8
4
  from agentex.types.agent import Agent
9
5
  from agentex.types.event import Event
10
- from agentex.types.task import Task
6
+ from agentex.lib.types.acp import SendEventParams, CreateTaskParams
7
+ from agentex.lib.environment_variables import EnvironmentVariables
8
+ from agentex.lib.core.clients.temporal.types import WorkflowState
9
+ from agentex.lib.core.temporal.types.workflow import SignalName
10
+ from agentex.lib.core.clients.temporal.temporal_client import TemporalClient
11
11
 
12
12
 
13
13
  class TemporalTaskService:
@@ -1,28 +1,28 @@
1
- import dataclasses
2
- import datetime
3
1
  import os
4
2
  import uuid
3
+ import datetime
4
+ import dataclasses
5
+ from typing import Any, overload, override
5
6
  from collections.abc import Callable
6
7
  from concurrent.futures import ThreadPoolExecutor
7
- from typing import Any, overload
8
8
 
9
9
  from aiohttp import web
10
10
  from temporalio.client import Client, Plugin as ClientPlugin
11
+ from temporalio.worker import (
12
+ Plugin as WorkerPlugin,
13
+ Worker,
14
+ UnsandboxedWorkflowRunner,
15
+ )
16
+ from temporalio.runtime import Runtime, TelemetryConfig, OpenTelemetryConfig
11
17
  from temporalio.converter import (
12
- AdvancedJSONEncoder,
13
- CompositePayloadConverter,
14
18
  DataConverter,
19
+ JSONTypeConverter,
20
+ AdvancedJSONEncoder,
15
21
  DefaultPayloadConverter,
22
+ CompositePayloadConverter,
16
23
  JSONPlainPayloadConverter,
17
- JSONTypeConverter,
18
24
  _JSONTypeConverterUnhandled,
19
25
  )
20
- from temporalio.runtime import OpenTelemetryConfig, Runtime, TelemetryConfig
21
- from temporalio.worker import (
22
- Plugin as WorkerPlugin,
23
- UnsandboxedWorkflowRunner,
24
- Worker,
25
- )
26
26
 
27
27
  from agentex.lib.utils.logging import make_logger
28
28
  from agentex.lib.utils.registration import register_agent
@@ -32,6 +32,7 @@ logger = make_logger(__name__)
32
32
 
33
33
 
34
34
  class DateTimeJSONEncoder(AdvancedJSONEncoder):
35
+ @override
35
36
  def default(self, o: Any) -> Any:
36
37
  if isinstance(o, datetime.datetime):
37
38
  return o.isoformat()
@@ -39,9 +40,8 @@ class DateTimeJSONEncoder(AdvancedJSONEncoder):
39
40
 
40
41
 
41
42
  class DateTimeJSONTypeConverter(JSONTypeConverter):
42
- def to_typed_value(
43
- self, hint: type, value: Any
44
- ) -> Any | None | _JSONTypeConverterUnhandled:
43
+ @override
44
+ def to_typed_value(self, hint: type, value: Any) -> Any | None | _JSONTypeConverterUnhandled:
45
45
  if hint == datetime.datetime:
46
46
  return datetime.datetime.fromisoformat(value)
47
47
  return JSONTypeConverter.Unhandled
@@ -66,6 +66,7 @@ custom_data_converter = dataclasses.replace(
66
66
  payload_converter_class=DateTimePayloadConverter,
67
67
  )
68
68
 
69
+
69
70
  def _validate_plugins(plugins: list) -> None:
70
71
  """Validate that all items in the plugins list are valid Temporal plugins."""
71
72
  for i, plugin in enumerate(plugins):
@@ -76,10 +77,8 @@ def _validate_plugins(plugins: list) -> None:
76
77
  )
77
78
 
78
79
 
79
-
80
- async def get_temporal_client(temporal_address: str, metrics_url: str = None, plugins: list = []) -> Client:
81
-
82
- if plugins != []: # We don't need to validate the plugins if they are empty
80
+ async def get_temporal_client(temporal_address: str, metrics_url: str | None = None, plugins: list = []) -> Client:
81
+ if plugins != []: # We don't need to validate the plugins if they are empty
83
82
  _validate_plugins(plugins)
84
83
 
85
84
  if not metrics_url:
@@ -87,13 +86,12 @@ async def get_temporal_client(temporal_address: str, metrics_url: str = None, pl
87
86
  target_host=temporal_address, data_converter=custom_data_converter, plugins=plugins
88
87
  )
89
88
  else:
90
- runtime = Runtime(
91
- telemetry=TelemetryConfig(metrics=OpenTelemetryConfig(url=metrics_url))
92
- )
89
+ runtime = Runtime(telemetry=TelemetryConfig(metrics=OpenTelemetryConfig(url=metrics_url)))
93
90
  client = await Client.connect(
94
91
  target_host=temporal_address,
95
92
  data_converter=custom_data_converter,
96
93
  runtime=runtime,
94
+ plugins=plugins,
97
95
  )
98
96
  return client
99
97
 
@@ -123,7 +121,7 @@ class AgentexWorker:
123
121
  *,
124
122
  workflow: type,
125
123
  ) -> None: ...
126
-
124
+
127
125
  @overload
128
126
  async def run(
129
127
  self,
@@ -145,15 +143,15 @@ class AgentexWorker:
145
143
  temporal_address=os.environ.get("TEMPORAL_ADDRESS", "localhost:7233"),
146
144
  plugins=self.plugins,
147
145
  )
148
-
146
+
149
147
  # Enable debug mode if AgentEx debug is enabled (disables deadlock detection)
150
148
  debug_enabled = os.environ.get("AGENTEX_DEBUG_ENABLED", "false").lower() == "true"
151
149
  if debug_enabled:
152
150
  logger.info("🐛 [WORKER] Temporal debug mode enabled - deadlock detection disabled")
153
-
151
+
154
152
  if workflow is None and workflows is None:
155
153
  raise ValueError("Either workflow or workflows must be provided")
156
-
154
+
157
155
  worker = Worker(
158
156
  client=temporal_client,
159
157
  task_queue=self.task_queue,
@@ -178,7 +176,7 @@ class AgentexWorker:
178
176
  async def start_health_check_server(self):
179
177
  if not self.health_check_server_running:
180
178
  app = web.Application()
181
- app.router.add_get("/readyz", lambda request: self._health_check())
179
+ app.router.add_get("/readyz", lambda request: self._health_check()) # noqa: ARG005
182
180
 
183
181
  # Disable access logging
184
182
  runner = web.AppRunner(app, access_log=None)
@@ -187,27 +185,19 @@ class AgentexWorker:
187
185
  try:
188
186
  site = web.TCPSite(runner, "0.0.0.0", self.health_check_port)
189
187
  await site.start()
190
- logger.info(
191
- f"Health check server running on http://0.0.0.0:{self.health_check_port}/readyz"
192
- )
188
+ logger.info(f"Health check server running on http://0.0.0.0:{self.health_check_port}/readyz")
193
189
  self.health_check_server_running = True
194
190
  except OSError as e:
195
- logger.error(
196
- f"Failed to start health check server on port {self.health_check_port}: {e}"
197
- )
191
+ logger.error(f"Failed to start health check server on port {self.health_check_port}: {e}")
198
192
  # Try alternative port if default fails
199
193
  try:
200
194
  alt_port = self.health_check_port + 1
201
195
  site = web.TCPSite(runner, "0.0.0.0", alt_port)
202
196
  await site.start()
203
- logger.info(
204
- f"Health check server running on alternative port http://0.0.0.0:{alt_port}/readyz"
205
- )
197
+ logger.info(f"Health check server running on alternative port http://0.0.0.0:{alt_port}/readyz")
206
198
  self.health_check_server_running = True
207
199
  except OSError as e:
208
- logger.error(
209
- f"Failed to start health check server on alternative port {alt_port}: {e}"
210
- )
200
+ logger.error(f"Failed to start health check server on alternative port {alt_port}: {e}")
211
201
  raise
212
202
 
213
203
  """
@@ -217,9 +207,10 @@ class AgentexWorker:
217
207
  doing this on the worker side is required to make sure that both share the API key
218
208
  which is returned on registration and used to authenticate the worker with the Agentex server.
219
209
  """
210
+
220
211
  async def _register_agent(self):
221
212
  env_vars = EnvironmentVariables.refresh()
222
213
  if env_vars and env_vars.AGENTEX_BASE_URL:
223
214
  await register_agent(env_vars)
224
215
  else:
225
- logger.warning("AGENTEX_BASE_URL not set, skipping worker registration")
216
+ logger.warning("AGENTEX_BASE_URL not set, skipping worker registration")
@@ -2,9 +2,9 @@ from abc import ABC, abstractmethod
2
2
 
3
3
  from temporalio import workflow
4
4
 
5
- from agentex.lib.core.temporal.types.workflow import SignalName
6
- from agentex.lib.types.acp import CreateTaskParams, SendEventParams
5
+ from agentex.lib.types.acp import SendEventParams, CreateTaskParams
7
6
  from agentex.lib.utils.logging import make_logger
7
+ from agentex.lib.core.temporal.types.workflow import SignalName
8
8
 
9
9
  logger = make_logger(__name__)
10
10
 
@@ -1,5 +1,5 @@
1
- from agentex.lib.core.tracing.trace import AsyncTrace, Trace
2
- from agentex.lib.core.tracing.tracer import AsyncTracer, Tracer
3
1
  from agentex.types.span import Span
2
+ from agentex.lib.core.tracing.trace import Trace, AsyncTrace
3
+ from agentex.lib.core.tracing.tracer import Tracer, AsyncTracer
4
4
 
5
5
  __all__ = ["Trace", "AsyncTrace", "Span", "Tracer", "AsyncTracer"]
@@ -1,17 +1,17 @@
1
1
  from typing import Any, Dict, override
2
2
 
3
- from agentex import Agentex, AsyncAgentex
3
+ from agentex import Agentex
4
+ from agentex.types.span import Span
5
+ from agentex.lib.types.tracing import AgentexTracingProcessorConfig
4
6
  from agentex.lib.adk.utils._modules.client import create_async_agentex_client
5
7
  from agentex.lib.core.tracing.processors.tracing_processor_interface import (
6
- AsyncTracingProcessor,
7
8
  SyncTracingProcessor,
9
+ AsyncTracingProcessor,
8
10
  )
9
- from agentex.types.span import Span
10
- from agentex.lib.types.tracing import AgentexTracingProcessorConfig
11
11
 
12
12
 
13
13
  class AgentexSyncTracingProcessor(SyncTracingProcessor):
14
- def __init__(self, config: AgentexTracingProcessorConfig):
14
+ def __init__(self, config: AgentexTracingProcessorConfig): # noqa: ARG002
15
15
  self.client = Agentex()
16
16
 
17
17
  @override
@@ -65,7 +65,7 @@ class AgentexSyncTracingProcessor(SyncTracingProcessor):
65
65
 
66
66
 
67
67
  class AgentexAsyncTracingProcessor(AsyncTracingProcessor):
68
- def __init__(self, config: AgentexTracingProcessorConfig):
68
+ def __init__(self, config: AgentexTracingProcessorConfig): # noqa: ARG002
69
69
  self.client = create_async_agentex_client()
70
70
 
71
71
  @override
@@ -1,17 +1,17 @@
1
1
  from typing import override
2
2
 
3
3
  import scale_gp_beta.lib.tracing as tracing
4
- from scale_gp_beta import AsyncSGPClient, SGPClient
4
+ from scale_gp_beta import SGPClient, AsyncSGPClient
5
5
  from scale_gp_beta.lib.tracing import create_span, flush_queue
6
6
  from scale_gp_beta.lib.tracing.span import Span as SGPSpan
7
7
 
8
- from agentex.lib.core.tracing.processors.tracing_processor_interface import (
9
- AsyncTracingProcessor,
10
- SyncTracingProcessor,
11
- )
12
8
  from agentex.types.span import Span
13
9
  from agentex.lib.types.tracing import SGPTracingProcessorConfig
14
10
  from agentex.lib.utils.logging import make_logger
11
+ from agentex.lib.core.tracing.processors.tracing_processor_interface import (
12
+ SyncTracingProcessor,
13
+ AsyncTracingProcessor,
14
+ )
15
15
 
16
16
  logger = make_logger(__name__)
17
17
 
@@ -36,7 +36,7 @@ class SGPSyncTracingProcessor(SyncTracingProcessor):
36
36
  output=span.output,
37
37
  metadata=span.data,
38
38
  )
39
- sgp_span.start_time = span.start_time.isoformat()
39
+ sgp_span.start_time = span.start_time.isoformat() # type: ignore[union-attr]
40
40
  sgp_span.flush(blocking=False)
41
41
 
42
42
  self._spans[span.id] = sgp_span
@@ -50,9 +50,9 @@ class SGPSyncTracingProcessor(SyncTracingProcessor):
50
50
  )
51
51
  return
52
52
 
53
- sgp_span.output = span.output
54
- sgp_span.metadata = span.data
55
- sgp_span.end_time = span.end_time.isoformat()
53
+ sgp_span.output = span.output # type: ignore[assignment]
54
+ sgp_span.metadata = span.data # type: ignore[assignment]
55
+ sgp_span.end_time = span.end_time.isoformat() # type: ignore[union-attr]
56
56
  sgp_span.flush(blocking=False)
57
57
 
58
58
  @override
@@ -82,11 +82,11 @@ class SGPAsyncTracingProcessor(AsyncTracingProcessor):
82
82
  output=span.output,
83
83
  metadata=span.data,
84
84
  )
85
- sgp_span.start_time = span.start_time.isoformat()
85
+ sgp_span.start_time = span.start_time.isoformat() # type: ignore[union-attr]
86
86
 
87
87
  if self.disabled:
88
88
  return
89
- await self.sgp_async_client.spans.upsert_batch(
89
+ await self.sgp_async_client.spans.upsert_batch( # type: ignore[union-attr]
90
90
  items=[sgp_span.to_request_params()]
91
91
  )
92
92
 
@@ -101,19 +101,19 @@ class SGPAsyncTracingProcessor(AsyncTracingProcessor):
101
101
  )
102
102
  return
103
103
 
104
- sgp_span.output = span.output
105
- sgp_span.metadata = span.data
106
- sgp_span.end_time = span.end_time.isoformat()
104
+ sgp_span.output = span.output # type: ignore[assignment]
105
+ sgp_span.metadata = span.data # type: ignore[assignment]
106
+ sgp_span.end_time = span.end_time.isoformat() # type: ignore[union-attr]
107
107
 
108
108
  if self.disabled:
109
109
  return
110
- await self.sgp_async_client.spans.upsert_batch(
110
+ await self.sgp_async_client.spans.upsert_batch( # type: ignore[union-attr]
111
111
  items=[sgp_span.to_request_params()]
112
112
  )
113
113
 
114
114
  @override
115
115
  async def shutdown(self) -> None:
116
- await self.sgp_async_client.spans.upsert_batch(
116
+ await self.sgp_async_client.spans.upsert_batch( # type: ignore[union-attr]
117
117
  items=[sgp_span.to_request_params() for sgp_span in self._spans.values()]
118
118
  )
119
119
  self._spans.clear()
@@ -1,7 +1,7 @@
1
1
  from abc import ABC, abstractmethod
2
2
 
3
- from agentex.lib.types.tracing import TracingProcessorConfig
4
3
  from agentex.types.span import Span
4
+ from agentex.lib.types.tracing import TracingProcessorConfig
5
5
 
6
6
 
7
7
  class SyncTracingProcessor(ABC):
@@ -1,19 +1,19 @@
1
+ import uuid
1
2
  import asyncio
2
- from contextlib import asynccontextmanager, contextmanager
3
- from datetime import UTC, datetime
4
3
  from typing import Any, AsyncGenerator
5
- import uuid
4
+ from datetime import UTC, datetime
5
+ from contextlib import contextmanager, asynccontextmanager
6
6
 
7
7
  from pydantic import BaseModel
8
8
 
9
9
  from agentex import Agentex, AsyncAgentex
10
+ from agentex.types.span import Span
11
+ from agentex.lib.utils.logging import make_logger
12
+ from agentex.lib.utils.model_utils import recursive_model_dump
10
13
  from agentex.lib.core.tracing.processors.tracing_processor_interface import (
11
- AsyncTracingProcessor,
12
14
  SyncTracingProcessor,
15
+ AsyncTracingProcessor,
13
16
  )
14
- from agentex.lib.utils.logging import make_logger
15
- from agentex.lib.utils.model_utils import recursive_model_dump
16
- from agentex.types.span import Span
17
17
 
18
18
  logger = make_logger(__name__)
19
19
 
@@ -1,8 +1,8 @@
1
1
  from agentex import Agentex, AsyncAgentex
2
- from agentex.lib.core.tracing.trace import AsyncTrace, Trace
2
+ from agentex.lib.core.tracing.trace import Trace, AsyncTrace
3
3
  from agentex.lib.core.tracing.tracing_processor_manager import (
4
- get_async_tracing_processors,
5
4
  get_sync_tracing_processors,
5
+ get_async_tracing_processors,
6
6
  )
7
7
 
8
8
 
@@ -1,38 +1,53 @@
1
+ from typing import TYPE_CHECKING
1
2
  from threading import Lock
2
3
 
3
- from agentex.lib.core.tracing.processors.agentex_tracing_processor import (
4
- AgentexAsyncTracingProcessor,
5
- AgentexSyncTracingProcessor,
6
- )
4
+ from agentex.lib.types.tracing import TracingProcessorConfig, AgentexTracingProcessorConfig
7
5
  from agentex.lib.core.tracing.processors.sgp_tracing_processor import (
8
- SGPAsyncTracingProcessor,
9
6
  SGPSyncTracingProcessor,
7
+ SGPAsyncTracingProcessor,
10
8
  )
11
9
  from agentex.lib.core.tracing.processors.tracing_processor_interface import (
12
- AsyncTracingProcessor,
13
10
  SyncTracingProcessor,
11
+ AsyncTracingProcessor,
14
12
  )
15
- from agentex.lib.types.tracing import AgentexTracingProcessorConfig, TracingProcessorConfig
13
+
14
+ if TYPE_CHECKING:
15
+ from agentex.lib.core.tracing.processors.agentex_tracing_processor import ( # noqa: F401
16
+ AgentexSyncTracingProcessor,
17
+ AgentexAsyncTracingProcessor,
18
+ )
16
19
 
17
20
 
18
21
  class TracingProcessorManager:
19
22
  def __init__(self):
20
23
  # Mapping of processor config type to processor class
24
+ # Use lazy loading for agentex processors to avoid circular imports
21
25
  self.sync_config_registry: dict[str, type[SyncTracingProcessor]] = {
22
- "agentex": AgentexSyncTracingProcessor,
23
26
  "sgp": SGPSyncTracingProcessor,
24
27
  }
25
28
  self.async_config_registry: dict[str, type[AsyncTracingProcessor]] = {
26
- "agentex": AgentexAsyncTracingProcessor,
27
29
  "sgp": SGPAsyncTracingProcessor,
28
30
  }
29
31
  # Cache for processors
30
32
  self.sync_processors: list[SyncTracingProcessor] = []
31
33
  self.async_processors: list[AsyncTracingProcessor] = []
32
34
  self.lock = Lock()
35
+ self._agentex_registered = False
36
+
37
+ def _ensure_agentex_registered(self):
38
+ """Lazily register agentex processors to avoid circular imports."""
39
+ if not self._agentex_registered:
40
+ from agentex.lib.core.tracing.processors.agentex_tracing_processor import (
41
+ AgentexSyncTracingProcessor,
42
+ AgentexAsyncTracingProcessor,
43
+ )
44
+ self.sync_config_registry["agentex"] = AgentexSyncTracingProcessor
45
+ self.async_config_registry["agentex"] = AgentexAsyncTracingProcessor
46
+ self._agentex_registered = True
33
47
 
34
48
  def add_processor_config(self, processor_config: TracingProcessorConfig) -> None:
35
49
  with self.lock:
50
+ self._ensure_agentex_registered()
36
51
  sync_processor = self.sync_config_registry[processor_config.type]
37
52
  async_processor = self.async_config_registry[processor_config.type]
38
53
  self.sync_processors.append(sync_processor(processor_config))
@@ -55,8 +70,23 @@ GLOBAL_TRACING_PROCESSOR_MANAGER = TracingProcessorManager()
55
70
 
56
71
  add_tracing_processor_config = GLOBAL_TRACING_PROCESSOR_MANAGER.add_processor_config
57
72
  set_tracing_processor_configs = GLOBAL_TRACING_PROCESSOR_MANAGER.set_processor_configs
58
- get_sync_tracing_processors = GLOBAL_TRACING_PROCESSOR_MANAGER.get_sync_processors
59
- get_async_tracing_processors = GLOBAL_TRACING_PROCESSOR_MANAGER.get_async_processors
60
73
 
61
- # Add the Agentex tracing processor by default
62
- add_tracing_processor_config(AgentexTracingProcessorConfig())
74
+ # Lazy initialization to avoid circular imports
75
+ _default_initialized = False
76
+
77
+ def _ensure_default_initialized():
78
+ """Ensure default processor is initialized (lazy to avoid circular imports)."""
79
+ global _default_initialized
80
+ if not _default_initialized:
81
+ add_tracing_processor_config(AgentexTracingProcessorConfig())
82
+ _default_initialized = True
83
+
84
+ def get_sync_tracing_processors():
85
+ """Get sync processors, initializing defaults if needed."""
86
+ _ensure_default_initialized()
87
+ return GLOBAL_TRACING_PROCESSOR_MANAGER.get_sync_processors()
88
+
89
+ def get_async_tracing_processors():
90
+ """Get async processors, initializing defaults if needed."""
91
+ _ensure_default_initialized()
92
+ return GLOBAL_TRACING_PROCESSOR_MANAGER.get_async_processors()
@@ -5,9 +5,9 @@ import os
5
5
  from enum import Enum
6
6
  from pathlib import Path
7
7
 
8
- from agentex.lib.utils.logging import make_logger
9
8
  from dotenv import load_dotenv
10
9
 
10
+ from agentex.lib.utils.logging import make_logger
11
11
  from agentex.lib.utils.model_utils import BaseModel
12
12
 
13
13
  PROJECT_ROOT = Path(__file__).resolve().parents[2]
@@ -39,12 +39,13 @@ class EnvVarKeys(str, Enum):
39
39
 
40
40
 
41
41
  class Environment(str, Enum):
42
+ LOCAL = "local"
42
43
  DEV = "development"
43
44
  STAGING = "staging"
44
45
  PROD = "production"
45
46
 
46
47
 
47
- refreshed_environment_variables: "EnvironmentVariables" | None = None
48
+ refreshed_environment_variables: EnvironmentVariables | None = None
48
49
 
49
50
 
50
51
  class EnvironmentVariables(BaseModel):
@@ -79,13 +80,13 @@ class EnvironmentVariables(BaseModel):
79
80
  # Load global .env file first
80
81
  global_env_path = PROJECT_ROOT / ".env"
81
82
  if global_env_path.exists():
82
- print(f"Loading global environment variables FROM: {global_env_path}")
83
+ logger.debug(f"Loading global environment variables FROM: {global_env_path}")
83
84
  load_dotenv(dotenv_path=global_env_path, override=False)
84
85
 
85
86
  # Load local project .env.local file (takes precedence)
86
87
  local_env_path = Path.cwd().parent / ".env.local"
87
88
  if local_env_path.exists():
88
- print(f"Loading local environment variables FROM: {local_env_path}")
89
+ logger.debug(f"Loading local environment variables FROM: {local_env_path}")
89
90
  load_dotenv(dotenv_path=local_env_path, override=True)
90
91
 
91
92
  # Create kwargs dict with environment variables, using None for missing values
@@ -2,10 +2,10 @@ from typing import Any, Literal
2
2
 
3
3
  from pydantic import Field
4
4
 
5
- from agentex.lib.types.agent_configs import TemporalConfig, TemporalWorkflowConfig
6
- from agentex.lib.types.credentials import CredentialMapping
7
5
  from agentex.lib.utils.logging import make_logger
6
+ from agentex.lib.types.credentials import CredentialMapping
8
7
  from agentex.lib.utils.model_utils import BaseModel
8
+ from agentex.lib.types.agent_configs import TemporalConfig, TemporalWorkflowConfig
9
9
 
10
10
  logger = make_logger(__name__)
11
11
 
@@ -1,25 +1,25 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import io
4
+ import time
4
5
  import shutil
5
- import subprocess
6
6
  import tarfile
7
7
  import tempfile
8
- import time
9
- from collections.abc import Iterator
10
- from contextlib import contextmanager
11
- from pathlib import Path
8
+ import subprocess
12
9
  from typing import IO, Any
10
+ from pathlib import Path
11
+ from contextlib import contextmanager
12
+ from collections.abc import Iterator
13
13
 
14
14
  from pydantic import Field
15
15
 
16
+ from agentex.lib.utils.logging import make_logger
17
+ from agentex.lib.utils.model_utils import BaseModel
16
18
  from agentex.lib.sdk.config.agent_config import AgentConfig
17
19
  from agentex.lib.sdk.config.build_config import BuildConfig
18
- from agentex.lib.sdk.config.environment_config import AgentEnvironmentsConfig
19
20
  from agentex.lib.sdk.config.deployment_config import DeploymentConfig
21
+ from agentex.lib.sdk.config.environment_config import AgentEnvironmentsConfig
20
22
  from agentex.lib.sdk.config.local_development_config import LocalDevelopmentConfig
21
- from agentex.lib.utils.logging import make_logger
22
- from agentex.lib.utils.model_utils import BaseModel
23
23
 
24
24
  logger = make_logger(__name__)
25
25
 
@@ -7,11 +7,11 @@ configurations that are separate from the main manifest.yaml file.
7
7
 
8
8
  from __future__ import annotations
9
9
 
10
- from pathlib import Path
11
10
  from typing import Any, Dict, override
11
+ from pathlib import Path
12
12
 
13
13
  import yaml
14
- from pydantic import BaseModel, Field, field_validator
14
+ from pydantic import Field, BaseModel, field_validator
15
15
 
16
16
  from agentex.lib.utils.model_utils import BaseModel as UtilsBaseModel
17
17
 
@@ -73,6 +73,14 @@ class AgentEnvironmentConfig(BaseModel):
73
73
  ...,
74
74
  description="Authentication and authorization configuration"
75
75
  )
76
+ helm_repository_name: str = Field(
77
+ default="scale-egp",
78
+ description="Helm repository name for the environment"
79
+ )
80
+ helm_repository_url: str = Field(
81
+ default="https://scale-egp-helm-charts-us-west-2.s3.amazonaws.com/charts",
82
+ description="Helm repository url for the environment"
83
+ )
76
84
  helm_overrides: Dict[str, Any] = Field(
77
85
  default_factory=dict,
78
86
  description="Helm chart value overrides for environment-specific tuning"