Salida de planning legible por LLM
Forecast de key-values y order en JSON
Resuelve el order GAM, resuelve IDs de custom targeting, ejecuta un forecast con constraints y devuelve un objeto JSON estable que otro LLM pueda leer sin adivinar.
"Codex, prepara un forecast JSON legible por LLM para el order OR-2026-SUMMER. Encuentra el order, resuelve key-values audience=sports y hb_pb=20, forecastea ad units Homepage/Sports del 2026-07-01 al 2026-07-31 para 500000 impresiones con 300x250 y 728x90, separa disponibilidad por formato y devuelve solo el JSON de decision."
Un objeto forecastDecision normalizado con metadata order, IDs key/value resueltos, numeros de forecast, split por formato, riesgo y siguiente accion segura.
Flujo del agente
- 01
Buscar el order con list_orders, luego llamar get_order para incluir orderId, status, advertiserId y traffickerId en el JSON.
- 02
Resolver cada key-value con search_custom_targeting y get_custom_targeting_values; nunca pasar solo etiquetas como audience=sports al forecast.
- 03
Ejecutar get_standalone_forecast para una necesidad draft, get_delivery_forecast_by_line_item para un line item existente, o get_prospective_delivery_forecast si varios line items planificados deben simularse juntos.
- 04
Anadir breakdownTargets por formato creativo para que el LLM compare 300x250 y 728x90 en vez de leer una capacidad mezclada.
- 05
Mapear el forecast bruto a un objeto forecastDecision estricto antes de pedir una recomendacion al LLM.
Funciones MCP
Llamada MCP padre mostrada con la accion reporting.
| Funcion | Coste | Uso |
|---|---|---|
reporting(action="list_orders") | 0 cr | Busca el order GAM por nombre. |
reporting(action="get_order") | 0 cr | Obtiene metadata completa del order. |
reporting(action="search_custom_targeting") | 0 cr | Resuelve nombres de keys a key IDs. |
reporting(action="get_custom_targeting_values") | 0 cr | Resuelve value IDs permitidos por key. |
reporting(action="get_standalone_forecast") | 0 cr | Forecastea el targeting resuelto antes del booking. |
reporting(action="get_delivery_forecast_by_line_item") | 0 cr | Compara con forecast de un line item existente. |
reporting(action="get_prospective_delivery_forecast") | 0 cr | Simula varios line items planificados juntos. |
Payload JSON
{
"objective": "forecast_key_values_order_json",
"prerequisiteCalls": [
{
"tool": "orders",
"arguments": {
"action": "list",
"params": {
"q": "OR-2026-SUMMER",
"limit": 5
}
}
},
{
"tool": "orders",
"arguments": {
"action": "get",
"params": {
"orderId": "9482"
}
}
},
{
"tool": "targeting",
"arguments": {
"action": "search_custom_targeting",
"params": {
"q": "audience",
"limit": 10
}
}
},
{
"tool": "targeting",
"arguments": {
"action": "get_custom_targeting_values",
"params": {
"keyId": "1871",
"limit": 200
}
}
}
],
"forecastCall": {
"tool": "reporting",
"arguments": {
"action": "get_standalone_forecast",
"params": {
"adUnitIds": [
"1234567",
"1234568"
],
"startDate": "2026-07-01T00:00:00",
"endDate": "2026-07-31T23:59:59",
"primaryGoalUnits": 500000,
"lineItemType": "STANDARD",
"priority": 8,
"keyValues": [
{
"keyId": 1871,
"valueIds": [
9912
]
},
{
"keyId": 2450,
"valueIds": [
3301
]
}
],
"geoTargeting": [
"2250"
],
"creativeSizes": [
{
"width": 300,
"height": 250
},
{
"width": 728,
"height": 90
}
],
"breakdownTargets": [
{
"name": "format_300x250",
"creative": {
"width": 300,
"height": 250
}
},
{
"name": "format_728x90",
"creative": {
"width": 728,
"height": 90
}
}
],
"frequencyCaps": [
{
"maxImpressions": 3,
"numTimeUnits": 1,
"timeUnit": "DAY"
}
],
"includeTargetingCriteriaBreakdown": true
}
}
},
"llmJsonContract": {
"forecastDecision": {
"order": [
"id",
"name",
"status",
"advertiserId",
"traffickerId"
],
"targeting": [
"adUnitIds",
"keyValues",
"geoTargeting",
"creativeSizes"
],
"forecast": [
"availableUnits",
"matchedUnits",
"deliveredUnits",
"utilizationPercent",
"formatSplit",
"contendingLineItems"
],
"decision": [
"riskLevel",
"status",
"relaxFirst",
"nextAction"
]
}
}
}Salida representativa
- {"order":{"id":"9482","name":"OR-2026-SUMMER","status":"DRAFT","advertiserId":"7712","traffickerId":"4431"},"targeting":{"adUnitIds":["1234567","1234568"],"keyValues":[{"keyId":1871,"keyName":"audience","valueIds":[9912],"valueNames":["sports"]},{"keyId":2450,"keyName":"hb_pb","valueIds":[3301],"valueNames":["20"]}]}}
- {"forecast":{"availableUnits":612400,"matchedUnits":544900,"deliveredUnits":184200,"utilizationPercent":81.6,"formatSplit":[{"format":"300x250","availableUnits":388100,"matchedUnits":352900,"riskLevel":"LOW"},{"format":"728x90","availableUnits":224300,"matchedUnits":192000,"riskLevel":"REVIEW"}],"contendingLineItems":[{"lineItemId":"90031","name":"Summer Roadblock","priority":6}]}}
- {"decision":{"riskLevel":"LOW","status":"safe_to_review","relaxFirst":null,"nextAction":"regenerate_before_booking"},"llmSummary":"Order resuelto, targeting explicito, forecast read-only."}
Dimensiones y metricas
| Name | Fuente | Descripcion |
|---|---|---|
| ORDER_ID | GAM | Identificador order |
| ORDER_NAME | GAM | Nombre del order |
| AD_UNIT_ID | GAM | IDs inventario objetivo |
| CREATIVE_TARGET_AD_UNIT_SIZE | GAM | Split por formato |
| KEY_VALUES_ID | GAM | IDs key-value resueltos |
| KEY_VALUES_NAME | GAM | Etiquetas key-value legibles |
| Name | Fuente | Descripcion |
|---|---|---|
availableUnits | Derived | Disponibilidad forecast |
matchedUnits | Derived | Unidades que coinciden con targeting |
deliveredUnits | Derived | Unidades ya entregadas en contexto |
utilizationPercent | Derived | Indicador de presion de inventario |
formatSplit | Derived | Disponibilidad separada por formato creativo |
riskLevel | Derived | Nivel de riesgo |
Limites
- La disponibilidad futura no es un informe REST HISTORICAL; no usar run_custom_report para esta pregunta.
- El contexto order es descriptivo: no reserva inventario y no muta el order.
- Las key-values deben guardarse como keyId/valueIds en el JSON para que otro agente pueda repetir el forecast.
- Los forecasts deben regenerarse cerca del booking, especialmente tras cambios de priority, sizes, caps o targeting.
Usa la guia editorial para el contexto de audiencia y vuelve aqui para acciones MCP, campos y payloads exactos.
