Skip to content

fix(sdk): use ephemeral ports for Parlant servers#341

Open
darvell-thenvoi wants to merge 2 commits into
mainfrom
fix/parlant-port-collision-INT-530
Open

fix(sdk): use ephemeral ports for Parlant servers#341
darvell-thenvoi wants to merge 2 commits into
mainfrom
fix/parlant-port-collision-INT-530

Conversation

@darvell-thenvoi

@darvell-thenvoi darvell-thenvoi commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

What changed

1. Ephemeral ports for the Parlant example servers. All five Parlant examples (01_basic_agent.py05_jerry_agent.py) now start their in-process servers on OS-assigned ports:

async with p.Server(
    port=0,
    tool_service_port=0,
    nlp_service=p.NLPServices.openai,
) as server:
    ...

The README gains a "Running two agents locally (Tom and Jerry)" section documenting the two-terminal invocation.

2. Allow the prerelease opentelemetry-resourcedetector-gcp (CI fix). Declares that transitive package directly with a prerelease specifier in the google_adk and dev extras, plus the regenerated uv.lock.

Why

Ports: Parlant's in-process server binds a fixed default port. Starting a second Parlant agent on the same machine fails when the first still holds the port — e.g. running Tom and Jerry side by side, the second crashes with SystemExit: 1 from uvicorn startup. port=0 / tool_service_port=0 lets the OS pick free ports, so agents run concurrently. (Closes INT-530.)

Dependency: google-adk pulls opentelemetry-exporter-gcp-trace, which only depends on prerelease (alpha) builds of opentelemetry-resourcedetector-gcp. A plain, lockfile-free install excludes prereleases by default, and the sole stable build (1.13.0) was yanked upstream ("breaks imports") — so a fresh resolve of [dev]/[google_adk] has no solution. This surfaced as the packaging CI job's "Install with all extras" step failing (the test jobs pass because they use the pinned uv.lock). It affects real end users of band-sdk[google_adk], not just CI. Declaring the package with a prerelease specifier lets the resolver pick the alpha, matching what the lockfile already used.

Validation

uv run ruff check examples/parlant/*.py
uv run ruff format --check examples/parlant/*.py
uv run python -m py_compile examples/parlant/*.py
uv lock --check
# fresh wheel install, mirroring the packaging CI step:
uv build --wheel && uv pip install "dist/band_sdk-*.whl[dev]"   # resolves: resourcedetector-gcp 1.12.0a0

Notes

Rebuilt on current main. Earlier revisions of this branch carried a large Parlant rewrite plus generic-runner/docs changes; those either landed on main independently or were superseded by main's later Parlant work, so the Parlant change here is scoped to just the ephemeral-port fix.

Closes INT-530

@linear

linear Bot commented Jun 3, 2026

Copy link
Copy Markdown

INT-530

@darvell-thenvoi darvell-thenvoi changed the title Fix Parlant example port collisions Port Parlant validation into Band branch Jun 3, 2026
@darvell-thenvoi darvell-thenvoi changed the title Port Parlant validation into Band branch fix(sdk): port Parlant validation into Band branch Jun 3, 2026
@darvell-thenvoi darvell-thenvoi changed the title fix(sdk): port Parlant validation into Band branch fix(sdk): port Parlant validation and use ephemeral ports Jun 3, 2026
@darvell-thenvoi
darvell-thenvoi marked this pull request as ready for review June 3, 2026 19:41
@darvell-thenvoi darvell-thenvoi changed the title fix(sdk): port Parlant validation and use ephemeral ports fix(sdk): use ephemeral ports for Parlant servers Jun 3, 2026
Base automatically changed from rename-band-sdk-python to dev June 4, 2026 16:24
@darvell-thenvoi
darvell-thenvoi force-pushed the fix/parlant-port-collision-INT-530 branch from c54eb0c to 60f93d3 Compare June 4, 2026 20:47
Base automatically changed from dev to main June 22, 2026 10:58
@amit-gazal-thenvoi
amit-gazal-thenvoi force-pushed the fix/parlant-port-collision-INT-530 branch from 60f93d3 to 5638081 Compare July 23, 2026 13:15
amit-gazal-thenvoi and others added 2 commits July 23, 2026 16:50
Parlant's in-process server binds a fixed default port, so starting a
second Parlant agent on the same machine fails when the first still holds
the port. Pass port=0 and tool_service_port=0 in the example servers so
the OS assigns free ports, letting agents like Tom and Jerry run side by
side. Document the two-terminal multi-agent run in the README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A fresh, lockfile-free install of the google_adk / dev extras fails to
resolve: google-adk pulls opentelemetry-exporter-gcp-trace, which only
depends on prerelease (alpha) builds of opentelemetry-resourcedetector-gcp.
Plain installs exclude prereleases by default, and the sole stable build
(1.13.0) was yanked upstream ("breaks imports"), so there is no solution --
which breaks the packaging CI job's "install with all extras" step.

Declare opentelemetry-resourcedetector-gcp directly with a prerelease
specifier so the resolver may pick the alpha on a plain install, matching
what the lockfile already used.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@amit-gazal-thenvoi
amit-gazal-thenvoi force-pushed the fix/parlant-port-collision-INT-530 branch from 68fc7cb to 3533aff Compare July 23, 2026 13:50
@amit-gazal-thenvoi
amit-gazal-thenvoi requested review from a team and removed request for amit-gazal-thenvoi July 23, 2026 13:54
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.

2 participants