How iabtechlab/buyer-agent works
The repository implements an AI-assisted programmatic media buyer: users provide a campaign brief through an API, chat, or CLI, and the system discovers seller inventory, obtains quotes, negotiates and books deals. Its major capabilities also include media-kit browsing, buyer-identity pricing, optional SGP vendor gating, audience planning, reporting, pacing, and deal-library management. The graph reflects documented workflow and sampled imports/calls; several feature branches are represented at subsystem-directory level because their implementation was not sampled.
Main entry points: multi_seller.py Multi-seller buying · deal_booking_flow.py Booking flow · main.py REST API · deals_client.py Quotes and deals
Components 23
User interfaces
- REST API
src/ad_buyer/interfaces/api/main.py - Chat interface
src/ad_buyer/interfaces/chat/main.py - CLI
src/ad_buyer/interfaces/cli/main.py
Buying workflow
- Booking flow
src/ad_buyer/flows/deal_booking_flow.py - Multi-seller buying
src/ad_buyer/orchestration/multi_seller.py - Booking service
src/ad_buyer/services/booking_service.py
Seller capabilities
- Quotes and deals
src/ad_buyer/clients/deals_client.py - Negotiation
src/ad_buyer/negotiation/client.py - OpenDirect orders
src/ad_buyer/clients/opendirect_client.py - Media-kit browsing
src/ad_buyer/media_kit/client.py - Inventory discovery
src/ad_buyer/services/discovery_service.py
Planning and insights
- Audience planning
src/ad_buyer/pipelines - Buying agents
src/ad_buyer/agents - Campaign reporting
src/ad_buyer/reporting - Campaign pacing
src/ad_buyer/pacing/engine.py - Deal library
src/ad_buyer/tools/deal_library - Vendor approval gate
src/ad_buyer/clients/sgp_client.py
Shared platform
- Buyer identity
src/ad_buyer/auth - Deal state
src/ad_buyer/storage/deal_store.py - Event bus
src/ad_buyer/events/bus.py - Wire-contract mapping
src/ad_buyer/clients/contract_mappers.py
Other components
- Buyer
- Seller agents
Connections 28
- Buyer → REST API: submits brief
README.md - Buyer → Chat interface: requests buying
README.md - Buyer → CLI: runs workflow
README.md - REST API → Booking service: starts booking
src/ad_buyer/interfaces/api/main.py - Chat interface → Multi-seller buying: requests quotes
src/ad_buyer/interfaces/chat/main.py - CLI → Booking flow: starts flow
src/ad_buyer/interfaces/cli/main.py - Booking service → Booking flow: delegates booking
src/ad_buyer/services/booking_service.py - Booking flow → Multi-seller buying: executes buying
src/ad_buyer/flows/deal_booking_flow.py - Booking flow → OpenDirect orders: books orders
src/ad_buyer/flows/deal_booking_flow.py - Multi-seller buying → Quotes and deals: requests quotes
src/ad_buyer/orchestration/multi_seller.py - Multi-seller buying → Negotiation: negotiates deals
src/ad_buyer/orchestration/multi_seller.py - Multi-seller buying → OpenDirect orders: books orders
src/ad_buyer/orchestration/multi_seller.py - Quotes and deals → Seller agents: calls deal API
README.md - Negotiation → Seller agents: negotiates prices
README.md - OpenDirect orders → Seller agents: sends orders
README.md - Inventory discovery → Media-kit browsing: browses kits
src/ad_buyer/services/discovery_service.py - Media-kit browsing → Seller agents: fetches packages
src/ad_buyer/media_kit/client.py - Multi-seller buying → Vendor approval gate: checks approval
src/ad_buyer/orchestration/multi_seller.py - Multi-seller buying → Deal state: persists deal state
src/ad_buyer/flows/deal_booking_flow.py - Quotes and deals → Deal state: updates deal state
src/ad_buyer/clients/deals_client.py - Quotes and deals → Wire-contract mapping: maps quote payloads
src/ad_buyer/clients/deals_client.py - OpenDirect orders → Wire-contract mapping: maps wire data
src/ad_buyer/clients/opendirect_client.py - Booking flow → Event bus: emits lifecycle events
src/ad_buyer/flows/deal_booking_flow.py - REST API → Campaign reporting: serves reports
src/ad_buyer/interfaces/api/main.py - Booking flow → Buying agents: coordinates specialists
src/ad_buyer/flows/deal_booking_flow.py - Buying agents → Audience planning: plans audiences
- REST API → Buyer identity: checks operator access
src/ad_buyer/interfaces/api/main.py - Campaign pacing → Event bus: publishes lifecycle events
src/ad_buyer/pacing/engine.py