-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add adagents.json validation and discovery #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add utilities for fetching, parsing, and validating adagents.json files per the AdCP specification. This allows sales agents to verify they are authorized for specific publisher properties. Features: - fetch_adagents(): Async function to fetch and validate adagents.json - verify_agent_authorization(): Check if agent is authorized for a property - verify_agent_for_property(): Convenience wrapper combining fetch + verify - domain_matches(): Domain matching logic per AdCP rules (wildcards, subdomains) - identifiers_match(): Property identifier matching logic Implements AdCP spec for publisher authorization: - Wildcard domain patterns (*.example.com) - Common subdomain matching (www, m) - Protocol-agnostic agent URL matching - Property type and identifier validation - Multiple identifier types (domain, bundle_id, etc.) Exception hierarchy: - AdagentsValidationError: Base error for validation issues - AdagentsNotFoundError: adagents.json not found (404) - AdagentsTimeoutError: Request timeout Tests: - 27 unit tests covering all core logic - Domain matching edge cases - Identifier matching rules - Authorization verification scenarios - Error handling and validation All existing tests pass (207 tests total) Type checking passes with mypy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive example demonstrating adagents.json validation: - Fetching and parsing adagents.json - Verifying agent authorization - Domain matching rules - Identifier matching - Error handling Includes working examples with mock data and explanations of all key use cases for sales agents and publishers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Document the new adagents.json validation functionality: - Usage examples for fetch_adagents and verify_agent_authorization - Domain matching rules (wildcards, subdomains, protocol-agnostic) - Use cases for sales agents and publishers - Reference to complete examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add utilities to extract and query properties from adagents.json: - get_all_properties(): Extract all properties across all agents - get_all_tags(): Get unique tags from all properties - get_properties_by_agent(): Filter properties by agent URL Features: - Extracts properties with agent_url for reference - Protocol-agnostic agent URL matching - Handles empty/missing properties gracefully - Returns structured data for indexing and discovery Use cases: - Build property indexes and registries - Discover available inventory by tags - Query what properties an agent can sell - Aggregate publisher inventory across agents Tests: - 8 new unit tests covering all edge cases - All 215 tests pass Example added demonstrating property discovery and tag extraction. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add domain input validation to prevent injection attacks - Add comprehensive domain normalization (handles trailing dots/slashes) - Add HTTP session management with optional client parameter for connection pooling - Add 14 new tests for domain validation and normalization - Fix line length violation in docstring Security improvements: - Validate publisher domains before HTTP requests - Check for suspicious characters (backslash, @, newlines, tabs) - Prevent path traversal attempts - Enforce DNS domain length limits (253 chars) Performance improvements: - Optional httpx.AsyncClient parameter for connection reuse - Enables connection pooling for multiple adagents.json fetches - Reduces overhead for production use cases All 229 tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Ruff's import sorter requires imports to be in alphabetical order. This fixes the CI linter failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
bokelley
added a commit
that referenced
this pull request
Nov 18, 2025
* feat: add adagents.json validation support Add utilities for fetching, parsing, and validating adagents.json files per the AdCP specification. This allows sales agents to verify they are authorized for specific publisher properties. Features: - fetch_adagents(): Async function to fetch and validate adagents.json - verify_agent_authorization(): Check if agent is authorized for a property - verify_agent_for_property(): Convenience wrapper combining fetch + verify - domain_matches(): Domain matching logic per AdCP rules (wildcards, subdomains) - identifiers_match(): Property identifier matching logic Implements AdCP spec for publisher authorization: - Wildcard domain patterns (*.example.com) - Common subdomain matching (www, m) - Protocol-agnostic agent URL matching - Property type and identifier validation - Multiple identifier types (domain, bundle_id, etc.) Exception hierarchy: - AdagentsValidationError: Base error for validation issues - AdagentsNotFoundError: adagents.json not found (404) - AdagentsTimeoutError: Request timeout Tests: - 27 unit tests covering all core logic - Domain matching edge cases - Identifier matching rules - Authorization verification scenarios - Error handling and validation All existing tests pass (207 tests total) Type checking passes with mypy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * docs: add adagents validation example Add comprehensive example demonstrating adagents.json validation: - Fetching and parsing adagents.json - Verifying agent authorization - Domain matching rules - Identifier matching - Error handling Includes working examples with mock data and explanations of all key use cases for sales agents and publishers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * docs: add Publisher Authorization Validation section to README Document the new adagents.json validation functionality: - Usage examples for fetch_adagents and verify_agent_authorization - Domain matching rules (wildcards, subdomains, protocol-agnostic) - Use cases for sales agents and publishers - Reference to complete examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: add property and tag discovery functions Add utilities to extract and query properties from adagents.json: - get_all_properties(): Extract all properties across all agents - get_all_tags(): Get unique tags from all properties - get_properties_by_agent(): Filter properties by agent URL Features: - Extracts properties with agent_url for reference - Protocol-agnostic agent URL matching - Handles empty/missing properties gracefully - Returns structured data for indexing and discovery Use cases: - Build property indexes and registries - Discover available inventory by tags - Query what properties an agent can sell - Aggregate publisher inventory across agents Tests: - 8 new unit tests covering all edge cases - All 215 tests pass Example added demonstrating property discovery and tag extraction. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: add security and performance improvements to adagents validation - Add domain input validation to prevent injection attacks - Add comprehensive domain normalization (handles trailing dots/slashes) - Add HTTP session management with optional client parameter for connection pooling - Add 14 new tests for domain validation and normalization - Fix line length violation in docstring Security improvements: - Validate publisher domains before HTTP requests - Check for suspicious characters (backslash, @, newlines, tabs) - Prevent path traversal attempts - Enforce DNS domain length limits (253 chars) Performance improvements: - Optional httpx.AsyncClient parameter for connection reuse - Enables connection pooling for multiple adagents.json fetches - Reduces overhead for production use cases All 229 tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: correct import sorting in __init__.py for CI linter Ruff's import sorter requires imports to be in alphabetical order. This fixes the CI linter failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add comprehensive utilities for parsing, validating, and discovering properties in adagents.json files per the AdCP specification. This enables sales agents to verify authorization and publishers to manage inventory across multiple agents.
Features
Testing
Changes
src/adcp/adagents.pywith 8 public functions