@adcp/client 4.21.0 → 4.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/AGENTS.md +278 -0
  2. package/README.md +96 -61
  3. package/bin/adcp.js +342 -4
  4. package/dist/lib/agents/index.generated.d.ts +9 -1
  5. package/dist/lib/agents/index.generated.d.ts.map +1 -1
  6. package/dist/lib/agents/index.generated.js +12 -0
  7. package/dist/lib/agents/index.generated.js.map +1 -1
  8. package/dist/lib/core/AgentClient.d.ts.map +1 -1
  9. package/dist/lib/core/SingleAgentClient.d.ts +2 -1
  10. package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
  11. package/dist/lib/core/SingleAgentClient.js +10 -1
  12. package/dist/lib/core/SingleAgentClient.js.map +1 -1
  13. package/dist/lib/discovery/property-crawler.d.ts +4 -0
  14. package/dist/lib/discovery/property-crawler.d.ts.map +1 -1
  15. package/dist/lib/discovery/property-crawler.js +10 -2
  16. package/dist/lib/discovery/property-crawler.js.map +1 -1
  17. package/dist/lib/index.d.ts +4 -4
  18. package/dist/lib/index.d.ts.map +1 -1
  19. package/dist/lib/index.js +6 -4
  20. package/dist/lib/index.js.map +1 -1
  21. package/dist/lib/protocols/index.d.ts.map +1 -1
  22. package/dist/lib/protocols/index.js +8 -6
  23. package/dist/lib/protocols/index.js.map +1 -1
  24. package/dist/lib/protocols/mcp.d.ts.map +1 -1
  25. package/dist/lib/protocols/mcp.js +24 -11
  26. package/dist/lib/protocols/mcp.js.map +1 -1
  27. package/dist/lib/server/index.d.ts +2 -0
  28. package/dist/lib/server/index.d.ts.map +1 -1
  29. package/dist/lib/server/index.js +3 -1
  30. package/dist/lib/server/index.js.map +1 -1
  31. package/dist/lib/server/serve.d.ts +73 -0
  32. package/dist/lib/server/serve.d.ts.map +1 -0
  33. package/dist/lib/server/serve.js +94 -0
  34. package/dist/lib/server/serve.js.map +1 -0
  35. package/dist/lib/testing/client.d.ts.map +1 -1
  36. package/dist/lib/testing/client.js +1 -0
  37. package/dist/lib/testing/client.js.map +1 -1
  38. package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
  39. package/dist/lib/testing/compliance/comply.js +48 -63
  40. package/dist/lib/testing/compliance/comply.js.map +1 -1
  41. package/dist/lib/testing/compliance/storyboard-tracks.d.ts +24 -0
  42. package/dist/lib/testing/compliance/storyboard-tracks.d.ts.map +1 -0
  43. package/dist/lib/testing/compliance/storyboard-tracks.js +157 -0
  44. package/dist/lib/testing/compliance/storyboard-tracks.js.map +1 -0
  45. package/dist/lib/testing/compliance/types.d.ts +1 -1
  46. package/dist/lib/testing/compliance/types.d.ts.map +1 -1
  47. package/dist/lib/testing/index.d.ts +1 -0
  48. package/dist/lib/testing/index.d.ts.map +1 -1
  49. package/dist/lib/testing/index.js +23 -1
  50. package/dist/lib/testing/index.js.map +1 -1
  51. package/dist/lib/testing/orchestrator.d.ts +8 -0
  52. package/dist/lib/testing/orchestrator.d.ts.map +1 -1
  53. package/dist/lib/testing/orchestrator.js +8 -0
  54. package/dist/lib/testing/orchestrator.js.map +1 -1
  55. package/dist/lib/testing/storyboard/context.d.ts +34 -0
  56. package/dist/lib/testing/storyboard/context.d.ts.map +1 -0
  57. package/dist/lib/testing/storyboard/context.js +257 -0
  58. package/dist/lib/testing/storyboard/context.js.map +1 -0
  59. package/dist/lib/testing/storyboard/index.d.ts +15 -0
  60. package/dist/lib/testing/storyboard/index.d.ts.map +1 -0
  61. package/dist/lib/testing/storyboard/index.js +48 -0
  62. package/dist/lib/testing/storyboard/index.js.map +1 -0
  63. package/dist/lib/testing/storyboard/loader.d.ts +53 -0
  64. package/dist/lib/testing/storyboard/loader.d.ts.map +1 -0
  65. package/dist/lib/testing/storyboard/loader.js +114 -0
  66. package/dist/lib/testing/storyboard/loader.js.map +1 -0
  67. package/dist/lib/testing/storyboard/path.d.ts +29 -0
  68. package/dist/lib/testing/storyboard/path.d.ts.map +1 -0
  69. package/dist/lib/testing/storyboard/path.js +121 -0
  70. package/dist/lib/testing/storyboard/path.js.map +1 -0
  71. package/dist/lib/testing/storyboard/request-builder.d.ts +28 -0
  72. package/dist/lib/testing/storyboard/request-builder.d.ts.map +1 -0
  73. package/dist/lib/testing/storyboard/request-builder.js +410 -0
  74. package/dist/lib/testing/storyboard/request-builder.js.map +1 -0
  75. package/dist/lib/testing/storyboard/runner.d.ts +24 -0
  76. package/dist/lib/testing/storyboard/runner.d.ts.map +1 -0
  77. package/dist/lib/testing/storyboard/runner.js +280 -0
  78. package/dist/lib/testing/storyboard/runner.js.map +1 -0
  79. package/dist/lib/testing/storyboard/task-map.d.ts +21 -0
  80. package/dist/lib/testing/storyboard/task-map.d.ts.map +1 -0
  81. package/dist/lib/testing/storyboard/task-map.js +84 -0
  82. package/dist/lib/testing/storyboard/task-map.js.map +1 -0
  83. package/dist/lib/testing/storyboard/types.d.ts +156 -0
  84. package/dist/lib/testing/storyboard/types.d.ts.map +1 -0
  85. package/dist/lib/testing/storyboard/types.js +10 -0
  86. package/dist/lib/testing/storyboard/types.js.map +1 -0
  87. package/dist/lib/testing/storyboard/validations.d.ts +17 -0
  88. package/dist/lib/testing/storyboard/validations.d.ts.map +1 -0
  89. package/dist/lib/testing/storyboard/validations.js +166 -0
  90. package/dist/lib/testing/storyboard/validations.js.map +1 -0
  91. package/dist/lib/testing/types.d.ts +2 -0
  92. package/dist/lib/testing/types.d.ts.map +1 -1
  93. package/dist/lib/types/core.generated.d.ts +2 -2
  94. package/dist/lib/types/core.generated.d.ts.map +1 -1
  95. package/dist/lib/types/core.generated.js +1 -1
  96. package/dist/lib/types/schemas.generated.d.ts +193 -34
  97. package/dist/lib/types/schemas.generated.d.ts.map +1 -1
  98. package/dist/lib/types/schemas.generated.js +87 -5
  99. package/dist/lib/types/schemas.generated.js.map +1 -1
  100. package/dist/lib/types/tools.generated.d.ts +280 -3
  101. package/dist/lib/types/tools.generated.d.ts.map +1 -1
  102. package/dist/lib/utils/response-schemas.d.ts.map +1 -1
  103. package/dist/lib/utils/response-schemas.js +34 -3
  104. package/dist/lib/utils/response-schemas.js.map +1 -1
  105. package/dist/lib/utils/validate-user-agent.d.ts +8 -0
  106. package/dist/lib/utils/validate-user-agent.d.ts.map +1 -0
  107. package/dist/lib/utils/validate-user-agent.js +15 -0
  108. package/dist/lib/utils/validate-user-agent.js.map +1 -0
  109. package/dist/lib/version.d.ts +6 -0
  110. package/dist/lib/version.d.ts.map +1 -1
  111. package/dist/lib/version.js +7 -1
  112. package/dist/lib/version.js.map +1 -1
  113. package/docs/README.md +42 -0
  114. package/docs/guides/BUILD-AN-AGENT.md +294 -0
  115. package/docs/llms.txt +634 -0
  116. package/examples/README.md +106 -0
  117. package/examples/adcp.config.json +30 -0
  118. package/examples/basic-a2a.ts +76 -0
  119. package/examples/basic-mcp.ts +50 -0
  120. package/examples/batch-preview-test.ts +266 -0
  121. package/examples/conversation-client.ts +291 -0
  122. package/examples/debug-preview-response.ts +73 -0
  123. package/examples/debug-preview-with-logging.ts +50 -0
  124. package/examples/easy-config-demo.ts +242 -0
  125. package/examples/env-config.ts +51 -0
  126. package/examples/error-compliant-server.ts +237 -0
  127. package/examples/generative-creative-demo.ts +205 -0
  128. package/examples/inspect-card-formats.ts +161 -0
  129. package/examples/logger-usage.ts +165 -0
  130. package/examples/oauth-cli-example.ts +154 -0
  131. package/examples/pr78-async-patterns-demo.ts +247 -0
  132. package/examples/signals-agent.ts +163 -0
  133. package/examples/simple-getting-started.ts +225 -0
  134. package/examples/simple-protocol-demo.ts +75 -0
  135. package/examples/test-helpers-demo.ts +239 -0
  136. package/examples/zod-validation-example.ts +126 -0
  137. package/package.json +12 -2
  138. package/skills/adcp/SKILL.md +13 -2
  139. package/storyboards/audience_sync.yaml +199 -0
  140. package/storyboards/behavioral_analysis.yaml +244 -0
  141. package/storyboards/brand_rights.yaml +131 -0
  142. package/storyboards/creative_ad_server.yaml +171 -0
  143. package/storyboards/creative_sales_agent.yaml +169 -0
  144. package/storyboards/creative_template.yaml +306 -0
  145. package/storyboards/deterministic_testing.yaml +925 -0
  146. package/storyboards/error_compliance.yaml +231 -0
  147. package/storyboards/governance_content_standards.yaml +213 -0
  148. package/storyboards/governance_property_lists.yaml +372 -0
  149. package/storyboards/media_buy_catalog_creative.yaml +457 -0
  150. package/storyboards/media_buy_governance_escalation.yaml +467 -0
  151. package/storyboards/media_buy_guaranteed_approval.yaml +396 -0
  152. package/storyboards/media_buy_non_guaranteed.yaml +288 -0
  153. package/storyboards/media_buy_proposal_mode.yaml +369 -0
  154. package/storyboards/media_buy_seller.yaml +560 -0
  155. package/storyboards/media_buy_state_machine.yaml +254 -0
  156. package/storyboards/schema.yaml +65 -0
  157. package/storyboards/schema_validation.yaml +166 -0
  158. package/storyboards/si_session.yaml +384 -0
  159. package/storyboards/signal_marketplace.yaml +283 -0
  160. package/storyboards/signal_owned.yaml +211 -0
@@ -0,0 +1,467 @@
1
+ id: media_buy_governance_escalation
2
+ version: "1.0.0"
3
+ title: "Governance denial and human escalation"
4
+ category: media_buy_governance_escalation
5
+ summary: "Buyer's governance agent denies a media buy that exceeds spending authority, escalates to a human who approves with conditions."
6
+ platform_types:
7
+ - dsp
8
+ - ai_ad_network
9
+ - generative_dsp
10
+
11
+ track: campaign_governance
12
+ required_tools:
13
+ - sync_plans
14
+ narrative: |
15
+ The buyer's governance agent denies a media buy because it exceeds the agent's spending
16
+ authority. The governance check escalates to a human reviewer who approves with conditions.
17
+
18
+ This storyboard shows the full governance loop: plan registration with spending authority
19
+ limits, product discovery, pre-buy governance check that gets denied, human escalation
20
+ that results in conditional approval, media buy creation with the approved governance
21
+ context, outcome reporting, and a complete audit trail.
22
+
23
+ Governance exists to ensure that automated agents operate within defined boundaries. When
24
+ those boundaries are exceeded, the system escalates to humans rather than blocking
25
+ entirely. The audit trail provides accountability for every decision in the chain.
26
+
27
+ agent:
28
+ interaction_model: media_buy_seller
29
+ capabilities:
30
+ - sells_media
31
+ - governance_aware
32
+ examples:
33
+ - "Publisher platform integrated with buyer governance"
34
+ - "SSP that respects governance checks"
35
+ - "Retail media network with governance support"
36
+
37
+ caller:
38
+ role: buyer_agent
39
+ example: "Pinnacle Agency (buyer)"
40
+
41
+ prerequisites:
42
+ description: |
43
+ The caller needs a brand identity, operator credentials, and a governance agent
44
+ URL. The test kit provides a sample brand (Acme Outdoor) with campaign parameters
45
+ and a governance configuration with spending authority limits.
46
+ test_kit: "test-kits/acme-outdoor.yaml"
47
+
48
+ phases:
49
+ - id: account_setup
50
+ title: "Account and governance setup"
51
+ narrative: |
52
+ The buyer establishes an account and registers their governance agent with the
53
+ seller. The governance agent will be called before media buys are confirmed to
54
+ validate spending authority, brand safety, and compliance.
55
+
56
+ steps:
57
+ - id: sync_accounts
58
+ title: "Establish account relationship"
59
+ narrative: |
60
+ The buyer registers their brand and operator with your platform.
61
+ task: sync_accounts
62
+ schema_ref: "account/sync-accounts-request.json"
63
+ response_schema_ref: "account/sync-accounts-response.json"
64
+ doc_ref: "/accounts/tasks/sync_accounts"
65
+ stateful: true
66
+ expected: |
67
+ Return the account with:
68
+ - account_id: your platform's identifier
69
+ - action: created or updated
70
+ - status: active or pending_approval
71
+
72
+ sample_request:
73
+ accounts:
74
+ - brand:
75
+ domain: "acmeoutdoor.com"
76
+ operator: "pinnacle-agency.com"
77
+ billing: "operator"
78
+ payment_terms: "net_30"
79
+
80
+ validations:
81
+ - check: response_schema
82
+ description: "Response matches sync-accounts-response.json schema"
83
+ - check: field_present
84
+ path: "accounts[0].account_id"
85
+ description: "Account has a platform-assigned ID"
86
+
87
+ - id: sync_governance
88
+ title: "Register governance agent"
89
+ narrative: |
90
+ The buyer tells your platform: "Before you confirm any media buy for this
91
+ account, call this governance agent to validate it." Your platform stores
92
+ the governance agent URL and will call it during create_media_buy.
93
+ task: sync_governance
94
+ schema_ref: "account/sync-governance-request.json"
95
+ response_schema_ref: "account/sync-governance-response.json"
96
+ doc_ref: "/accounts/tasks/sync_governance"
97
+ stateful: true
98
+ expected: |
99
+ Acknowledge the governance agents. Your platform should:
100
+ - Store the governance agent URLs for the specified accounts
101
+ - Return confirmation that agents were registered
102
+ - Use these agents during create_media_buy validation
103
+
104
+ sample_request:
105
+ accounts:
106
+ - account:
107
+ brand:
108
+ domain: "acmeoutdoor.com"
109
+ operator: "pinnacle-agency.com"
110
+ governance_agents:
111
+ - url: "https://governance.pinnacle-agency.example"
112
+ authentication:
113
+ schemes: ["Bearer"]
114
+ credentials: "gov-token-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
115
+ categories: ["budget_authority", "brand_policy"]
116
+
117
+ validations:
118
+ - check: response_schema
119
+ description: "Response matches sync-governance-response.json schema"
120
+
121
+ - id: register_plan
122
+ title: "Register governance plan with spending limits"
123
+ narrative: |
124
+ The buyer registers a governance plan that defines the agent's spending authority.
125
+ The plan sets a per-transaction threshold below the intended media buy amount.
126
+ This ensures the governance check will trigger an escalation when the buy exceeds
127
+ the agent's authority.
128
+
129
+ steps:
130
+ - id: sync_plans
131
+ title: "Register a governance plan with agent-limited authority"
132
+ narrative: |
133
+ The buyer's governance agent registers a plan with spending authority limits.
134
+ The authority_level is agent_limited with a per-transaction threshold of $20K.
135
+ Any media buy above this amount requires human approval.
136
+ task: sync_plans
137
+ schema_ref: "governance/sync-plans-request.json"
138
+ response_schema_ref: "governance/sync-plans-response.json"
139
+ doc_ref: "/governance/campaign/tasks/sync_plans"
140
+ stateful: true
141
+ expected: |
142
+ Acknowledge the governance plan:
143
+ - plan_id: identifier for this governance plan
144
+ - authority_level: agent_limited
145
+ - per_transaction_threshold: the spending limit before escalation
146
+ - escalation_path: how over-limit transactions are handled
147
+
148
+ sample_request:
149
+ plans:
150
+ - plan_name: "Acme Outdoor Q2 Governance"
151
+ brand:
152
+ domain: "acmeoutdoor.com"
153
+ operator: "pinnacle-agency.com"
154
+ authority_level: "agent_limited"
155
+ per_transaction_threshold: 20000
156
+ escalation_path: "human_review"
157
+ conditions:
158
+ - "Weekly reporting required for buys over $10K"
159
+ - "No single-seller concentration above 60% of total budget"
160
+
161
+ validations:
162
+ - check: response_schema
163
+ description: "Response matches sync-plans-response.json schema"
164
+
165
+ - id: discover_products
166
+ title: "Product discovery"
167
+ narrative: |
168
+ The buyer sends a brief to discover products. The products returned will exceed
169
+ the governance agent's spending authority when assembled into a media buy.
170
+
171
+ steps:
172
+ - id: get_products_brief
173
+ title: "Send a brief"
174
+ narrative: |
175
+ The buyer describes what they want. Your platform returns products with
176
+ pricing that, when combined, will exceed the $20K per-transaction threshold
177
+ set in the governance plan.
178
+ task: get_products
179
+ schema_ref: "media-buy/get-products-request.json"
180
+ response_schema_ref: "media-buy/get-products-response.json"
181
+ doc_ref: "/media-buy/task-reference/get_products"
182
+ stateful: false
183
+ expected: |
184
+ Return products matching the brief with pricing that totals above $20K:
185
+ - product_id, name, description
186
+ - delivery_type: guaranteed or non_guaranteed
187
+ - pricing_models with CPM and budget recommendations
188
+ - forecast: estimated delivery
189
+
190
+ sample_request:
191
+ buying_mode: "brief"
192
+ brief: "Premium CTV and video on sports publishers. Q2 flight, $50K budget. Adults 25-54, US."
193
+ brand:
194
+ domain: "acmeoutdoor.com"
195
+ account:
196
+ brand:
197
+ domain: "acmeoutdoor.com"
198
+ operator: "pinnacle-agency.com"
199
+
200
+ validations:
201
+ - check: response_schema
202
+ description: "Response matches get-products-response.json schema"
203
+ - check: field_present
204
+ path: "products"
205
+ description: "Response contains a products array"
206
+
207
+ - id: governance_check_denied
208
+ title: "Governance check — denied"
209
+ narrative: |
210
+ Before creating the media buy, the buyer's governance agent runs a pre-buy check.
211
+ The proposed buy totals $50K, which exceeds the agent's $20K per-transaction
212
+ authority. The governance agent denies the buy with a must-severity finding and
213
+ returns escalation instructions for human review.
214
+
215
+ steps:
216
+ - id: check_governance_denied
217
+ title: "Pre-buy governance check (denied)"
218
+ narrative: |
219
+ The buyer calls check_governance with the proposed media buy binding. The
220
+ governance agent evaluates the buy against the registered plan and finds that
221
+ the total exceeds the agent's spending authority. The check returns denied
222
+ with a must-severity finding and instructions for escalating to a human.
223
+ task: check_governance
224
+ schema_ref: "governance/check-governance-request.json"
225
+ response_schema_ref: "governance/check-governance-response.json"
226
+ doc_ref: "/governance/campaign/tasks/check_governance"
227
+ stateful: true
228
+ expected: |
229
+ Return a denied governance decision:
230
+ - decision: denied
231
+ - findings: array with at least one must-severity finding
232
+ - severity: must
233
+ - code: SPENDING_AUTHORITY_EXCEEDED
234
+ - message: explains the agent's authority limit and how much the buy exceeds it
235
+ - escalation: instructions for human review
236
+ - governance_context: token/ID the buyer passes to the next check after escalation
237
+ - plan_id: the governance plan that triggered the denial
238
+
239
+ sample_request:
240
+ plan_id: "gov_acme_q2_2026"
241
+ binding:
242
+ type: "media_buy"
243
+ account:
244
+ brand:
245
+ domain: "acmeoutdoor.com"
246
+ operator: "pinnacle-agency.com"
247
+ total_budget: 50000
248
+ packages:
249
+ - product_id: "sports_ctv_q2"
250
+ budget: 30000
251
+ - product_id: "outdoor_video_q2"
252
+ budget: 20000
253
+
254
+ validations:
255
+ - check: response_schema
256
+ description: "Response matches check-governance-response.json schema"
257
+ - check: field_present
258
+ path: "decision"
259
+ description: "Response contains a governance decision"
260
+ - check: field_present
261
+ path: "findings"
262
+ description: "Response contains findings explaining the denial"
263
+
264
+ - id: human_escalation
265
+ title: "Human escalation — conditional approval"
266
+ narrative: |
267
+ The governance denial triggers human escalation. A human reviewer at the agency
268
+ reviews the proposed buy, the denial reason, and the governance plan. The human
269
+ approves the buy with conditions — for example, requiring weekly reporting. The
270
+ buyer calls check_governance again with the human's approval, and this time
271
+ the check returns approved with conditions.
272
+
273
+ steps:
274
+ - id: check_governance_approved
275
+ title: "Re-check governance after human approval (approved with conditions)"
276
+ narrative: |
277
+ After the human reviewer approves the buy, the buyer calls check_governance
278
+ again with the governance_context from the prior denial and the human's
279
+ approval. The governance agent returns approved with conditions that the
280
+ buyer must honor during the campaign.
281
+ task: check_governance
282
+ schema_ref: "governance/check-governance-request.json"
283
+ response_schema_ref: "governance/check-governance-response.json"
284
+ doc_ref: "/governance/campaign/tasks/check_governance"
285
+ stateful: true
286
+ expected: |
287
+ Return an approved governance decision with conditions:
288
+ - decision: approved
289
+ - conditions: array of requirements the buyer must honor
290
+ - e.g., "Weekly delivery reporting required"
291
+ - e.g., "Human review required for any budget increase"
292
+ - governance_context: updated token the buyer passes to create_media_buy
293
+ - approved_by: identifier of the human who approved
294
+ - approved_at: timestamp of approval
295
+
296
+ sample_request:
297
+ plan_id: "gov_acme_q2_2026"
298
+ governance_context: "gov_ctx_acme_q2_escalated"
299
+ binding:
300
+ type: "media_buy"
301
+ account:
302
+ brand:
303
+ domain: "acmeoutdoor.com"
304
+ operator: "pinnacle-agency.com"
305
+ total_budget: 50000
306
+ packages:
307
+ - product_id: "sports_ctv_q2"
308
+ budget: 30000
309
+ - product_id: "outdoor_video_q2"
310
+ budget: 20000
311
+ human_approval:
312
+ approved_by: "jsmith@pinnacle-agency.com"
313
+ approved_at: "2026-04-03T14:22:00Z"
314
+ conditions:
315
+ - "Weekly delivery reporting required"
316
+ - "Human review required for any budget increase above 10%"
317
+
318
+ validations:
319
+ - check: response_schema
320
+ description: "Response matches check-governance-response.json schema"
321
+ - check: field_present
322
+ path: "decision"
323
+ description: "Response contains an approved governance decision"
324
+ - check: field_present
325
+ path: "conditions"
326
+ description: "Approval includes conditions"
327
+
328
+ - id: create_buy_with_governance
329
+ title: "Create media buy with governance context"
330
+ narrative: |
331
+ The buyer creates the media buy, passing the governance_context from the approved
332
+ governance check. The seller's platform verifies the governance approval before
333
+ confirming the buy.
334
+
335
+ steps:
336
+ - id: create_media_buy
337
+ title: "Create a media buy with governance approval"
338
+ narrative: |
339
+ The buyer creates the media buy with the governance_context token from the
340
+ approved check. The seller's platform validates the governance approval and
341
+ confirms the buy. Without a valid governance_context, the platform would
342
+ reject the buy because the governance agent is registered for this account.
343
+ task: create_media_buy
344
+ schema_ref: "media-buy/create-media-buy-request.json"
345
+ response_schema_ref: "media-buy/create-media-buy-response.json"
346
+ doc_ref: "/media-buy/task-reference/create_media_buy"
347
+ stateful: true
348
+ expected: |
349
+ Confirm the media buy with governance approval:
350
+ - media_buy_id: your platform's identifier
351
+ - status: confirmed or active
352
+ - confirmed_at: timestamp
353
+ - governance_context: echoed back confirming governance was validated
354
+ - packages: confirmed line items
355
+ - valid_actions: creative sync, get_delivery, etc.
356
+
357
+ sample_request:
358
+ account:
359
+ brand:
360
+ domain: "acmeoutdoor.com"
361
+ operator: "pinnacle-agency.com"
362
+ brand:
363
+ domain: "acmeoutdoor.com"
364
+ governance_context: "gov_ctx_acme_q2_approved"
365
+ start_time: "2026-04-01T00:00:00Z"
366
+ end_time: "2026-06-30T23:59:59Z"
367
+ packages:
368
+ - product_id: "sports_ctv_q2"
369
+ budget: 30000
370
+ pricing_option_id: "cpm_guaranteed"
371
+ creative_assignments:
372
+ - creative_id: "video_30s_trail_pro"
373
+ - product_id: "outdoor_video_q2"
374
+ budget: 20000
375
+ pricing_option_id: "cpm_standard"
376
+ creative_assignments:
377
+ - creative_id: "video_15s_trail_pro"
378
+
379
+ validations:
380
+ - check: response_schema
381
+ description: "Response matches create-media-buy-response.json schema"
382
+
383
+ - id: report_outcome
384
+ title: "Report governance outcome"
385
+ narrative: |
386
+ After the media buy is created, the buyer reports the outcome back to the
387
+ governance agent. This closes the governance loop by linking the actual media
388
+ buy to the governance check that authorized it.
389
+
390
+ steps:
391
+ - id: report_plan_outcome
392
+ title: "Report media buy outcome to governance"
393
+ narrative: |
394
+ The buyer reports the media buy creation back to the governance agent,
395
+ linking the media_buy_id to the governance check. This enables the governance
396
+ agent to track what was actually purchased against what was approved.
397
+ task: report_plan_outcome
398
+ schema_ref: "governance/report-plan-outcome-request.json"
399
+ response_schema_ref: "governance/report-plan-outcome-response.json"
400
+ doc_ref: "/governance/campaign/tasks/report_plan_outcome"
401
+ stateful: true
402
+ expected: |
403
+ Acknowledge the outcome report:
404
+ - outcome_id: identifier for this outcome record
405
+ - plan_id: the governance plan
406
+ - media_buy_id: the buy that was created
407
+ - governance_context: the approval that authorized it
408
+ - status: recorded
409
+
410
+ sample_request:
411
+ plan_id: "gov_acme_q2_2026"
412
+ governance_context: "gov_ctx_acme_q2_approved"
413
+ outcome:
414
+ type: "media_buy_created"
415
+ media_buy_id: "mb_acme_q2_2026"
416
+ total_budget: 50000
417
+ packages:
418
+ - product_id: "sports_ctv_q2"
419
+ budget: 30000
420
+ - product_id: "outdoor_video_q2"
421
+ budget: 20000
422
+
423
+ validations:
424
+ - check: response_schema
425
+ description: "Response matches report-plan-outcome-response.json schema"
426
+
427
+ - id: audit_trail
428
+ title: "Governance audit trail"
429
+ narrative: |
430
+ The buyer (or an auditor) retrieves the full audit trail for the governance
431
+ plan. This shows every decision in the chain: the initial denial, the human
432
+ escalation, the conditional approval, the media buy creation, and the outcome
433
+ report. The audit trail provides accountability for automated spending decisions.
434
+
435
+ steps:
436
+ - id: get_plan_audit_logs
437
+ title: "Retrieve the full governance audit trail"
438
+ narrative: |
439
+ The buyer requests the audit log for the governance plan. The log shows
440
+ every governance event: check requests, denials, escalations, approvals,
441
+ and outcome reports. Each entry has a timestamp, actor, and decision.
442
+ task: get_plan_audit_logs
443
+ schema_ref: "governance/get-plan-audit-logs-request.json"
444
+ response_schema_ref: "governance/get-plan-audit-logs-response.json"
445
+ doc_ref: "/governance/campaign/tasks/get_plan_audit_logs"
446
+ stateful: false
447
+ expected: |
448
+ Return the complete audit trail for the governance plan:
449
+ - plan_id: the governance plan
450
+ - entries: ordered list of governance events, including:
451
+ 1. Plan registered with agent_limited authority and $20K threshold
452
+ 2. Governance check denied — spending authority exceeded ($50K > $20K)
453
+ 3. Human escalation initiated
454
+ 4. Human approved with conditions (weekly reporting, budget increase review)
455
+ 5. Media buy created with governance approval
456
+ 6. Outcome reported linking media_buy_id to governance context
457
+ - Each entry includes: timestamp, event_type, actor, decision, details
458
+
459
+ sample_request:
460
+ plan_id: "gov_acme_q2_2026"
461
+
462
+ validations:
463
+ - check: response_schema
464
+ description: "Response matches get-plan-audit-logs-response.json schema"
465
+ - check: field_present
466
+ path: "entries"
467
+ description: "Response contains audit log entries"