Title: feat(decisioning): time_budget deadline wrapper + incomplete projection on get_products · Issue #495 · adcontextprotocol/adcp-client-python · GitHub
Open Graph Title: feat(decisioning): time_budget deadline wrapper + incomplete projection on get_products · Issue #495 · adcontextprotocol/adcp-client-python
X Title: feat(decisioning): time_budget deadline wrapper + incomplete projection on get_products · Issue #495 · adcontextprotocol/adcp-client-python
Description: Motivation GetProductsRequest.time_budget is {interval: int, unit: 'seconds'|'minutes'|'hours'|'days'|'campaign'}. The wire description: "the seller returns the best results achievable within this budget and does not start processes (hum...
Open Graph Description: Motivation GetProductsRequest.time_budget is {interval: int, unit: 'seconds'|'minutes'|'hours'|'days'|'campaign'}. The wire description: "the seller returns the best results achievable within this ...
X Description: Motivation GetProductsRequest.time_budget is {interval: int, unit: 'seconds'|'minutes'|'hours'|'days'|'campaign'}. The wire description: "the seller ret...
Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/495
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(decisioning): time_budget deadline wrapper + incomplete projection on get_products","articleBody":"## Motivation\n\n`GetProductsRequest.time_budget` is `{interval: int, unit: 'seconds'|'minutes'|'hours'|'days'|'campaign'}`. The wire description: *\\\"the seller returns the best results achievable within this budget and does not start processes (human approvals, expensive external queries) that cannot complete in time.\\\"* The response carries `incomplete[]` with per-scope `estimated_wait` so the buyer can decide whether to retry with a larger budget.\n\nEvery adopter that takes `time_budget` seriously needs to (1) install a deadline, (2) cancel in-flight work when the deadline expires, (3) project the unfinished scopes to the wire `incomplete[]` shape. None of that is business logic — it's protocol plumbing that's identical for every seller.\n\nParent tracker: #491.\n\n## Current state\n\n**Salesagent**: does not honor `time_budget` at all. Grep of `src/core/tools/products.py` shows zero references. The seller can run unbounded.\n\n**SDK**: no deadline wrapper. `MediaBuyHandler.get_products` runs the adopter to completion regardless. Wire shape lives at `src/adcp/types/generated_poc/bundled/media_buy/get_products_request.py:1235-1244` (`TimeBudget`); response `incomplete` at `src/adcp/types/generated_poc/bundled/media_buy/get_products_response.py:2786-2804` (`IncompleteItem`).\n\n## Proposed API\n\nFramework wraps the adapter call in `asyncio.wait_for`, catches `TimeoutError`, projects whatever the adopter has produced so far via a checkpoint protocol:\n\n```python\n# src/adcp/decisioning/time_budget.py (new)\n\nclass IncrementalGetProducts(Protocol):\n \\\"\\\"\\\"Optional protocol — when the adopter implements it, the framework\n can project partial results on time-budget exhaustion. When the\n adopter only implements plain get_products (returns the full\n response), framework cancels and returns a single\n incomplete[{scope: 'products', description: 'time_budget exhausted'}]\n with no products.\\\"\\\"\\\"\n\n async def get_products_incremental(\n self, req: GetProductsRequest, ctx: RequestContext, checkpoint: Checkpoint\n ) -> AsyncIterator[ProductsBatch]:\n ...\n\n\n# In handler.get_products:\ndeadline = _resolve_time_budget(params.time_budget) # → seconds float\ntry:\n response = await asyncio.wait_for(\n _invoke_platform_method(...), timeout=deadline,\n )\nexcept asyncio.TimeoutError:\n response = _project_partial_or_empty(checkpoint, deadline)\nreturn response\n```\n\n## Acceptance criteria\n\n- [ ] `_resolve_time_budget` converts every wire unit (`seconds`/`minutes`/`hours`/`days`/`campaign`) to a deadline; `'campaign'` → no deadline (matches wire description)\n- [ ] When deadline exhausted and adopter is plain (non-incremental), response has `products: []`, `incomplete: [{scope: 'products', description: '...', estimated_wait: ...}]`\n- [ ] When adopter implements `IncrementalGetProducts`, framework returns whatever batches landed before timeout, plus `incomplete[]` for the rest\n- [ ] `estimated_wait` populated from a hint protocol the adopter supplies (or omitted if no hint)\n- [ ] Test: `time_budget={interval: 1, unit: 'seconds'}` against a 10s adapter returns the timeout shape\n- [ ] Test: adopter that returns within budget passes through unchanged (no `incomplete`)\n- [ ] Test: `time_budget` absent → no deadline, no projection\n- [ ] Wire-validates: `incomplete[].scope` uses spec enum (`products`, `pricing`, `forecast`, `proposals`)\n\n## Out of scope\n\n- Per-scope deadlines (wire spec is request-level only)\n- HITL/approval-aware deadline (`refine` with `action='finalize'` explicitly says buyer should NOT set time_budget)\n- Cancellation propagation to upstream adapter calls — adopter responsibility unless framework owns the executor\n- Applying the same wrapper to other tools (open question — see below)\n\n## Cross-references\n\n- Wire request: `src/adcp/types/generated_poc/bundled/media_buy/get_products_request.py:1235-1244`, `1599-1604`\n- Wire response: `src/adcp/types/generated_poc/bundled/media_buy/get_products_response.py:2786-2826`\n- Reference pattern: `src/adcp/decisioning/webhook_emit.py`\n- Parent tracker: #491\n- Migration guide: #489\n\n## Open question (for the implementer, not blocking)\n\n`time_budget` is a request-shape parameter on more than just `get_products` — it also appears on `request_proposal` and likely others. Implement first against `get_products`; generalize when a second tool adopts the same wire shape.","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-05-03T21:07:23Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/495"}
| 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:f3bd8d61-5695-1ba2-7735-274479976c5c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B158:1CEA6F:EE6CD9:13BEB5C:6B010213 |
| html-safe-nonce | b3133b21835c6624d066bf8c78625e0bba22743f9c54534495fe66b9c2faa28f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTU4OjFDRUE2RjpFRTZDRDk6MTNCRUI1Qzo2QjAxMDIxMyIsInZpc2l0b3JfaWQiOiIzMTUzNjIxNDY4Nzg1NDc2MTE1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9971d651c68da7de6a67ba35adf49a47a9c8b9c2c5cfc36124d9b996a5da011b |
| hovercard-subject-tag | issue:4372988214 |
| 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/495/issue_layout |
| twitter:image | https://opengraph.githubassets.com/88abed02cc127a114d66800f1947c0deea7a292de721dcaa8f96ba9956ca29ff/adcontextprotocol/adcp-client-python/issues/495 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/88abed02cc127a114d66800f1947c0deea7a292de721dcaa8f96ba9956ca29ff/adcontextprotocol/adcp-client-python/issues/495 |
| og:image:alt | Motivation GetProductsRequest.time_budget is {interval: int, unit: 'seconds'|'minutes'|'hours'|'days'|'campaign'}. The wire description: "the seller returns the best results achievable within this ... |
| 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 | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width