agentex-sdk 0.4.19__py3-none-any.whl → 0.4.21__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 (129) 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 +20 -39
  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 +27 -25
  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 +4 -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/project_config.py +6 -6
  89. agentex/lib/sdk/config/validation.py +2 -2
  90. agentex/lib/sdk/fastacp/base/base_acp_server.py +16 -16
  91. agentex/lib/sdk/fastacp/fastacp.py +14 -15
  92. agentex/lib/sdk/fastacp/impl/agentic_base_acp.py +4 -5
  93. agentex/lib/sdk/fastacp/impl/sync_acp.py +7 -7
  94. agentex/lib/sdk/fastacp/impl/temporal_acp.py +28 -19
  95. agentex/lib/sdk/fastacp/tests/conftest.py +18 -16
  96. agentex/lib/sdk/fastacp/tests/run_tests.py +1 -1
  97. agentex/lib/sdk/fastacp/tests/test_base_acp_server.py +4 -4
  98. agentex/lib/sdk/fastacp/tests/test_fastacp_factory.py +8 -8
  99. agentex/lib/sdk/fastacp/tests/test_integration.py +15 -14
  100. agentex/lib/sdk/state_machine/__init__.py +1 -1
  101. agentex/lib/sdk/state_machine/noop_workflow.py +5 -3
  102. agentex/lib/sdk/state_machine/state_machine.py +18 -12
  103. agentex/lib/sdk/utils/messages.py +5 -5
  104. agentex/lib/types/acp.py +2 -2
  105. agentex/lib/types/agent_configs.py +1 -1
  106. agentex/lib/types/converters.py +4 -2
  107. agentex/lib/types/credentials.py +1 -1
  108. agentex/lib/types/fastacp.py +4 -5
  109. agentex/lib/types/tracing.py +1 -1
  110. agentex/lib/utils/completions.py +5 -5
  111. agentex/lib/utils/console.py +1 -1
  112. agentex/lib/utils/debug.py +10 -5
  113. agentex/lib/utils/dev_tools/async_messages.py +11 -12
  114. agentex/lib/utils/iterables.py +1 -1
  115. agentex/lib/utils/json_schema.py +4 -4
  116. agentex/lib/utils/logging.py +7 -7
  117. agentex/lib/utils/mcp.py +1 -0
  118. agentex/lib/utils/model_utils.py +4 -5
  119. agentex/lib/utils/registration.py +5 -4
  120. agentex/resources/agents.py +11 -4
  121. agentex/types/agent_rpc_response.py +3 -3
  122. agentex/types/data_content.py +1 -1
  123. agentex/types/tool_request_content.py +1 -1
  124. agentex/types/tool_response_content.py +0 -1
  125. {agentex_sdk-0.4.19.dist-info → agentex_sdk-0.4.21.dist-info}/METADATA +1 -1
  126. {agentex_sdk-0.4.19.dist-info → agentex_sdk-0.4.21.dist-info}/RECORD +129 -129
  127. {agentex_sdk-0.4.19.dist-info → agentex_sdk-0.4.21.dist-info}/WHEEL +0 -0
  128. {agentex_sdk-0.4.19.dist-info → agentex_sdk-0.4.21.dist-info}/entry_points.txt +0 -0
  129. {agentex_sdk-0.4.19.dist-info → agentex_sdk-0.4.21.dist-info}/licenses/LICENSE +0 -0
@@ -1,11 +1,12 @@
1
1
  import os
2
- from collections.abc import AsyncGenerator, Generator
2
+ from typing import override
3
+ from collections.abc import Generator, AsyncGenerator
3
4
 
4
- from scale_gp import AsyncSGPClient, SGPClient
5
+ from scale_gp import SGPClient, AsyncSGPClient
5
6
 
6
- from agentex.lib.core.adapters.llm.port import LLMGateway
7
- from agentex.lib.types.llm_messages import Completion
8
7
  from agentex.lib.utils.logging import make_logger
8
+ from agentex.lib.types.llm_messages import Completion
9
+ from agentex.lib.core.adapters.llm.port import LLMGateway
9
10
 
10
11
  logger = make_logger(__name__)
11
12
 
@@ -17,6 +18,7 @@ class SGPLLMGateway(LLMGateway):
17
18
  api_key=os.environ.get("SGP_API_KEY", sgp_api_key)
18
19
  )
19
20
 
21
+ @override
20
22
  def completion(self, *args, **kwargs) -> Completion:
21
23
  if kwargs.get("stream", True):
22
24
  raise ValueError(
@@ -26,6 +28,7 @@ class SGPLLMGateway(LLMGateway):
26
28
  response = self.sync_client.beta.chat.completions.create(*args, **kwargs)
27
29
  return Completion.model_validate(response)
28
30
 
31
+ @override
29
32
  def completion_stream(self, *args, **kwargs) -> Generator[Completion, None, None]:
30
33
  if not kwargs.get("stream"):
31
34
  raise ValueError("To use streaming, please set stream=True in the kwargs")
@@ -33,6 +36,7 @@ class SGPLLMGateway(LLMGateway):
33
36
  for chunk in self.sync_client.beta.chat.completions.create(*args, **kwargs):
34
37
  yield Completion.model_validate(chunk)
35
38
 
39
+ @override
36
40
  async def acompletion(self, *args, **kwargs) -> Completion:
37
41
  if kwargs.get("stream", True):
38
42
  raise ValueError(
@@ -43,13 +47,12 @@ class SGPLLMGateway(LLMGateway):
43
47
  response = await self.async_client.beta.chat.completions.create(*args, **kwargs)
44
48
  return Completion.model_validate(response)
45
49
 
50
+ @override
46
51
  async def acompletion_stream(
47
52
  self, *args, **kwargs
48
53
  ) -> AsyncGenerator[Completion, None]:
49
54
  if not kwargs.get("stream"):
50
55
  raise ValueError("To use streaming, please set stream=True in the kwargs")
51
56
 
52
- async for chunk in await self.async_client.beta.chat.completions.create(
53
- *args, **kwargs
54
- ):
57
+ async for chunk in self.async_client.beta.chat.completions.create(*args, **kwargs): # type: ignore[misc]
55
58
  yield Completion.model_validate(chunk)
@@ -1,5 +1,5 @@
1
1
  from abc import ABC, abstractmethod
2
- from collections.abc import AsyncGenerator, Generator
2
+ from collections.abc import Generator, AsyncGenerator
3
3
 
4
4
  from agentex.lib.types.llm_messages import Completion
5
5
 
@@ -1,14 +1,14 @@
1
- import asyncio
2
- import json
3
1
  import os
2
+ import json
3
+ import asyncio
4
+ from typing import Any, Annotated, override
4
5
  from collections.abc import AsyncIterator
5
- from typing import Annotated, Any
6
6
 
7
7
  import redis.asyncio as redis
8
8
  from fastapi import Depends
9
9
 
10
- from agentex.lib.core.adapters.streams.port import StreamRepository
11
10
  from agentex.lib.utils.logging import make_logger
11
+ from agentex.lib.core.adapters.streams.port import StreamRepository
12
12
 
13
13
  logger = make_logger(__name__)
14
14
 
@@ -26,6 +26,7 @@ class RedisStreamRepository(StreamRepository):
26
26
  )
27
27
  self.redis = redis.from_url(self.redis_url)
28
28
 
29
+ @override
29
30
  async def send_event(self, topic: str, event: dict[str, Any]) -> str:
30
31
  """
31
32
  Send an event to a Redis stream.
@@ -55,6 +56,7 @@ class RedisStreamRepository(StreamRepository):
55
56
  logger.error(f"Error publishing to Redis stream {topic}: {e}")
56
57
  raise
57
58
 
59
+ @override
58
60
  async def subscribe(
59
61
  self, topic: str, last_id: str = "$"
60
62
  ) -> AsyncIterator[dict[str, Any]]:
@@ -108,6 +110,7 @@ class RedisStreamRepository(StreamRepository):
108
110
  logger.error(f"Error reading from Redis stream: {e}")
109
111
  await asyncio.sleep(1) # Back off on errors
110
112
 
113
+ @override
111
114
  async def cleanup_stream(self, topic: str) -> None:
112
115
  """
113
116
  Clean up a Redis stream.
@@ -1,6 +1,6 @@
1
1
  from abc import ABC, abstractmethod
2
- from collections.abc import AsyncIterator
3
2
  from typing import Any
3
+ from collections.abc import AsyncIterator
4
4
 
5
5
 
6
6
  class StreamRepository(ABC):
@@ -1,25 +1,29 @@
1
- from collections.abc import Callable
2
- from datetime import timedelta
3
1
  from typing import Any
2
+ from datetime import timedelta
3
+ from collections.abc import Callable
4
4
 
5
5
  from temporalio.client import Client, WorkflowExecutionStatus
6
- from temporalio.common import RetryPolicy as TemporalRetryPolicy
7
- from temporalio.common import WorkflowIDReusePolicy
6
+ from temporalio.common import RetryPolicy as TemporalRetryPolicy, WorkflowIDReusePolicy
8
7
  from temporalio.service import RPCError, RPCStatusCode
9
8
 
9
+ from agentex.lib.utils.logging import make_logger
10
+ from agentex.lib.utils.model_utils import BaseModel
10
11
  from agentex.lib.core.clients.temporal.types import (
11
- DuplicateWorkflowPolicy,
12
- RetryPolicy,
13
12
  TaskStatus,
13
+ RetryPolicy,
14
14
  WorkflowState,
15
+ DuplicateWorkflowPolicy,
15
16
  )
16
17
  from agentex.lib.core.clients.temporal.utils import get_temporal_client
17
- from agentex.lib.utils.logging import make_logger
18
- from agentex.lib.utils.model_utils import BaseModel
19
18
 
20
19
  logger = make_logger(__name__)
21
20
 
22
- DEFAULT_RETRY_POLICY = RetryPolicy(maximum_attempts=1)
21
+ DEFAULT_RETRY_POLICY = RetryPolicy(
22
+ maximum_attempts=1,
23
+ initial_interval=timedelta(seconds=1),
24
+ backoff_coefficient=2.0,
25
+ maximum_interval=timedelta(minutes=10),
26
+ )
23
27
 
24
28
 
25
29
  TEMPORAL_STATUS_TO_UPLOAD_STATUS_AND_REASON = {
@@ -36,8 +40,7 @@ TEMPORAL_STATUS_TO_UPLOAD_STATUS_AND_REASON = {
36
40
  ),
37
41
  WorkflowExecutionStatus.FAILED: WorkflowState(
38
42
  status=TaskStatus.FAILED,
39
- reason="Task encountered terminal failure. "
40
- "Please contact support if retrying does not resolve the issue.",
43
+ reason="Task encountered terminal failure. Please contact support if retrying does not resolve the issue.",
41
44
  is_terminal=True,
42
45
  ),
43
46
  WorkflowExecutionStatus.RUNNING: WorkflowState(
@@ -72,9 +75,16 @@ DUPLICATE_POLICY_TO_ID_REUSE_POLICY = {
72
75
 
73
76
  class TemporalClient:
74
77
  def __init__(self, temporal_client: Client | None = None, plugins: list[Any] = []):
75
- self._client: Client = temporal_client
78
+ self._client: Client | None = temporal_client
76
79
  self._plugins = plugins
77
80
 
81
+ @property
82
+ def client(self) -> Client:
83
+ """Get the temporal client, raising an error if not initialized."""
84
+ if self._client is None:
85
+ raise RuntimeError("Temporal client not initialized - ensure temporal_address is properly configured")
86
+ return self._client
87
+
78
88
  @classmethod
79
89
  async def create(cls, temporal_address: str, plugins: list[Any] = []):
80
90
  if temporal_address in [
@@ -89,18 +99,13 @@ class TemporalClient:
89
99
  ]:
90
100
  _client = None
91
101
  else:
92
- _client = await get_temporal_client(
93
- temporal_address,
94
- plugins=plugins
95
- )
102
+ _client = await get_temporal_client(temporal_address, plugins=plugins)
96
103
  return cls(_client, plugins)
97
104
 
98
105
  async def setup(self, temporal_address: str):
99
- self._client = await self._get_temporal_client(
100
- temporal_address=temporal_address
101
- )
106
+ self._client = await self._get_temporal_client(temporal_address=temporal_address)
102
107
 
103
- async def _get_temporal_client(self, temporal_address: str) -> Client:
108
+ async def _get_temporal_client(self, temporal_address: str) -> Client | None:
104
109
  if temporal_address in [
105
110
  "false",
106
111
  "False",
@@ -113,10 +118,7 @@ class TemporalClient:
113
118
  ]:
114
119
  return None
115
120
  else:
116
- return await get_temporal_client(
117
- temporal_address,
118
- plugins=self._plugins
119
- )
121
+ return await get_temporal_client(temporal_address, plugins=self._plugins)
120
122
 
121
123
  async def start_workflow(
122
124
  self,
@@ -127,10 +129,8 @@ class TemporalClient:
127
129
  execution_timeout: timedelta = timedelta(seconds=86400),
128
130
  **kwargs: Any,
129
131
  ) -> str:
130
- temporal_retry_policy = TemporalRetryPolicy(
131
- **retry_policy.model_dump(exclude_unset=True)
132
- )
133
- workflow_handle = await self._client.start_workflow(
132
+ temporal_retry_policy = TemporalRetryPolicy(**retry_policy.model_dump(exclude_unset=True))
133
+ workflow_handle = await self.client.start_workflow(
134
134
  *args,
135
135
  retry_policy=temporal_retry_policy,
136
136
  task_timeout=task_timeout,
@@ -146,8 +146,8 @@ class TemporalClient:
146
146
  signal: str | Callable[[dict[str, Any] | list[Any] | str | int | float | bool | BaseModel], Any],
147
147
  payload: dict[str, Any] | list[Any] | str | int | float | bool | BaseModel,
148
148
  ) -> None:
149
- handle = self._client.get_workflow_handle(workflow_id=workflow_id)
150
- await handle.signal(signal, payload)
149
+ handle = self.client.get_workflow_handle(workflow_id=workflow_id)
150
+ await handle.signal(signal, payload) # type: ignore[misc]
151
151
 
152
152
  async def query_workflow(
153
153
  self,
@@ -164,12 +164,12 @@ class TemporalClient:
164
164
  Returns:
165
165
  The result of the query
166
166
  """
167
- handle = self._client.get_workflow_handle(workflow_id=workflow_id)
167
+ handle = self.client.get_workflow_handle(workflow_id=workflow_id)
168
168
  return await handle.query(query)
169
169
 
170
170
  async def get_workflow_status(self, workflow_id: str) -> WorkflowState:
171
171
  try:
172
- handle = self._client.get_workflow_handle(workflow_id=workflow_id)
172
+ handle = self.client.get_workflow_handle(workflow_id=workflow_id)
173
173
  description = await handle.describe()
174
174
  return TEMPORAL_STATUS_TO_UPLOAD_STATUS_AND_REASON[description.status]
175
175
  except RPCError as e:
@@ -182,7 +182,7 @@ class TemporalClient:
182
182
  raise
183
183
 
184
184
  async def terminate_workflow(self, workflow_id: str) -> None:
185
- return await self._client.get_workflow_handle(workflow_id).terminate()
185
+ return await self.client.get_workflow_handle(workflow_id).terminate()
186
186
 
187
187
  async def cancel_workflow(self, workflow_id: str) -> None:
188
- return await self._client.get_workflow_handle(workflow_id).cancel()
188
+ return await self.client.get_workflow_handle(workflow_id).cancel()
@@ -1,5 +1,5 @@
1
- from datetime import timedelta
2
1
  from enum import Enum
2
+ from datetime import timedelta
3
3
 
4
4
  from pydantic import Field
5
5
 
@@ -1,7 +1,9 @@
1
1
  from typing import Any
2
+
2
3
  from temporalio.client import Client, Plugin as ClientPlugin
4
+ from temporalio.runtime import Runtime, TelemetryConfig, OpenTelemetryConfig
3
5
  from temporalio.contrib.pydantic import pydantic_data_converter
4
- from temporalio.runtime import OpenTelemetryConfig, Runtime, TelemetryConfig
6
+ from temporalio.contrib.openai_agents import OpenAIAgentsPlugin
5
7
 
6
8
  # class DateTimeJSONEncoder(AdvancedJSONEncoder):
7
9
  # def default(self, o: Any) -> Any:
@@ -42,10 +44,10 @@ from temporalio.runtime import OpenTelemetryConfig, Runtime, TelemetryConfig
42
44
  def validate_client_plugins(plugins: list[Any]) -> None:
43
45
  """
44
46
  Validate that all items in the plugins list are valid Temporal client plugins.
45
-
47
+
46
48
  Args:
47
49
  plugins: List of plugins to validate
48
-
50
+
49
51
  Raises:
50
52
  TypeError: If any plugin is not a valid ClientPlugin instance
51
53
  """
@@ -57,40 +59,40 @@ def validate_client_plugins(plugins: list[Any]) -> None:
57
59
  )
58
60
 
59
61
 
60
- async def get_temporal_client(
61
- temporal_address: str,
62
- metrics_url: str = None,
63
- plugins: list[Any] = []
64
- ) -> Client:
62
+ async def get_temporal_client(temporal_address: str, metrics_url: str | None = None, plugins: list[Any] = []) -> Client:
65
63
  """
66
64
  Create a Temporal client with plugin integration.
67
-
65
+
68
66
  Args:
69
67
  temporal_address: Temporal server address
70
- metrics_url: Optional metrics endpoint URL
68
+ metrics_url: Optional metrics endpoint URL
71
69
  plugins: List of Temporal plugins to include
72
-
70
+
73
71
  Returns:
74
72
  Configured Temporal client
75
73
  """
76
74
  # Validate plugins if any are provided
77
75
  if plugins:
78
76
  validate_client_plugins(plugins)
79
-
77
+
78
+ # Check if OpenAI plugin is present - it needs to configure its own data converter
79
+ has_openai_plugin = any(
80
+ isinstance(p, OpenAIAgentsPlugin) for p in (plugins or [])
81
+ )
82
+
83
+ # Only set data_converter if OpenAI plugin is not present
84
+ connect_kwargs = {
85
+ "target_host": temporal_address,
86
+ "plugins": plugins,
87
+ }
88
+
89
+ if not has_openai_plugin:
90
+ connect_kwargs["data_converter"] = pydantic_data_converter
91
+
80
92
  if not metrics_url:
81
- client = await Client.connect(
82
- target_host=temporal_address,
83
- # data_converter=custom_data_converter,
84
- data_converter=pydantic_data_converter,
85
- plugins=plugins,
86
- )
93
+ client = await Client.connect(**connect_kwargs)
87
94
  else:
88
95
  runtime = Runtime(telemetry=TelemetryConfig(metrics=OpenTelemetryConfig(url=metrics_url)))
89
- client = await Client.connect(
90
- target_host=temporal_address,
91
- # data_converter=custom_data_converter,
92
- data_converter=pydantic_data_converter,
93
- runtime=runtime,
94
- plugins=plugins,
95
- )
96
+ connect_kwargs["runtime"] = runtime
97
+ client = await Client.connect(**connect_kwargs)
96
98
  return client
@@ -1,18 +1,18 @@
1
1
  from typing import Any, List, cast
2
2
 
3
3
  from agentex import AsyncAgentex
4
- from agentex.lib.core.tracing.tracer import AsyncTracer
4
+ from agentex.types.task import Task
5
+ from agentex.types.event import Event
5
6
  from agentex.lib.utils.logging import make_logger
6
7
  from agentex.lib.utils.temporal import heartbeat_if_in_workflow
7
- from agentex.types.event import Event
8
- from agentex.types.task import Task
9
8
  from agentex.types.task_message import TaskMessage
10
- from agentex.types.task_message_content import TaskMessageContent
11
- from agentex.types.task_message_content_param import TaskMessageContentParam
12
9
  from agentex.types.agent_rpc_params import (
13
- ParamsCancelTaskRequest as RpcParamsCancelTaskRequest,
14
10
  ParamsSendEventRequest as RpcParamsSendEventRequest,
11
+ ParamsCancelTaskRequest as RpcParamsCancelTaskRequest,
15
12
  )
13
+ from agentex.lib.core.tracing.tracer import AsyncTracer
14
+ from agentex.types.task_message_content import TaskMessageContent
15
+ from agentex.types.task_message_content_param import TaskMessageContentParam
16
16
 
17
17
  logger = make_logger(__name__)
18
18
 
@@ -1,6 +1,6 @@
1
1
  from agentex import AsyncAgentex
2
- from agentex.lib.core.tracing.tracer import AsyncTracer
3
2
  from agentex.lib.utils.logging import make_logger
3
+ from agentex.lib.core.tracing.tracer import AsyncTracer
4
4
  from agentex.types.agent_task_tracker import AgentTaskTracker
5
5
 
6
6
  logger = make_logger(__name__)
@@ -1,10 +1,10 @@
1
1
  from typing import Optional
2
2
 
3
3
  from agentex import AsyncAgentex
4
- from agentex.lib.core.tracing.tracer import AsyncTracer
5
4
  from agentex.types.agent import Agent
6
5
  from agentex.lib.utils.logging import make_logger
7
6
  from agentex.lib.utils.temporal import heartbeat_if_in_workflow
7
+ from agentex.lib.core.tracing.tracer import AsyncTracer
8
8
 
9
9
  logger = make_logger(__name__)
10
10
 
@@ -1,7 +1,7 @@
1
1
  from agentex import AsyncAgentex
2
- from agentex.lib.core.tracing.tracer import AsyncTracer
3
2
  from agentex.types.event import Event
4
3
  from agentex.lib.utils.logging import make_logger
4
+ from agentex.lib.core.tracing.tracer import AsyncTracer
5
5
 
6
6
  logger = make_logger(__name__)
7
7
 
@@ -1,14 +1,13 @@
1
1
  import asyncio
2
- from typing import Any, Coroutine, cast
2
+ from typing import Any, Coroutine
3
3
 
4
4
  from agentex import AsyncAgentex
5
- from agentex.lib.core.services.adk.streaming import StreamingService
6
- from agentex.lib.core.tracing.tracer import AsyncTracer
7
- from agentex.types.task_message_update import StreamTaskMessageFull, TaskMessageUpdate
8
- from agentex.types.task_message import TaskMessage, TaskMessageContent
9
5
  from agentex.lib.utils.logging import make_logger
10
6
  from agentex.lib.utils.temporal import heartbeat_if_in_workflow
11
- from agentex.types.task_message_content_param import TaskMessageContentParam
7
+ from agentex.types.task_message import TaskMessage, TaskMessageContent
8
+ from agentex.lib.core.tracing.tracer import AsyncTracer
9
+ from agentex.types.task_message_update import TaskMessageUpdate, StreamTaskMessageFull
10
+ from agentex.lib.core.services.adk.streaming import StreamingService
12
11
 
13
12
  logger = make_logger(__name__)
14
13
 
@@ -1,23 +1,23 @@
1
1
  from collections.abc import AsyncGenerator
2
2
 
3
3
  from agentex import AsyncAgentex
4
- from agentex.lib.core.adapters.llm.adapter_litellm import LiteLLMGateway
5
- from agentex.lib.core.services.adk.streaming import StreamingService
6
- from agentex.lib.core.tracing.tracer import AsyncTracer
4
+ from agentex.lib.utils import logging
5
+ from agentex.lib.utils.temporal import heartbeat_if_in_workflow
6
+ from agentex.types.task_message import TaskMessage
7
+ from agentex.lib.utils.completions import concat_completion_chunks
7
8
  from agentex.lib.types.llm_messages import (
8
- Completion,
9
9
  LLMConfig,
10
+ Completion,
10
11
  )
12
+ from agentex.lib.core.tracing.tracer import AsyncTracer
13
+ from agentex.types.task_message_delta import TextDelta
11
14
  from agentex.types.task_message_update import (
12
- StreamTaskMessageDelta,
13
15
  StreamTaskMessageFull,
16
+ StreamTaskMessageDelta,
14
17
  )
15
- from agentex.types.task_message_delta import TextDelta
16
- from agentex.types.task_message import TaskMessage
17
18
  from agentex.types.task_message_content import TextContent
18
- from agentex.lib.utils import logging
19
- from agentex.lib.utils.completions import concat_completion_chunks
20
- from agentex.lib.utils.temporal import heartbeat_if_in_workflow
19
+ from agentex.lib.core.services.adk.streaming import StreamingService
20
+ from agentex.lib.core.adapters.llm.adapter_litellm import LiteLLMGateway
21
21
 
22
22
  logger = logging.make_logger(__name__)
23
23