Skip to content

Conversation

@BaiyuScope3
Copy link
Collaborator

@BaiyuScope3 BaiyuScope3 commented Jan 9, 2026

Summary

Updates the sales agent to support AdCP-client 2.18.0's new assets field while maintaining backward compatibility with older clients that use the deprecated assets_required field.
Per AdCP protocol 2.6.0 spec.

Motivation

AdCP-client 2.18.0 introduces a new assets field in the Format schema that includes both required and optional assets (with an explicit required: boolean flag). The previous assets_required field only contained required assets and is now deprecated.

This change ensures:

  • Old buyer agents (adcp protocol < 2.6.0) can still use assets_required
  • New buyer agents (adcp protocol >= 2.6.0) can use the new assets field with optional asset support

Changes

Core Changes

  • pyproject.toml: Upgraded adcp client python from 2.17.0 to 2.18.0
  • src/core/tools/creative_formats.py:
    • Added _ensure_backward_compatible_format() function that ensures both fields are populated
    • Uses adcp utilities (has_assets, uses_deprecated_assets_field, get_format_assets, etc.)
    • If format has only assets → populates assets_required from required assets
    • If format has only assets_required → populates assets using normalize_assets_required()
  • src/core/tools/media_buy_create.py: Updated to use get_format_assets() utility for consistent asset handling

Test Updates

  • Updated tests/helpers/adcp_factories.py to use new Assets type
  • Updated integration and unit tests to use assets field instead of deprecated assets_required

Backward Compatibility

Creative Agent Returns Sales Agent Returns Old Buyer Works New Buyer Works
Only assets (new) Both fields
Only assets_required (old) Both fields
Both fields Both fields (unchanged)

Testing

  • Unit tests pass
  • Verified backward compatibility function with all scenarios
  • Tested against local creative agent (2.18.0) - confirms both fields returned

Test sales agent MCP tools

  • Old version compatible check
image
  • New version check
image

- Upgrade adcp dependency from 2.17.0 to 2.18.0
- Add backward compatibility for list_creative_formats tool
  - Populate assets_required from assets for old clients
  - Populate assets from assets_required for old formats
- Use adcp.utils.format_assets utilities (get_format_assets, has_assets,
  uses_deprecated_assets_field) for consistent asset handling
- Update tests to use new Assets type instead of deprecated AssetsRequired
- Update media_buy_create to use get_format_assets utility

This ensures both old buyer agents (using assets_required) and new buyer
agents (using assets) can work with the sales agent.
- Use TypeVar in _ensure_backward_compatible_format to preserve Format subtype
- Use get_individual_assets() instead of get_format_assets() in media_buy_create
- Add isinstance type guard for Assets to satisfy mypy union type checks
1. Schema validation tests (extra='allow' change):
   - adcp 2.18.0 changed library schemas to use extra='allow' for forward compat
   - Updated tests to verify extra fields are accepted but ignored
   - Renamed tests to reflect new behavior (rejects -> ignores)

2. A2A response extraction (TextPart + DataPart pattern):
   - A2A responses may now have TextPart before DataPart
   - Added extract_data_from_artifact helper to find DataPart
   - Updated tests to handle variable part ordering
get_individual_assets() returns ALL individual assets (required + optional),
not just required ones. Renamed variable to avoid confusion.
…traction

Added comments to make clear that get_individual_assets() maintains the
same behavior as before - repeatable groups were never supported here.
@BaiyuScope3 BaiyuScope3 merged commit 6d19499 into main Jan 14, 2026
16 checks passed
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.

3 participants