Skip to content

Codex sandbox task: agentkit-sdk-python - #2

Open
xgtcode wants to merge 1 commit into
mainfrom
codex/sandbox-poc-20260812t131048
Open

Codex sandbox task: agentkit-sdk-python#2
xgtcode wants to merge 1 commit into
mainfrom
codex/sandbox-poc-20260812t131048

Conversation

@xgtcode

@xgtcode xgtcode commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

Fix AgentkitAgentServerApp not supporting a custom public URL for the AgentCard.

Problem

AgentkitAgentServerApp called to_a2a(agent=root_agent, runner=runner) without passing host, port, or protocol, so the AgentCard url (served at /.well-known/agent-card) was always hardcoded to http://localhost:8000 — even when the server was deployed behind a reverse proxy or on a different host/port.

Solution

  • Add an optional public_url: str | None = None keyword argument to AgentkitAgentServerApp.__init__.
  • When provided, the URL is parsed via urllib.parse.urlparse into protocol, host, and port (defaulting to 443 for https / 80 for http when no explicit port is given) and forwarded to to_a2a.
  • When None (default), behaviour is unchanged — full backward compatibility.
  • Validates that the URL contains a scheme and hostname, raising ValueError otherwise.

Tests

Added tests/apps/test_agent_server_public_url.py with 6 test cases:

  • Default (no public_url) → http://localhost:8000
  • Custom https with port → https://agent.example.com:8443
  • Custom http without port → http://agent.example.com:80
  • Custom https without port → https://agent.example.com:443
  • Missing scheme raises ValueError
  • Missing hostname raises ValueError

All 199 tests in tests/apps pass.

Changed files

  • agentkit/apps/agent_server_app/agent_server_app.py — added public_url param
  • tests/apps/test_agent_server_public_url.py — new test file

@xgtcode
xgtcode force-pushed the codex/sandbox-poc-20260812t131048 branch from b60ee07 to ae6f672 Compare August 12, 2026 13:34
Add an optional public_url keyword argument to AgentkitAgentServerApp.__init__.
When provided, the URL is parsed via urllib.parse.urlparse into protocol, host,
and port (defaulting to 443 for https / 80 for http when no explicit port is
given) and forwarded to to_a2a. When None (default), behaviour is unchanged.

Added tests/apps/test_agent_server_public_url.py with 6 test cases covering
default behaviour, custom URLs with/without ports, and validation errors.
@xgtcode
xgtcode force-pushed the codex/sandbox-poc-20260812t131048 branch from ae6f672 to 5169246 Compare August 12, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant