[AGX1-98] Change standard ports to non-standard and make configurable#276
[AGX1-98] Change standard ports to non-standard and make configurable#276danielmillerp wants to merge 1 commit intomainfrom
Conversation
| ENV ACP_PORT=8718 | ||
| CMD uvicorn project.acp:acp --host 0.0.0.0 --port ${ACP_PORT} No newline at end of file |
There was a problem hiding this comment.
Shell form CMD changes signal handling
Switching from exec form (CMD ["uvicorn", ...]) to shell form (CMD uvicorn ...) is needed for ${ACP_PORT} env var expansion, but it means the container process runs under /bin/sh -c, not as PID 1 directly. This means SIGTERM from docker stop goes to the shell, not uvicorn, which can cause a 10-second timeout before a SIGKILL during container shutdown.
Consider using exec form with shell expansion via ENTRYPOINT:
ENV ACP_PORT=8718
CMD ["sh", "-c", "exec uvicorn project.acp:acp --host 0.0.0.0 --port ${ACP_PORT}"]The exec replaces the shell with uvicorn as PID 1, preserving proper signal handling. This same pattern applies to all 14 Dockerfile templates changed in this PR.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agentex/lib/cli/templates/default/Dockerfile.j2
Line: 42-43
Comment:
**Shell form CMD changes signal handling**
Switching from exec form (`CMD ["uvicorn", ...]`) to shell form (`CMD uvicorn ...`) is needed for `${ACP_PORT}` env var expansion, but it means the container process runs under `/bin/sh -c`, not as PID 1 directly. This means `SIGTERM` from `docker stop` goes to the shell, not uvicorn, which can cause a 10-second timeout before a `SIGKILL` during container shutdown.
Consider using exec form with shell expansion via `ENTRYPOINT`:
```dockerfile
ENV ACP_PORT=8718
CMD ["sh", "-c", "exec uvicorn project.acp:acp --host 0.0.0.0 --port ${ACP_PORT}"]
```
The `exec` replaces the shell with uvicorn as PID 1, preserving proper signal handling. This same pattern applies to all 14 Dockerfile templates changed in this PR.
How can I resolve this? If you propose a fix, please make it concise.|
|
||
| # Run the ACP server using uvicorn | ||
| CMD ["uvicorn", "project.acp:acp", "--host", "0.0.0.0", "--port", "8000"] | ||
| ENV ACP_PORT=8718 |
There was a problem hiding this comment.
Old debug port in sibling acp.py not updated
While the Dockerfile and manifest in this directory were correctly updated, examples/demos/procurement_agent/project/acp.py:19 still contains os.getenv("AGENTEX_DEBUG_PORT", "5679") — using the old default. The same applies to 6 other example acp.py files under examples/tutorials/10_async/10_temporal/:
030_custom_activities/project/acp.py:8060_open_ai_agents_sdk_hello_world/project/acp.py:10070_open_ai_agents_sdk_tools/project/acp.py:10080_open_ai_agents_sdk_human_in_the_loop/project/acp.py:10090_claude_agents_sdk_mvp/project/acp.py:12100_gemini_litellm/project/acp.py:10
These should all be updated from "5679" to "9679" to stay consistent with the new DEFAULT_ACP_DEBUG_PORT.
Prompt To Fix With AI
This is a comment left during a code review.
Path: examples/demos/procurement_agent/Dockerfile
Line: 45
Comment:
**Old debug port in sibling acp.py not updated**
While the Dockerfile and manifest in this directory were correctly updated, `examples/demos/procurement_agent/project/acp.py:19` still contains `os.getenv("AGENTEX_DEBUG_PORT", "5679")` — using the old default. The same applies to 6 other example `acp.py` files under `examples/tutorials/10_async/10_temporal/`:
- `030_custom_activities/project/acp.py:8`
- `060_open_ai_agents_sdk_hello_world/project/acp.py:10`
- `070_open_ai_agents_sdk_tools/project/acp.py:10`
- `080_open_ai_agents_sdk_human_in_the_loop/project/acp.py:10`
- `090_claude_agents_sdk_mvp/project/acp.py:12`
- `100_gemini_litellm/project/acp.py:10`
These should all be updated from `"5679"` to `"9679"` to stay consistent with the new `DEFAULT_ACP_DEBUG_PORT`.
How can I resolve this? If you propose a fix, please make it concise.
Additional Comments (1)
This template still uses the old default debug port New projects scaffolded from these templates will get the old port default, creating an inconsistency with the rest of the SDK. Prompt To Fix With AIThis is a comment left during a code review.
Path: src/agentex/lib/cli/templates/temporal/project/acp.py.j2
Line: 11
Comment:
**Missed port migration in template**
This template still uses the old default debug port `"5679"`. Since this PR migrates the ACP debug port from `5679` → `9679` (defined as `DEFAULT_ACP_DEBUG_PORT` in `environment_variables.py`), this fallback should be updated to match. The same issue exists in `src/agentex/lib/cli/templates/temporal-openai-agents/project/acp.py.j2:17`.
New projects scaffolded from these templates will get the old port default, creating an inconsistency with the rest of the SDK.
```suggestion
debug_port = int(os.getenv("AGENTEX_DEBUG_PORT", "9679"))
```
How can I resolve this? If you propose a fix, please make it concise. |
12a4e2f to
128f673
Compare
|
Updated with additional commit that centralizes port defaults and improves env var configurability:
|
3f19d39 to
97b31d1
Compare
97b31d1 to
64f4214
Compare
| health_check_port: int | None = Field( | ||
| default=None, | ||
| description="Port for temporal worker health check endpoint. Defaults to 80 if not specified.", | ||
| description="Port for temporal worker health check endpoint. Defaults to 9718 if not specified.", | ||
| ) |
There was a problem hiding this comment.
Incorrect default port in description
The description says "Defaults to 9718 if not specified" but the actual default used by the system is DEFAULT_HEALTH_CHECK_PORT = 8080 (defined in src/agentex/lib/constants/ports.py:41 and consumed by EnvironmentVariables.HEALTH_CHECK_PORT in environment_variables.py:81). Port 9718 doesn't appear anywhere else in the codebase. This should be corrected to 8080.
| health_check_port: int | None = Field( | |
| default=None, | |
| description="Port for temporal worker health check endpoint. Defaults to 80 if not specified.", | |
| description="Port for temporal worker health check endpoint. Defaults to 9718 if not specified.", | |
| ) | |
| health_check_port: int | None = Field( | |
| default=None, | |
| description="Port for temporal worker health check endpoint. Defaults to 8080 if not specified.", | |
| ) |
Context Used: Rule from dashboard - Constants should accurately reflect their actual values. If a constant is named 7_DAYS but contain... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agentex/lib/types/agent_configs.py
Line: 56-59
Comment:
**Incorrect default port in description**
The description says "Defaults to 9718 if not specified" but the actual default used by the system is `DEFAULT_HEALTH_CHECK_PORT = 8080` (defined in `src/agentex/lib/constants/ports.py:41` and consumed by `EnvironmentVariables.HEALTH_CHECK_PORT` in `environment_variables.py:81`). Port 9718 doesn't appear anywhere else in the codebase. This should be corrected to `8080`.
```suggestion
health_check_port: int | None = Field(
default=None,
description="Port for temporal worker health check endpoint. Defaults to 8080 if not specified.",
)
```
**Context Used:** Rule from `dashboard` - Constants should accurately reflect their actual values. If a constant is named `7_DAYS` but contain... ([source](https://app.greptile.com/review/custom-context?memory=329791ab-6f7e-4616-9bbc-cb41f96a2d1d))
How can I resolve this? If you propose a fix, please make it concise.309df90 to
72ab207
Compare
Update: Port migration across all filesPushed commit
Files updated:
NoteThe CI workflow files (
These workflow file changes need to be pushed separately with a token that has the |
…guration Migrates AgentEx from generic/common ports to less commonly used ports to avoid conflicts with other services: - AgentEx API: 5003 → 5718 - ACP Server: 8000 → 8718 - Health Check: 80 → 8080 - Multi-agent examples: 8000-8003 → 8718-8721 Adds centralized port defaults in src/agentex/lib/constants/ports.py. All ports remain configurable via environment variables (AGENTEX_BASE_URL, ACP_PORT, HEALTH_CHECK_PORT) and manifest configuration. Updated ~150 files: core SDK, CLI templates, Dockerfiles, manifests, tests, notebooks, READMEs, and example scripts. Note: .github/workflows/*.yml changes excluded (requires workflow scope token). Resolves AGX1-98 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
867674c to
14038c7
Compare
|
Too many files changed for review. ( |
Summary
src/agentex/lib/constants/ports.pyAGENTEX_BASE_URL,ACP_PORT,HEALTH_CHECK_PORT) and manifest configurationTest plan
ruff checkandruff formatpass on modified source filesrye run pytestto verify existing tests pass with new port defaultsagentex agents run --manifest manifest.yamlwith a tutorial to verify local dev worksACP_PORT=9000)Note:
.github/workflows/*.ymlchanges excluded from this PR (requires workflow scope token). The CI workflow already has the updated ports.🤖 Generated with Claude Code