feat(perplexity): add X-Pplx-Integration attribution header - #3083
Merged
Lancetnik merged 3 commits intoJul 16, 2026
Conversation
Perplexity attributes AG2 traffic in api-gateway logs via this header. Merged into user-supplied default_headers, no-op for users. Refs ag2ai#2903
Header name extracted to module constant. Merge runs once at tool creation instead of per SDK call.
Attribution header is an integral part of this client, not a per-request concern, so it is merged into default_headers once in __init__.
Lancetnik
approved these changes
Jul 16, 2026
Lancetnik
enabled auto-merge
July 16, 2026 10:43
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
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
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
X-Pplx-Integration: ag2/<version>default header to Perplexity SDK client construction in both tools (perplexity_search,perplexity_answer).default_headers— existing client customization intact.Motivation
Header lets Perplexity attribute Search API traffic back to AG2 in api-gateway logs. No-op for users.
Port of #2903 (by @jliounis) to current repo layout — original targeted
autogen/beta/tools/search/, code now lives inag2/tools/search/.Testing
uv run pytest test/tools/search/test_perplexity.py— 26 passeduv run ruff check+ruff format --check— cleanuv run mypy ag2/tools/search/perplexity.py— clean