Skip to content

feat: add get_media_buys task for operational campaign monitoring - #1162

Merged
bokelley merged 8 commits into
mainfrom
bokelley/get-media-buys-tool
Feb 22, 2026
Merged

bokelley merged 8 commits into
mainfrom
bokelley/get-media-buys-tool

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

  • Adds get_media_buys task: a fast (~1s) way to inspect the current state of media buys — creative approval status, missing assets, and optional near-real-time delivery snapshots
  • Fills the gap between create_media_buy (which creates campaigns) and get_media_buy_delivery (which runs batch reports with 4+ hour latency)
  • Adds creative-approval-status enum for reuse in future webhook/sync schemas

Design decisions

  • include_snapshot: false by default — sellers only hit entity-level platform APIs when asked
  • staleness_seconds on each snapshot tells consumers how stale the data is (e.g., 900 for GAM entity stats, 14400 for batch-only platforms), enabling correct interpretation of zero delivery
  • not_delivering delivery status means "within flight, zero impressions for at least one staleness cycle" — not returned during warm-up; consumers should check start_time before acting
  • format_ids_pending at package level surfaces exactly which formats still need sync_creatives
  • creative_approvals at package level (not media buy level) because same creative can have different approval state on different packages
  • Platforms that don't support snapshots omit the snapshot field rather than returning an error

Changes

  • static/schemas/source/media-buy/get-media-buys-request.json — new request schema
  • static/schemas/source/media-buy/get-media-buys-response.json — new response schema
  • static/schemas/source/enums/creative-approval-status.json — new enum
  • docs/media-buy/task-reference/get_media_buys.mdx — new task reference page
  • static/schemas/source/index.json — schema registry entries
  • docs.json — nav entries (both current-docs sections)
  • docs/media-buy/task-reference/index.mdx — overview table and section entries
  • .changeset/get-media-buys-task.md — minor changeset

Closes #1160

🤖 Generated with Claude Code

bokelley and others added 3 commits February 22, 2026 11:46
Adds get_media_buys tool to fill the gap between create_media_buy and
get_media_buy_delivery. Agents need a fast way to check creative approval
status, missing assets, and near-real-time delivery without spinning up
a full batch reporting job.

Key design decisions:
- include_snapshot boolean (default false) gates near-real-time delivery
  stats; staleness_seconds tells consumers how fresh the data is
- not_delivering status on snapshots signals zero delivery after a full
  staleness cycle, enabling automated price optimization loops
- format_ids_pending surfaces missing uploads per package
- creative_approvals per package (not per media buy) since approval state
  can differ across packages
- New creative-approval-status enum for reuse in future webhook schemas
- start_time/end_time on packages so agents can confirm flight is active
  before acting on not_delivering

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
The test agent does not yet respond to get_media_buys, and @adcp/client
has no getMediaBuys() method or GetMediaBuysResponseSchema. Setting
testable: false until both server and client are updated.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Comment thread docs/media-buy/task-reference/index.mdx Resolved
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.

Add get_media_buy_snapshot for low-latency delivery stats

2 participants