Skip to content

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

Merged
Lancetnik merged 3 commits into
ag2ai:mainfrom
futorio:feat/perplexity-attribution-header
Jul 16, 2026
Merged

feat(perplexity): add X-Pplx-Integration attribution header#3083
Lancetnik merged 3 commits into
ag2ai:mainfrom
futorio:feat/perplexity-attribution-header

Conversation

@futorio

@futorio futorio commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add X-Pplx-Integration: ag2/<version> default header to Perplexity SDK client construction in both tools (perplexity_search, perplexity_answer).
  • Merge attribution header with user-supplied default_headers — existing client customization intact.
  • Tests assert both endpoints propagate the header and preserve user headers.

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 in ag2/tools/search/.

Testing

  • uv run pytest test/tools/search/test_perplexity.py — 26 passed
  • uv run ruff check + ruff format --check — clean
  • uv run mypy ag2/tools/search/perplexity.py — clean

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

Refs ag2ai#2903
@CLAassistant

CLAassistant commented Jul 16, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added the area:tools Tool system, builtin tools, subagents (ag2/tools) label Jul 16, 2026
futorio added 2 commits July 16, 2026 10:59
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
Lancetnik enabled auto-merge July 16, 2026 10:43
@Lancetnik
Lancetnik added this pull request to the merge queue Jul 16, 2026
Merged via the queue into ag2ai:main with commit 84f8ba3 Jul 16, 2026
18 checks passed
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
ag2/tools/search/perplexity.py 98.97% <100.00%> (+0.03%) ⬆️

... and 1 file 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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants