Skip to content

feat(adagents): add permissive property resolver#827

Draft
sangilish wants to merge 2 commits into
adcontextprotocol:mainfrom
sangilish:feat/permissive-agent-property-resolution-711
Draft

feat(adagents): add permissive property resolver#827
sangilish wants to merge 2 commits into
adcontextprotocol:mainfrom
sangilish:feat/permissive-agent-property-resolution-711

Conversation

@sangilish
Copy link
Copy Markdown

Summary

Refs #711.

This adds an explicit opt-in resolver for operational adagents.json files that list a sales agent in authorized_agents[] but omit the schema-conformant authorization_type selector.

The existing get_properties_by_agent() behavior stays strict and unchanged. New callers can use:

resolve_properties_for_agent(adagents_data, agent_url, mode="permissive")

In permissive mode, a matching bare authorized_agents entry resolves to the file's top-level properties[]. The fallback only applies when the entry has no authorization_type and no known selector field. If the agent is not listed, or if the entry has an explicit selector, the result remains the strict result.

What changed

  • Added resolve_properties_for_agent(..., mode="strict" | "permissive").
  • Kept get_properties_by_agent() as the strict path.
  • Exported the new helper from adcp.__all__ and updated the public API snapshot.
  • Added tests covering:
    • default strict behavior for bare entries remains empty
    • permissive bare-entry fallback returns top-level properties
    • permissive mode still requires the agent URL to be listed
    • permissive mode does not override broken explicit selectors
    • revoked publisher domains are excluded from fallback results
    • unknown modes fail loudly

Testing

  • uv run pytest tests/test_adagents.py -q -k "resolve_properties_for_agent or get_properties_by_agent"
  • uv run pytest tests/test_public_api.py tests/test_adagents.py -q
  • uv run pytest -q
  • uv run ruff check src/adcp/adagents.py src/adcp/__init__.py tests/test_adagents.py tests/fixtures/public_api_snapshot.json
  • uv run mypy src/adcp
  • git diff --check

Note: uv run ruff check across the full repository currently reports pre-existing lint drift in unrelated tests. The files touched in this PR pass ruff.

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.

2 participants