Skip to content

Commit f059431

Browse files
committed
Merge branch 'main' into stas/trace-agentex-source
2 parents bb30569 + e0236aa commit f059431

File tree

10 files changed

+67
-26
lines changed

10 files changed

+67
-26
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.4.20"
2+
".": "0.4.22"
33
}

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.4.22 (2025-10-01)
4+
5+
Full Changelog: [v0.4.21...v0.4.22](https://github.com/scaleapi/agentex-python/compare/v0.4.21...v0.4.22)
6+
7+
## 0.4.21 (2025-10-01)
8+
9+
Full Changelog: [v0.4.20...v0.4.21](https://github.com/scaleapi/agentex-python/compare/v0.4.20...v0.4.21)
10+
311
## 0.4.20 (2025-10-01)
412

513
Full Changelog: [v0.4.19...v0.4.20](https://github.com/scaleapi/agentex-python/compare/v0.4.19...v0.4.20)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "agentex-sdk"
3-
version = "0.4.20"
3+
version = "0.4.22"
44
description = "The official Python library for the agentex API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/agentex/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "agentex"
4-
__version__ = "0.4.20" # x-release-please-version
4+
__version__ = "0.4.22" # x-release-please-version

src/agentex/lib/cli/handlers/run_handlers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,10 @@ def create_agent_environment(manifest: AgentManifest) -> dict[str, str]:
389389
env_vars["WORKFLOW_NAME"] = temporal_config.name
390390
env_vars["WORKFLOW_TASK_QUEUE"] = temporal_config.queue_name
391391

392+
# Set health check port from temporal config
393+
if manifest.agent.temporal and manifest.agent.temporal.health_check_port is not None:
394+
env_vars["HEALTH_CHECK_PORT"] = str(manifest.agent.temporal.health_check_port)
395+
392396
if agent_config.env:
393397
for key, value in agent_config.env.items():
394398
env_vars[key] = value

src/agentex/lib/cli/templates/temporal/manifest.yaml.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ agent:
8989
# Convention: <agent_name>_task_queue
9090
queue_name: {{ queue_name }}
9191

92+
# Optional: Health check port for temporal worker
93+
# Defaults to 80 if not specified
94+
# health_check_port: 80
95+
9296
# Optional: Credentials mapping
9397
# Maps Kubernetes secrets to environment variables
9498
# Common credentials include:

src/agentex/lib/core/clients/temporal/utils.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from temporalio.client import Client, Plugin as ClientPlugin
44
from temporalio.runtime import Runtime, TelemetryConfig, OpenTelemetryConfig
55
from temporalio.contrib.pydantic import pydantic_data_converter
6+
from temporalio.contrib.openai_agents import OpenAIAgentsPlugin
67

78
# class DateTimeJSONEncoder(AdvancedJSONEncoder):
89
# def default(self, o: Any) -> Any:
@@ -74,20 +75,24 @@ async def get_temporal_client(temporal_address: str, metrics_url: str | None = N
7475
if plugins:
7576
validate_client_plugins(plugins)
7677

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+
7792
if not metrics_url:
78-
client = await Client.connect(
79-
target_host=temporal_address,
80-
# data_converter=custom_data_converter,
81-
data_converter=pydantic_data_converter,
82-
plugins=plugins,
83-
)
93+
client = await Client.connect(**connect_kwargs)
8494
else:
8595
runtime = Runtime(telemetry=TelemetryConfig(metrics=OpenTelemetryConfig(url=metrics_url)))
86-
client = await Client.connect(
87-
target_host=temporal_address,
88-
# data_converter=custom_data_converter,
89-
data_converter=pydantic_data_converter,
90-
runtime=runtime,
91-
plugins=plugins,
92-
)
96+
connect_kwargs["runtime"] = runtime
97+
client = await Client.connect(**connect_kwargs)
9398
return client

src/agentex/lib/core/temporal/workers/worker.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
JSONPlainPayloadConverter,
2424
_JSONTypeConverterUnhandled,
2525
)
26+
from temporalio.contrib.openai_agents import OpenAIAgentsPlugin
2627

2728
from agentex.lib.utils.logging import make_logger
2829
from agentex.lib.utils.registration import register_agent
@@ -81,18 +82,27 @@ async def get_temporal_client(temporal_address: str, metrics_url: str | None = N
8182
if plugins != []: # We don't need to validate the plugins if they are empty
8283
_validate_plugins(plugins)
8384

85+
# Check if OpenAI plugin is present - it needs to configure its own data converter
86+
has_openai_plugin = any(
87+
isinstance(p, OpenAIAgentsPlugin) for p in (plugins or [])
88+
)
89+
90+
# Build connection kwargs
91+
connect_kwargs = {
92+
"target_host": temporal_address,
93+
"plugins": plugins,
94+
}
95+
96+
# Only set data_converter if OpenAI plugin is not present
97+
if not has_openai_plugin:
98+
connect_kwargs["data_converter"] = custom_data_converter
99+
84100
if not metrics_url:
85-
client = await Client.connect(
86-
target_host=temporal_address, data_converter=custom_data_converter, plugins=plugins
87-
)
101+
client = await Client.connect(**connect_kwargs)
88102
else:
89103
runtime = Runtime(telemetry=TelemetryConfig(metrics=OpenTelemetryConfig(url=metrics_url)))
90-
client = await Client.connect(
91-
target_host=temporal_address,
92-
data_converter=custom_data_converter,
93-
runtime=runtime,
94-
plugins=plugins,
95-
)
104+
connect_kwargs["runtime"] = runtime
105+
client = await Client.connect(**connect_kwargs)
96106
return client
97107

98108

@@ -102,7 +112,7 @@ def __init__(
102112
task_queue,
103113
max_workers: int = 10,
104114
max_concurrent_activities: int = 10,
105-
health_check_port: int = 80,
115+
health_check_port: int = int(os.environ.get("HEALTH_CHECK_PORT")),
106116
plugins: list = [],
107117
):
108118
self.task_queue = task_queue

src/agentex/lib/environment_variables.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class EnvVarKeys(str, Enum):
3232
# Workflow Configuration
3333
WORKFLOW_NAME = "WORKFLOW_NAME"
3434
WORKFLOW_TASK_QUEUE = "WORKFLOW_TASK_QUEUE"
35+
# Temporal Worker Configuration
36+
HEALTH_CHECK_PORT = "HEALTH_CHECK_PORT"
3537
# Auth Configuration
3638
AUTH_PRINCIPAL_B64 = "AUTH_PRINCIPAL_B64"
3739
# Build Information
@@ -65,6 +67,9 @@ class EnvironmentVariables(BaseModel):
6567
# Workflow Configuration
6668
WORKFLOW_TASK_QUEUE: str | None = None
6769
WORKFLOW_NAME: str | None = None
70+
# Temporal Worker Configuration
71+
HEALTH_CHECK_PORT: int = 80
72+
# Auth Configuration
6873
AUTH_PRINCIPAL_B64: str | None = None
6974
# Build Information
7075
BUILD_INFO_PATH: str | None = None

src/agentex/lib/types/agent_configs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class TemporalConfig(BaseModel):
4545
enabled: Whether this agent uses Temporal workflows
4646
workflow: The temporal workflow configuration
4747
workflows: The list of temporal workflow configurations
48+
health_check_port: Port for temporal worker health check endpoint
4849
"""
4950

5051
enabled: bool = Field(
@@ -58,6 +59,10 @@ class TemporalConfig(BaseModel):
5859
default=None,
5960
description="List of temporal workflow configurations. Used when enabled=true.",
6061
)
62+
health_check_port: int | None = Field(
63+
default=None,
64+
description="Port for temporal worker health check endpoint. Defaults to 80 if not specified.",
65+
)
6166

6267
@validator("workflows")
6368
def validate_workflows_not_empty(cls, v):

0 commit comments

Comments
 (0)