Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,18 @@ Thumbs.db
# mkdocs build output
site/

# AgentCore CLI artifacts (generated by agentcore configure/launch)
.bedrock_agentcore.yaml
Dockerfile
.dockerignore
.packaged-agentcore.yaml
.bedrock_agentcore

#SQLIte database files
*.db-journal
*.db-wal
*.db-shm
*.db-shm

# Sample files
data/csv/samples/aws_workshop/audiences_*
data/csv/samples/aws_workshop/inventory_*
60 changes: 60 additions & 0 deletions data/csv/samples/aws_workshop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# AWS Workshop — Synthetic Publisher Inventory

Synthetic data for the IAB-AWS AAMP workshop demo. Models a fictional multi-platform publisher with diverse inventory across 5 channels.

## Publisher Properties

| Property | Channel | Content |
|----------|---------|---------|
| Apex Streaming | CTV | Premium series, live sports (basketball, hockey) |
| GNN | Linear + Digital | News programming, podcasts |
| Crestline Entertainment | CTV + Linear | Reality TV, comedy, entertainment |
| SportsPulse | Linear + Digital | Live sports broadcasts, sports video |
| Horizon Discovery | Display | Homepage takeovers, rich media |

## Files

| File | Description |
|------|-------------|
| `inventory.csv` | 15 products across CTV, linear, digital video, display, audio |
| `audiences.csv` | 6 audience segments (sports, cord-cutters, news, entertainment, high-income, auto) |
| `rate_card.json` | Base CPM rates by channel + 4-tier discount structure |
| `media_kits.json` | 4 curated media kit packages |

## Inventory Types & Base CPMs

| Channel | Base CPM | Products |
|---------|----------|----------|
| CTV/Streaming | $45 | Apex series, live basketball, live hockey, Crestline reality |
| Linear TV | $25 | GNN primetime, SportsPulse live, Crestline entertainment |
| Digital Video | $18 | GNN pre-roll, SportsPulse mid-roll, GNN outstream |
| Display | $12 | Horizon takeover, GNN rich media, SportsPulse display |
| Audio | $8 | GNN podcast sponsorship, Apex companion podcasts |

## Pricing Tiers

| Tier | Discount | Example (CTV $45 base) |
|------|----------|----------------------|
| Public | 0% | $45.00 |
| Registered Buyer | 5% | $42.75 |
| Preferred Agency | 12% | $39.60 |
| Strategic Advertiser | 15% | $38.25 |

## Media Kit Packages

| Package | Products | CPM Range |
|---------|----------|-----------|
| Apex Premium Sports Bundle | Basketball + Hockey CTV + SportsPulse linear | $42-55 |
| GNN News Reach Package | GNN linear + digital video + display | $18-28 |
| Entertainment Upfront Package | Apex series + Crestline CTV + linear | $35-48 |
| Cross-Platform Reach | 10 products across all channels | $15-45 |

## Key IDs

- Inventory IDs: `inv-ctv-*`, `inv-lin-*`, `inv-dig-*`, `inv-dsp-*`, `inv-aud-*`
- Package IDs: `PKG-APEX-SPORTS`, `PKG-GNN-NEWS`, `PKG-ENT-UPFRONT`, `PKG-CROSS-PLATFORM`
- Audience IDs: `aud-sports-enthusiasts`, `aud-cord-cutters`, `aud-news-engaged`, `aud-entertainment-seekers`, `aud-high-income-pros`, `aud-auto-intenders`

## Usage

Set `CSV_DATA_DIR=./data/csv/samples/aws_workshop` to load this data set. The AgentCore Dockerfile uses this by default.
7 changes: 7 additions & 0 deletions data/csv/samples/aws_workshop/audiences.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
id,name,description,size,segment_type,status,iab_audience_taxonomy_id
aud-sports-enthusiasts,Sports Enthusiasts 18-54,Users who frequently watch live sports and sports highlights,12500000,FIRST_PARTY,ACTIVE,6.1.2
aud-cord-cutters,Cord Cutters 18-34,Young adults who stream but don't have cable subscriptions,8200000,FIRST_PARTY,ACTIVE,6.2.1
aud-news-engaged,News-Engaged Adults 25-64,Users who consume news content daily across platforms,6100000,FIRST_PARTY,ACTIVE,6.3.1
aud-entertainment-seekers,Entertainment Seekers 18-49,Streaming-first households consuming drama and reality content,5800000,FIRST_PARTY,ACTIVE,6.4.1
aud-high-income-pros,High-Income Professionals,Household income $100K+ professionals,3200000,FIRST_PARTY,ACTIVE,6.5.1
aud-auto-intenders,Auto Intenders,In-market for vehicle purchase within 6 months,2100000,THIRD_PARTY,ACTIVE,6.6.1
16 changes: 16 additions & 0 deletions data/csv/samples/aws_workshop/inventory.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
id,name,parent_id,status,sizes,ad_formats,device_types,inventory_type,content_categories,floor_price_cpm,currency,geo_targets,description
inv-ctv-apex-series,Apex Premium Series,,ACTIVE,1920x1080,video,3|7,ctv,IAB1,45.00,USD,US,Premium scripted drama and thriller series on Apex Streaming
inv-ctv-apex-sports-nba,Apex Live Sports - Pro Basketball,,ACTIVE,1920x1080,video,3|7,ctv,IAB17|IAB17-12,52.00,USD,US,Live pro basketball regular season and playoffs on Apex Sports
inv-ctv-apex-sports-nhl,Apex Live Sports - National Ice League,,ACTIVE,1920x1080,video,3|7,ctv,IAB17|IAB17-18,48.00,USD,US,Live ice hockey regular season and championship on Apex Sports
inv-ctv-crestline-reality,Crestline Reality TV,,ACTIVE,1920x1080,video,3|7,ctv,IAB1|IAB1-6,35.00,USD,US,Unscripted reality and lifestyle programming on Crestline Entertainment
inv-lin-gnn-primetime,GNN Primetime News,,ACTIVE,1920x1080,video,3|7,linear,IAB12,28.00,USD,US,GNN primetime news programming 7-11pm ET
inv-lin-sportspulse-live,SportsPulse Live Broadcasts,,ACTIVE,1920x1080,video,3|7,linear,IAB17,32.00,USD,US,Live sports broadcasts including basketball and hockey on SportsPulse
inv-lin-crestline-entertainment,Crestline Entertainment Block,,ACTIVE,1920x1080,video,3|7,linear,IAB1,22.00,USD,US,Comedy and entertainment programming on Crestline linear
inv-dig-gnn-preroll,GNN.com Pre-Roll Video,,ACTIVE,640x360|1280x720,video,1|2,digital_video,IAB12,20.00,USD,US,Pre-roll video on GNN.com news articles and video content
inv-dig-sportspulse-midroll,SportsPulse Mid-Roll Video,,ACTIVE,640x360|1280x720,video,1|2,digital_video,IAB17,18.00,USD,US,Mid-roll in SportsPulse digital sports video content
inv-dig-gnn-outstream,GNN.com Outstream Video,,ACTIVE,640x360,video,1|2,digital_video,IAB12,15.00,USD,US,Outstream video units on GNN.com article pages
inv-dsp-horizon-takeover,Horizon Discovery Homepage Takeover,,ACTIVE,1920x1080|1280x720,banner,1|2|3,display,IAB15,18.00,USD,US,Full homepage takeover on Horizon Discovery properties
inv-dsp-gnn-richmedia,GNN Rich Media Units,,ACTIVE,300x250|728x90|970x250,banner|rich_media,1|2,display,IAB12,14.00,USD,US,Rich media display on GNN.com including expandable and interactive
inv-dsp-sportspulse-display,SportsPulse Standard Display,,ACTIVE,300x250|728x90|160x600,banner,1|2,display,IAB17,10.00,USD,US,Standard and rich media display on SportsPulse digital
inv-aud-gnn-podcast,GNN Podcast Sponsorship,,ACTIVE,,audio,,audio,IAB12,10.00,USD,US,Host-read sponsorships on GNN podcast network
inv-aud-apex-programmatic,Apex Companion Podcast Audio,,ACTIVE,,audio,,audio,IAB1,8.00,USD,US,Programmatic audio on Apex Streaming companion podcasts
41 changes: 41 additions & 0 deletions data/csv/samples/aws_workshop/media_kits.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[
{
"id": "PKG-APEX-SPORTS",
"name": "Apex Premium Sports Bundle",
"description": "Pro Basketball + National Ice League CTV inventory on Apex Sports — premium live sports audiences",
"products": ["inv-ctv-apex-sports-nba", "inv-ctv-apex-sports-nhl", "inv-lin-sportspulse-live"],
"cpm_range": {"min": 42, "max": 55},
"target_audience": "Sports enthusiasts 18-54, cord-cutters, premium CTV viewers"
},
{
"id": "PKG-GNN-NEWS",
"name": "GNN News Reach Package",
"description": "GNN linear + digital video + display — cross-platform news audience reach",
"products": ["inv-lin-gnn-primetime", "inv-dig-gnn-preroll", "inv-dig-gnn-outstream", "inv-dsp-gnn-richmedia"],
"cpm_range": {"min": 18, "max": 28},
"target_audience": "News-engaged adults 25-64, high-income professionals"
},
{
"id": "PKG-ENT-UPFRONT",
"name": "Entertainment Upfront Package",
"description": "Apex premium series + Crestline entertainment — upfront commitment pricing",
"products": ["inv-ctv-apex-series", "inv-ctv-crestline-reality", "inv-lin-crestline-entertainment"],
"cpm_range": {"min": 35, "max": 48},
"target_audience": "Entertainment seekers 18-49, streaming-first households"
},
{
"id": "PKG-CROSS-PLATFORM",
"name": "Cross-Platform Reach",
"description": "All channels combined — maximum reach with volume discount pricing",
"products": [
"inv-ctv-apex-series", "inv-ctv-apex-sports-nba",
"inv-lin-gnn-primetime", "inv-lin-crestline-entertainment",
"inv-dig-gnn-preroll", "inv-dig-sportspulse-midroll",
"inv-dsp-horizon-takeover", "inv-dsp-gnn-richmedia",
"inv-aud-gnn-podcast", "inv-aud-apex-programmatic"
],
"cpm_range": {"min": 15, "max": 45},
"target_audience": "Broad reach, all demographics, frequency-capped cross-platform",
"volume_discount": "10% additional discount on orders over $500K"
}
]
30 changes: 30 additions & 0 deletions data/csv/samples/aws_workshop/rate_card.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"publisher": "AWS Workshop Publisher",
"effective_date": "2026-01-01",
"currency": "USD",
"tiers": {
"public": {
"discount_pct": 0,
"description": "Base CPM, no authentication required"
},
"registered_buyer": {
"discount_pct": 5,
"description": "Registered buyer, 5% discount"
},
"preferred_agency": {
"discount_pct": 12,
"description": "Preferred agency partner, 12% discount"
},
"strategic_advertiser": {
"discount_pct": 15,
"description": "Strategic advertiser, 15% discount"
}
},
"base_rates": {
"ctv": 45.00,
"linear": 25.00,
"digital_video": 18.00,
"display": 12.00,
"audio": 8.00
}
}
114 changes: 114 additions & 0 deletions docs/PRODUCTION_DATA_INTEGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Production Data Integration Guide

Replace the demo data layer (CSV + SQLite) with your production inventory, pricing, and deal management systems.

## Architecture

```
CrewAI Crew → MCP Tools → Ad Server Adapter → Your System
Storage Backend → Your Database
```

The agent logic (crew, tools, prompts) stays the same. Only the data layer changes.

## Step 1: Ad Server Adapter

The adapter pattern (`src/ad_seller/clients/ad_server_base.py`) defines the interface:

```python
class AdServerBase:
async def list_inventory() -> list[InventoryItem]
async def get_product(product_id: str) -> Product
async def create_order(...) -> Order
async def update_order_status(...) -> Order
```

**Current:** `CsvAdServerClient` reads from `data/csv/samples/`.

**To integrate your system:**

1. Create `src/ad_seller/clients/your_system_client.py` implementing `AdServerBase`
2. Register it in `src/ad_seller/clients/ad_server_base.py`:
```python
def get_ad_server_client(ad_server_type: str):
if ad_server_type == "your_system":
from .your_system_client import YourSystemClient
return YourSystemClient()
```
3. Set env var: `AD_SERVER_TYPE=your_system`

**Examples of adapters to build:**
- FreeWheel API adapter
- Google Ad Manager (GAM) adapter
- Xandr/AppNexus adapter
- Custom OpenDirect-compatible SSP

## Step 2: Storage Backend

Deals, orders, proposals, and event history need persistent storage.

**Current:** SQLite in-memory (`DATABASE_URL=sqlite:///:memory:`)

**Production options** (pluggable since v2.0):

```bash
# PostgreSQL (recommended for production)
STORAGE_BACKEND=postgres
DATABASE_URL=postgresql://user:password@host:5432/seller_db

# Redis + PostgreSQL hybrid (high-throughput)
STORAGE_BACKEND=hybrid
DATABASE_URL=postgresql://user:password@host:5432/seller_db
REDIS_URL=redis://host:6379/0

# Redis only (ephemeral, fast)
STORAGE_BACKEND=redis
REDIS_URL=redis://host:6379/0
```

No code changes needed — set the env vars at deploy time.

## Step 3: Deploy Configuration

Update your `deploy.sh` or AgentCore env vars:

```bash
agentcore deploy \
--env "AD_SERVER_TYPE=your_system" \
--env "STORAGE_BACKEND=postgres" \
--env "DATABASE_URL=postgresql://..." \
--env "YOUR_SYSTEM_API_KEY=..." \
--env "YOUR_SYSTEM_BASE_URL=https://api.your-ssp.com"
```

## What Stays the Same

- MCP tool definitions (`mcp_server.py`) — unchanged
- CrewAI crew logic (`crews/publisher_crew.py`) — unchanged
- Agent prompts and instructions — unchanged
- Deal flow state machine — unchanged
- AgentCore deployment pattern — unchanged

## What Changes

| Component | Demo | Production |
|-----------|------|------------|
| Product catalog source | CSV files | Your inventory API |
| Pricing data | Static CSV CPMs | Real-time pricing engine |
| Deal booking | SQLite insert | Your order management system |
| Event history | In-memory | PostgreSQL/Redis |
| Authentication | Internal API key | Your system's auth (OAuth, API key) |

## Testing the Integration

```bash
# Unit test your adapter
python -m pytest tests/unit/ -k "your_system"

# Integration test against live system
AD_SERVER_TYPE=your_system python -m pytest tests/integration/

# Deploy and test on AgentCore
bash infra/aws/agentcore/deploy.sh --profile prod --name seller_prod --mode http --test
```
Loading