Skip to content

Commit e0236aa

Browse files
Expose HEALTH_CHECK_PORT as an env var (#114)
* feat: expose HEALTH_CHECK_PORT as an env var * simpler health check port env var * manifest support for temporal worker * remove default * change port default to 80
1 parent 727589e commit e0236aa

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

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/temporal/workers/worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __init__(
112112
task_queue,
113113
max_workers: int = 10,
114114
max_concurrent_activities: int = 10,
115-
health_check_port: int = 80,
115+
health_check_port: int = int(os.environ.get("HEALTH_CHECK_PORT")),
116116
plugins: list = [],
117117
):
118118
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)