---
name: PostHog Python
slug: posthog-python
type: github
source_url: https://github.com/PostHog/posthog-python
changelog_url: https://github.com/PostHog/posthog-python/blob/HEAD/CHANGELOG.md
organization: PostHog
organization_slug: posthog
total_releases: 502
latest_version: openfeature-provider-posthog-v0.1.148
latest_date: 2026-11-06
last_updated: 2026-11-06
tracking_since: 2020-11-23
canonical: https://releases.sh/posthog/posthog-python
organization_url: https://releases.sh/posthog
---

<Summary type="rolling" window-days="90" release-count="28">
The SDK broadened its AI capabilities while hardening feature flag evaluation and improving operational reliability. Prompt management shipped in v7.8.0, then expanded to support versioning and multimodal capture across OpenAI, Gemini, and Anthropic integrations. Local flag evaluation gained semver targeting, device_id bucketing, and ETag caching to reduce polling overhead. The library also tightened retry logic for timeouts and 401 errors, exposed the flag definition cache provider for custom implementations, and surfaced flag evaluation failures through a new `$feature_flag_error` property.
</Summary>

<Summary type="monthly" period="February 2026" release-count="10">
Feature flag evaluation expanded to support device_id as a bucketing identifier for local evaluation, while AI token tracking gained the ability to detect value overrides through a new $ai_tokens_source property. The month also hardened reliability across the board—fixing IP address property naming, preventing HTTP request storms on 401 errors during flag refreshes, and adding Retry-After header respect for 408 responses.
</Summary>

<Release version="openfeature-provider-posthog-v0.1.148" date="November 6, 2026" published="2026-11-06T13:39:21.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/openfeature-provider-posthog-v0.1.148">
### Patch changes

- Updated dependencies: posthog@7.84.3

</Release>

<Release version="posthog-v7.84.3" date="November 6, 2026" published="2026-11-06T13:38:09.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/posthog-v7.84.3">
### Patch changes

- [3f93a34](https://github.com/posthog/posthog-python/commit/3f93a347939779e63f0176bf0a1396b07f98002c) Exclude client-only feature flags from definition-load warnings about experience continuity and unsupported definitions, without changing local evaluation. — Thanks @marandaneto!

</Release>

<Release version="openfeature-provider-posthog-v0.1.147" date="November 6, 2026" published="2026-11-06T08:19:17.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/openfeature-provider-posthog-v0.1.147">
### Patch changes

- Updated dependencies: posthog@7.84.2

</Release>

<Release version="posthog-v7.84.2" date="November 6, 2026" published="2026-11-06T08:18:02.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/posthog-v7.84.2">
### Patch changes

- [11585fb](https://github.com/posthog/posthog-python/commit/11585fba6517aa3c33e657e5b94103e65469563e) Stop retrying `/flags` requests when the connection is refused, so the flag error surfaces right away instead of after the retry backoff. — Thanks @luantaraschi!

</Release>

<Release version="openfeature-provider-posthog-v0.1.146" date="November 5, 2026" published="2026-11-05T23:50:12.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/openfeature-provider-posthog-v0.1.146">
### Patch changes

- Updated dependencies: posthog@7.84.1

</Release>

<Release version="posthog-v7.84.1" date="November 5, 2026" published="2026-11-05T23:48:58.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/posthog-v7.84.1">
### Patch changes

- [f3116ff](https://github.com/posthog/posthog-python/commit/f3116ffca51ba3dcac8527bb0c50505bab079bdc) Reworded the descriptions of the injected `conversation_id` and `llm_model` arguments and the `get_more_tools` and `send_feedback` virtual tools so they describe the field instead of instructing the model. This changes your published tool definitions; if your server is listed in the ChatGPT or Claude directories, those platforms may re-review the updated tools. — Thanks @lucasheriques!

</Release>

<Release version="openfeature-provider-posthog-v0.1.145" date="November 5, 2026" published="2026-11-05T12:24:39.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/openfeature-provider-posthog-v0.1.145">
### Patch changes

- Updated dependencies: posthog@7.84.0

</Release>

<Release version="posthog-v7.84.0" date="November 5, 2026" published="2026-11-05T12:23:33.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/posthog-v7.84.0">
### Minor changes

- [063f1ce](https://github.com/posthog/posthog-python/commit/063f1cece68ee0d6e4d644d4b6fe0fbe335e3b29) `posthog.emails.send()` can now send email content your code rendered, such as HTML from Jinja or React Email. Give the email a `template_key` and a `subject`, and pass `html`, `text` or both.
  
  ```python
  posthog = Posthog("phc_...", secret_key="phs_...")
  
  result = posthog.emails.send(
      to="user@example.com",
      distinct_id="user_123",
      template_key="password-reset",
      subject="Reset your password",
      html=rendered_html,
  )
  
  # "delivered", "bounced", ...
  status = posthog.emails.get(result.id).status
  ```
  
  You need a project secret API key, the kind that starts with `phs_`. Create one under **Project secret API keys** in your project settings. Set its **Transactional email** scope to Write to send emails, or to Read for a key that only reads statuses. Pass it to the client as `secret_key`. Set `app_host` to your PostHog app URL when you self-host PostHog or send through a reverse proxy.
  
  PostHog records each email's delivery, opens and clicks on the person with that `distinct_id`. It groups every email with the same `template_key`, so you see their metrics and logs in one place. The SDK retries a request that hits a network error, a rate limit or an outage twice by default. Every send carries an idempotency key, so a retry never sends the email twice. Pass your own `idempotency_key`, such as `welcome:user_123`, and your job runner's retries are safe too.
  
  A send with your own content also takes `from_`, `reply_to` and `capture_engagement=False`. Set `migrated_from` on the client to tell PostHog which email provider you moved from. A failed call raises an `EmailError` with PostHog's `code` and the HTTP `status_code`.
  
  Docs: [Send transactional emails with Python](https://posthog.com/docs/workflows/transactional-emails/python) and the [transactional email overview](https://posthog.com/docs/workflows/transactional-emails). — Thanks @Silthus!

### Patch changes

- [b741c65](https://github.com/posthog/posthog-python/commit/b741c65a5cd0e503aaf915e695cdb4d54686d9f9) The LangChain callback handler no longer reports too few input tokens for a non-streamed `ChatAnthropic` call that reads or writes the prompt cache. It took the raw Anthropic usage from `response_metadata`, whose input tokens already exclude the cache, and subtracted the cache tokens again, so a cached call usually reported 0 input tokens. It now reads LangChain's standard `usage_metadata` first, as it already did for streamed calls. — Thanks @jaeminbird for your first contribution 🎉!

</Release>

<Release version="openfeature-provider-posthog-v0.1.144" date="November 5, 2026" published="2026-11-05T11:51:09.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/openfeature-provider-posthog-v0.1.144">
### Patch changes

- Updated dependencies: posthog@7.83.3

</Release>

<Release version="posthog-v7.83.3" date="November 5, 2026" published="2026-11-05T11:49:45.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/posthog-v7.83.3">
### Patch changes

- [7cd0d8a](https://github.com/posthog/posthog-python/commit/7cd0d8a4a9cadafc92bc479c4ec209436476132c) Streaming Gemini calls that fail now record the HTTP status of the google-genai error (for example 429 or 503) in `$ai_http_status`. Before, `capture_streaming_event` read only `status_code`, so these events were captured with a status of 0. — Thanks @pcbeingused333!

</Release>

<Release version="openfeature-provider-posthog-v0.1.143" date="November 4, 2026" published="2026-11-04T20:21:58.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/openfeature-provider-posthog-v0.1.143">
### Patch changes

- Updated dependencies: posthog@7.83.2

</Release>

<Release version="posthog-v7.83.2" date="November 4, 2026" published="2026-11-04T20:20:47.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/posthog-v7.83.2">
### Patch changes

- [ae2dcf2](https://github.com/posthog/posthog-python/commit/ae2dcf2eaa76fa2693ed8ebe19bbf22054661acb) Local evaluation now respects early access feature enrollment. A flag with feature enrollment uses the `$feature_enrollment/<flag key>` person property when you pass it, and otherwise falls back to the flags service. Before, it returned `False` for enrolled people who matched no release condition, while the flags service returned `True`. — Thanks @puemos for your first contribution 🎉!

</Release>

<Release version="openfeature-provider-posthog-v0.1.142" date="November 3, 2026" published="2026-11-03T14:01:40.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/openfeature-provider-posthog-v0.1.142">
### Patch changes

- Updated dependencies: posthog@7.83.1

</Release>

<Release version="posthog-v7.83.1" date="November 3, 2026" published="2026-11-03T14:00:12.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/posthog-v7.83.1">
### Patch changes

- [0c12ca1](https://github.com/posthog/posthog-python/commit/0c12ca1521f6538873e00f5240cad306c9bba455) `PostHogMCP.prepare_tool_list` now adds the `context` argument to MCP SDK 2.x `Tool` objects. It only added it to dicts and 1.x `Tool` objects before, so `$mcp_intent` was never captured for 2.x tool objects. — Thanks @connor-grady!

</Release>

<Release version="openfeature-provider-posthog-v0.1.141" date="November 3, 2026" published="2026-11-03T13:04:57.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/openfeature-provider-posthog-v0.1.141">
### Patch changes

- Updated dependencies: posthog@7.83.0

</Release>

<Release version="posthog-v7.83.0" date="November 3, 2026" published="2026-11-03T13:03:01.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/posthog-v7.83.0">
### Minor changes

- [e094dc5](https://github.com/posthog/posthog-python/commit/e094dc59522b8d7d7b68a74cac4259a61daef60f) Request `/flags?v=4` and read each flag's typed value, reason and metadata. They stay internal for now: this release adds no public methods, fields or types for them, and `repr`, equality and `dataclasses.asdict` of a flag show only its existing fields. Servers that still send the older response keep working, and a flag record with a field of the wrong JSON type fails only that flag. For valid flag records, existing getters, callbacks and `$feature_flag_called` properties return the same values as before: a number or object value reads as `True`, with the value as its payload. Two things can differ: the human-readable reason text of a config version 2 flag is the one the server sends at v4, and a record with a known field of the wrong JSON type (for example a string `reason`) now reads as a failed flag instead of being read anyway or failing the whole response. The SDK logs once per client when a server sends a response without typed values. `FlagMetadata.id` and `FlagMetadata.version` are `None` when a record has none, instead of `0`, so their type is now `Optional[int]`. — Thanks @andehen!

</Release>

<Release version="openfeature-provider-posthog-v0.1.140" date="November 2, 2026" published="2026-11-02T20:39:29.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/openfeature-provider-posthog-v0.1.140">
### Patch changes

- Updated dependencies: posthog@7.82.2

</Release>

<Release version="posthog-v7.82.2" date="November 2, 2026" published="2026-11-02T20:37:38.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/posthog-v7.82.2">
### Patch changes

- [57b9db8](https://github.com/posthog/posthog-python/commit/57b9db8493bc06dc448bda244020eea1e0ed1ec5) Count Gemini URL context tool use prompt tokens as input tokens in captured generations; Google Search retrieval is not billed as input and stays out of the total. — Thanks @pcbeingused333!

</Release>

<Release version="openfeature-provider-posthog-v0.1.139" date="November 2, 2026" published="2026-11-02T16:30:32.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/openfeature-provider-posthog-v0.1.139">
### Patch changes

- Updated dependencies: posthog@7.82.1

</Release>

<Release version="posthog-v7.82.1" date="November 2, 2026" published="2026-11-02T16:28:34.000Z" url="https://github.com/PostHog/posthog-python/releases/tag/posthog-v7.82.1">
### Patch changes

- [9ebfb87](https://github.com/posthog/posthog-python/commit/9ebfb87ce3eefb2f3672c99e1b4f083013fe864b) Fix a race condition where concurrent feature flag fallback-cache eviction could raise KeyError instead of returning a cache miss, including during request failures. — Thanks @Sarbajit-Sengupta for your first contribution 🎉!
- [5b50683](https://github.com/posthog/posthog-python/commit/5b506837995c1ddbb007e8822221552c21b06748) Stringify non-string properties as compact JSON for local `regex` and `not_regex` matching, so booleans, lists, and objects match the same way they do on the flags service. — Thanks @luantaraschi!
- [a239479](https://github.com/posthog/posthog-python/commit/a239479585d5c5367843ec088e49f52010223d08) Serialize UUID values in feature flag request bodies instead of failing the evaluation, so a UUID distinct id, group key, or flag property reaches the flags service. — Thanks @luantaraschi!

</Release>

<Pagination cursor="2026-11-02T16:28:34.000Z|2026-11-02T19:39:23.810Z|rel_bnx6Qe3JYjokjbtHrD1Ji" next="https://releases.sh/posthog/posthog-python.md?cursor=2026-11-02T16%3A28%3A34.000Z%7C2026-11-02T19%3A39%3A23.810Z%7Crel_bnx6Qe3JYjokjbtHrD1Ji&limit=20" />
