From 8c6dfe988b83d4bd5ab04909f56a8a0ba9a852f6 Mon Sep 17 00:00:00 2001 From: Prassanna Ravishankar Date: Tue, 23 Sep 2025 15:27:18 +0100 Subject: [PATCH 1/5] feat: expose HEALTH_CHECK_PORT as an env var --- src/agentex/lib/core/temporal/workers/worker.py | 7 ++++++- src/agentex/lib/environment_variables.py | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/agentex/lib/core/temporal/workers/worker.py b/src/agentex/lib/core/temporal/workers/worker.py index 04babb54..ce7a9fdc 100644 --- a/src/agentex/lib/core/temporal/workers/worker.py +++ b/src/agentex/lib/core/temporal/workers/worker.py @@ -89,7 +89,7 @@ def __init__( task_queue, max_workers: int = 10, max_concurrent_activities: int = 10, - health_check_port: int = 80, + health_check_port: int | None = None, ): self.task_queue = task_queue self.activity_handles = [] @@ -97,6 +97,11 @@ def __init__( self.max_concurrent_activities = max_concurrent_activities self.health_check_server_running = False self.healthy = False + + # Use environment variable if health_check_port not explicitly provided + if health_check_port is None: + health_check_port = int(os.environ.get("HEALTH_CHECK_PORT", "80")) + self.health_check_port = health_check_port @overload diff --git a/src/agentex/lib/environment_variables.py b/src/agentex/lib/environment_variables.py index 43f402e4..32d88555 100644 --- a/src/agentex/lib/environment_variables.py +++ b/src/agentex/lib/environment_variables.py @@ -32,6 +32,8 @@ class EnvVarKeys(str, Enum): # Workflow Configuration WORKFLOW_NAME = "WORKFLOW_NAME" WORKFLOW_TASK_QUEUE = "WORKFLOW_TASK_QUEUE" + # Temporal Worker Configuration + HEALTH_CHECK_PORT = "HEALTH_CHECK_PORT" # Auth Configuration AUTH_PRINCIPAL_B64 = "AUTH_PRINCIPAL_B64" @@ -62,6 +64,9 @@ class EnvironmentVariables(BaseModel): # Workflow Configuration WORKFLOW_TASK_QUEUE: str | None = None WORKFLOW_NAME: str | None = None + # Temporal Worker Configuration + HEALTH_CHECK_PORT: int = 80 + # Auth Configuration AUTH_PRINCIPAL_B64: str | None = None @classmethod From 74f2276a7afe402b182ef5e5bcfbefc0205420b2 Mon Sep 17 00:00:00 2001 From: Prassanna Ravishankar Date: Wed, 24 Sep 2025 15:24:15 +0100 Subject: [PATCH 2/5] simpler health check port env var --- src/agentex/lib/core/temporal/workers/worker.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/agentex/lib/core/temporal/workers/worker.py b/src/agentex/lib/core/temporal/workers/worker.py index ce7a9fdc..093fd8c0 100644 --- a/src/agentex/lib/core/temporal/workers/worker.py +++ b/src/agentex/lib/core/temporal/workers/worker.py @@ -89,7 +89,7 @@ def __init__( task_queue, max_workers: int = 10, max_concurrent_activities: int = 10, - health_check_port: int | None = None, + health_check_port: int = int(os.environ.get("HEALTH_CHECK_PORT", "80")), ): self.task_queue = task_queue self.activity_handles = [] @@ -97,11 +97,6 @@ def __init__( self.max_concurrent_activities = max_concurrent_activities self.health_check_server_running = False self.healthy = False - - # Use environment variable if health_check_port not explicitly provided - if health_check_port is None: - health_check_port = int(os.environ.get("HEALTH_CHECK_PORT", "80")) - self.health_check_port = health_check_port @overload From 9fb8223d804b180814fbe732b731defc6085943c Mon Sep 17 00:00:00 2001 From: Prassanna Ravishankar Date: Wed, 24 Sep 2025 15:26:30 +0100 Subject: [PATCH 3/5] manifest support for temporal worker --- src/agentex/lib/cli/handlers/run_handlers.py | 4 ++++ src/agentex/lib/cli/templates/temporal/manifest.yaml.j2 | 4 ++++ src/agentex/lib/types/agent_configs.py | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/src/agentex/lib/cli/handlers/run_handlers.py b/src/agentex/lib/cli/handlers/run_handlers.py index cfc49e61..e284ed9e 100644 --- a/src/agentex/lib/cli/handlers/run_handlers.py +++ b/src/agentex/lib/cli/handlers/run_handlers.py @@ -392,6 +392,10 @@ def create_agent_environment(manifest: AgentManifest) -> dict[str, str]: env_vars["WORKFLOW_NAME"] = temporal_config.name env_vars["WORKFLOW_TASK_QUEUE"] = temporal_config.queue_name + # Set health check port from temporal config + if manifest.agent.temporal and manifest.agent.temporal.health_check_port is not None: + env_vars["HEALTH_CHECK_PORT"] = str(manifest.agent.temporal.health_check_port) + if agent_config.env: for key, value in agent_config.env.items(): env_vars[key] = value diff --git a/src/agentex/lib/cli/templates/temporal/manifest.yaml.j2 b/src/agentex/lib/cli/templates/temporal/manifest.yaml.j2 index 5ec8cc5e..422dcdda 100644 --- a/src/agentex/lib/cli/templates/temporal/manifest.yaml.j2 +++ b/src/agentex/lib/cli/templates/temporal/manifest.yaml.j2 @@ -89,6 +89,10 @@ agent: # Convention: _task_queue queue_name: {{ queue_name }} + # Optional: Health check port for temporal worker + # Defaults to 80 if not specified + # health_check_port: 8080 + # Optional: Credentials mapping # Maps Kubernetes secrets to environment variables # Common credentials include: diff --git a/src/agentex/lib/types/agent_configs.py b/src/agentex/lib/types/agent_configs.py index 8d9548a8..20757750 100644 --- a/src/agentex/lib/types/agent_configs.py +++ b/src/agentex/lib/types/agent_configs.py @@ -45,6 +45,7 @@ class TemporalConfig(BaseModel): enabled: Whether this agent uses Temporal workflows workflow: The temporal workflow configuration workflows: The list of temporal workflow configurations + health_check_port: Port for temporal worker health check endpoint """ enabled: bool = Field( @@ -58,6 +59,10 @@ class TemporalConfig(BaseModel): default=None, description="List of temporal workflow configurations. Used when enabled=true.", ) + health_check_port: int | None = Field( + default=None, + description="Port for temporal worker health check endpoint. Defaults to 80 if not specified.", + ) @validator("workflows") def validate_workflows_not_empty(cls, v): From 65d6595af316cff5dbdc2e95c0a2c74eda140400 Mon Sep 17 00:00:00 2001 From: Prassanna Ravishankar Date: Wed, 24 Sep 2025 17:25:44 +0100 Subject: [PATCH 4/5] remove default --- src/agentex/lib/core/temporal/workers/worker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agentex/lib/core/temporal/workers/worker.py b/src/agentex/lib/core/temporal/workers/worker.py index 093fd8c0..46ddceb7 100644 --- a/src/agentex/lib/core/temporal/workers/worker.py +++ b/src/agentex/lib/core/temporal/workers/worker.py @@ -89,7 +89,7 @@ def __init__( task_queue, max_workers: int = 10, max_concurrent_activities: int = 10, - health_check_port: int = int(os.environ.get("HEALTH_CHECK_PORT", "80")), + health_check_port: int = int(os.environ.get("HEALTH_CHECK_PORT")), ): self.task_queue = task_queue self.activity_handles = [] From 111f8dcffe2777da99a5ac9737ba8b40b95ed9df Mon Sep 17 00:00:00 2001 From: Prassanna Ravishankar Date: Thu, 2 Oct 2025 16:00:59 +0100 Subject: [PATCH 5/5] change port default to 80 --- src/agentex/lib/cli/templates/temporal/manifest.yaml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agentex/lib/cli/templates/temporal/manifest.yaml.j2 b/src/agentex/lib/cli/templates/temporal/manifest.yaml.j2 index 422dcdda..e5592aba 100644 --- a/src/agentex/lib/cli/templates/temporal/manifest.yaml.j2 +++ b/src/agentex/lib/cli/templates/temporal/manifest.yaml.j2 @@ -91,7 +91,7 @@ agent: # Optional: Health check port for temporal worker # Defaults to 80 if not specified - # health_check_port: 8080 + # health_check_port: 80 # Optional: Credentials mapping # Maps Kubernetes secrets to environment variables