Skip to content

feat(perplexity): add X-Pplx-Integration attribution header - #2903

Draft
jliounis wants to merge 1 commit into
ag2ai:mainfrom
jliounis:psi/feat/perplexity-attribution-header
Draft

feat(perplexity): add X-Pplx-Integration attribution header#2903
jliounis wants to merge 1 commit into
ag2ai:mainfrom
jliounis:psi/feat/perplexity-attribution-header

Conversation

@jliounis

Copy link
Copy Markdown
Contributor

Summary

  • Add the X-Pplx-Integration: ag2/<version> default header to Perplexity SDK client construction for both AG2 Perplexity tools.
  • Merge the attribution header with user-supplied SDK default_headers so existing client customization remains intact.
  • Assert the Search API and chat-completions requests propagate the attribution header to the underlying HTTP client.

Motivation

The original Perplexity integration in #2752 added the tools but did not include this attribution header. The header lets Perplexity attribute Search API traffic back to AG2 through api-gateway logs and metrics. This is a no-op for users; it only adds an HTTP request header on Perplexity SDK calls.

Testing

  • uv run pytest test/beta/tools/search/test_perplexity.py
  • uv run ruff check autogen/beta/tools/search/perplexity.py test/beta/tools/search/test_perplexity.py
  • uv run ruff format --check autogen/beta/tools/search/perplexity.py test/beta/tools/search/test_perplexity.py

Note: current main does not contain test/beta/tools/search/test_perplexity_search_api.py; the Perplexity Search API and chat-completions coverage is consolidated in test/beta/tools/search/test_perplexity.py.


🤖 Generated by PSI
🧠 Agent used: codex

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


james-pplx seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the beta label May 26, 2026
@Lancetnik Lancetnik added type:feature New functionality or API extension status:in-progress Someone is actively working on it area:tools Tool system, builtin tools, subagents (ag2/tools) status:needs-cla Gate: CLA not signed; not reviewed until signed and removed beta status:in-progress Someone is actively working on it labels Jul 4, 2026
@Lancetnik

Copy link
Copy Markdown
Member

Hi @jliounis, thanks for the contribution!

Before we can review or merge this PR, you need to sign our Contributor License Agreement — the license/cla check on this PR has the signing link. This applies to draft PRs as well: we don't want you to invest work into a change we can't accept.

Once the CLA is signed, the check turns green, the status:needs-cla label is removed, and the PR proceeds through the normal flow.

⏳ If the CLA isn't signed within 3 days, this PR will be marked stale and closed 7 days after that. Signing later and reopening is always an option.

@Lancetnik Lancetnik added status:changes-requested Gate: review done, author must address changes (code, tests, docs) and removed status:needs-cla Gate: CLA not signed; not reviewed until signed labels Jul 14, 2026
meefs pushed a commit to meefs/ag2 that referenced this pull request Jul 16, 2026
* feat(perplexity): add X-Pplx-Integration attribution header

Perplexity attributes AG2 traffic in api-gateway logs via this
header. Merged into user-supplied default_headers, no-op for users.

Refs ag2ai#2903

* refactor(perplexity): move header merge into toolkit method

Header name extracted to module constant. Merge runs once at tool
creation instead of per SDK call.

* refactor(perplexity): merge attribution header in init

Attribution header is an integral part of this client, not a
per-request concern, so it is merged into default_headers once
in __init__.
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
autogen/beta/tools/search/perplexity.py 99.00% <100.00%> (+0.05%) ⬆️

... and 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tools Tool system, builtin tools, subagents (ag2/tools) status:changes-requested Gate: review done, author must address changes (code, tests, docs) type:feature New functionality or API extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants