Skip to content

feat: support flagKeys param for remote evaluations#76

Open
svihang8 wants to merge 3 commits into
amplitude:mainfrom
svihang8:feat-support-flag-keys-remote-eval
Open

feat: support flagKeys param for remote evaluations#76
svihang8 wants to merge 3 commits into
amplitude:mainfrom
svihang8:feat-support-flag-keys-remote-eval

Conversation

@svihang8

@svihang8 svihang8 commented Jun 27, 2026

Copy link
Copy Markdown

Summary

This PR adds support for flagKeys param to fetch_v2() to allow emitting exposure events for designated flagKeys, in line with implementation matching core amplitude experiment sdk reference

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No, Backwards compatible.

Hello team. Recently we ran into an issue where when setting fetch_v2(trackExposure=True), this would cause firing exposure events for all our experiments in a deployment. The workaround fix for this is to call the v1 Experiment Evaluation API directly ; reference that allows setting flag_keys explicitly to prevent firing exposure events for all keys in a deployment. From my understanding, this is supported in the node.js sdk and the core experiment sdk, so we should support it in the python sdk as well.

Cheers! 🥳


Note

Low Risk
Small, backward-compatible optional parameter and request header with test coverage; no auth or data-model changes.

Overview
Adds optional flagKeys on FetchOptions so fetch_v2() can ask the evaluation API to focus on specific flags (aligned with other Experiment SDKs).

When flagKeys is a non-empty list, RemoteEvaluationClient sets X-Amp-Exp-Flag-Keys to a URL-safe base64 encoding of the JSON array (padding stripped). An empty list omits the header, matching existing behavior for assignment/exposure tracking options.

Unit tests assert the header value for sample keys and that flagKeys=[] does not add the header.

Reviewed by Cursor Bugbot for commit 2654122. Bugbot is set up for automated code reviews on this repo. Configure here.

@svihang8 svihang8 marked this pull request as ready for review June 27, 2026 16:40
@svihang8 svihang8 requested a review from a team as a code owner June 27, 2026 16:40
@svihang8 svihang8 changed the title feat(support passing flagKeys to fetch_v2 feat(support passing flagKeys param for remote evaluations Jun 27, 2026
@svihang8 svihang8 changed the title feat(support passing flagKeys param for remote evaluations feat(support passing flagKeys param for remote evaluations) Jun 27, 2026
@svihang8 svihang8 changed the title feat(support passing flagKeys param for remote evaluations) feat: support flagKeys param for remote evaluations Jun 27, 2026
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.

1 participant