Title: feat(server): TenantRegistry → serve() adapter — as_platform() or callable platform arg · Issue #645 · adcontextprotocol/adcp-client-python · GitHub
Open Graph Title: feat(server): TenantRegistry → serve() adapter — as_platform() or callable platform arg · Issue #645 · adcontextprotocol/adcp-client-python
X Title: feat(server): TenantRegistry → serve() adapter — as_platform() or callable platform arg · Issue #645 · adcontextprotocol/adcp-client-python
Description: Problem TenantRegistry (5.0, #619) gives adopters a great health-tracked, lazy-factory tenant registry. But there's no way to feed it to serve() without writing a per-request adapter: serve(platform: DecisioningPlatform, ...) — takes a s...
Open Graph Description: Problem TenantRegistry (5.0, #619) gives adopters a great health-tracked, lazy-factory tenant registry. But there's no way to feed it to serve() without writing a per-request adapter: serve(platfor...
X Description: Problem TenantRegistry (5.0, #619) gives adopters a great health-tracked, lazy-factory tenant registry. But there's no way to feed it to serve() without writing a per-request adapter: serve(pla...
Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/645
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(server): TenantRegistry → serve() adapter — as_platform() or callable platform arg","articleBody":"## Problem\n\n`TenantRegistry` (5.0, #619) gives adopters a great health-tracked, lazy-factory tenant registry. But there's no way to feed it to `serve()` without writing a per-request adapter:\n\n- `serve(platform: DecisioningPlatform, ...)` — takes a single platform object\n- `TenantRegistry.resolve(host) -> TenantResolution` — returns a typed resolution with `.platform`, `.health`, `.tenant_id`\n\nThe bridge is missing. Adopters who want to compose the two have three options today:\n\n1. **Write a `DecisioningPlatform` subclass** that holds a registry reference and overrides every method to delegate via `registry.resolve(current_host()).platform` — duplicating what `LazyPlatformRouter` already does, plus the health-gating logic.\n2. **Skip the registry**, keep using `LazyPlatformRouter` — loses the health-state observability that's the registry's headline feature.\n3. **Don't adopt 5.0's TenantRegistry**, stay on `LazyPlatformRouter` indefinitely — works but punts the parity goal.\n\nWe hit this in [bokelley/salesagent](https://github.com/bokelley/salesagent) (Sprint 3 of our 5.0 migration) and chose option 2. The deferral note in our migration tracker:\n\n> SDK 5.0 ships TenantRegistry but `serve()` takes a `DecisioningPlatform` not a callable, and `TenantRegistry.resolve(host)` returns a `TenantResolution`, not a platform-conformant object. Adopting would require writing a `DecisioningPlatform` wrapper that delegates `registry.resolve(host).platform` per-request — duplicating `LazyPlatformRouter`'s purpose. Net cost > benefit until SDK ships a `TenantRegistry.as_platform()` adapter or `serve()` accepts a callable.\n\n## JS reference\n\nThe JS `@adcp/sdk` pattern composes naturally because `serve()` takes a resolver callback:\n\n```ts\nserve(ctx => registry.resolveByHost(ctx.host).server, { port })\n```\n\nPython's `serve()` doesn't have an equivalent callback shape, so the same composition needs an explicit adapter on the registry side.\n\n## Proposed shapes (in increasing order of API surface)\n\n**A) `TenantRegistry.as_platform()` — returns a DecisioningPlatform that resolves per-call.**\n\n```python\nregistry = TenantRegistry(validator=None)\nfor tenant in load_tenants():\n await registry.register_lazy(tenant.id, agent_url=..., factory=...)\n\n# Returns a DecisioningPlatform that dispatches each method via\n# registry.resolve(current_host).platform.\u003cmethod>(...). 503s when\n# resolution returns None or health in {\"pending\", \"disabled\"}.\nserve(registry.as_platform(), port=os.environ[\"PORT\"])\n```\n\nCloses the gap with one new public method. The platform proxy holds a registry reference and forwards each `DecisioningPlatform` method through the resolver. Health gating happens inside the proxy — 503 on `pending` / `disabled`, serve on `healthy` / `unverified`.\n\n**B) `serve(platform_resolver=Callable[[RequestContext], DecisioningPlatform], ...)`** — accept a callable as an alternative to a static platform.\n\n```python\ndef resolve(ctx):\n resolution = registry.resolve_by_host(ctx.host)\n if resolution is None or resolution.health in (\"pending\", \"disabled\"):\n raise HTTPException(503)\n return resolution.platform\n\nserve(platform_resolver=resolve, port=...)\n```\n\nMore flexible but more public-API surface. Matches JS more closely.\n\n**C) Both** — `as_platform()` as the easy default + `platform_resolver=` as the escape hatch for adopters with custom health logic.\n\nI'd prefer (A) for our use case: less surface, the health-gating is the headline benefit of TenantRegistry and bundling it into the adapter avoids per-adopter divergence. (B) would address the same case but requires every adopter to reimplement the gating logic.\n\n## Why this blocks adoption (not just an ergonomic gap)\n\nWithout an adapter, the only way to surface TenantRegistry's health states (pending / healthy / unverified / disabled) is to write the gating proxy ourselves — and that proxy IS the integration point with `serve()`. So it's not \"TenantRegistry is hard to compose with serve\" — it's \"TenantRegistry doesn't actually integrate with serve until adopters write the missing piece.\"\n\nThree adopters into the migration this will surface as the same question every time. Filing now to make the fix happen at the SDK layer where the registry already lives.\n\n## Files\n\n- Our deferral analysis: [bokelley/salesagent core/SDK_FEEDBACK.md](https://github.com/bokelley/salesagent/blob/main/core/SDK_FEEDBACK.md) (Sprint 3 entry).\n- Closed parity issue: #619.\n","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-05-11T06:15:28Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/645"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8c6ff3ab-76ba-d840-eb5b-3e01b2c69a05 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA58:172B92:2114472:2C0FAB5:6B0184AC |
| html-safe-nonce | bb62bb4d7ad183d559e7423c434d52174387f8d8e7cfd07b6937dbb414d68cf2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTU4OjE3MkI5MjoyMTE0NDcyOjJDMEZBQjU6NkIwMTg0QUMiLCJ2aXNpdG9yX2lkIjoiNzEzMTY0ODY0MTA4ODk4MDE0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6daa349bf0720e211653ab97afc871eb65c59184fb7444b89085cbaf480e4168 |
| hovercard-subject-tag | issue:4418488759 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/adcontextprotocol/adcp-client-python/645/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5dc052f6eb05e22565d45c288e1765739abe071495e15d3bfc42b17688368a74/adcontextprotocol/adcp-client-python/issues/645 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5dc052f6eb05e22565d45c288e1765739abe071495e15d3bfc42b17688368a74/adcontextprotocol/adcp-client-python/issues/645 |
| og:image:alt | Problem TenantRegistry (5.0, #619) gives adopters a great health-tracked, lazy-factory tenant registry. But there's no way to feed it to serve() without writing a per-request adapter: serve(platfor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bokelley |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/adcontextprotocol/adcp-client-python git https://github.com/adcontextprotocol/adcp-client-python.git |
| octolytics-dimension-user_id | 221690821 |
| octolytics-dimension-user_login | adcontextprotocol |
| octolytics-dimension-repository_id | 1090305973 |
| octolytics-dimension-repository_nwo | adcontextprotocol/adcp-client-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1090305973 |
| octolytics-dimension-repository_network_root_nwo | adcontextprotocol/adcp-client-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width