Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(warehouse-sources): add tavus memory_stores table (#113857)

Tom Owerse6c0286e09ef
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
index 175825fcaa4c..4c372636989e 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
@@ -8583,6 +8583,7 @@ Diffed against: <https://docs.tavus.io/openapi.yaml>
- [ ] `GET /v2/voices` — Lookup table resolving the voice ID configured on PALs and videos (medium)
- [ ] `GET /v2/lipsync` — Lipsync generation jobs with status and duration, a sibling of the synced videos table (low)
- [ ] `GET /v2/replacements` — Replacement (background swap) jobs with status (low)
+- [x] `GET /v2/memory-stores` — Memory stores, one per PAL and participant tag, showing which participants each PAL keeps memory for (medium)
Note: Important: the current spec no longer contains /v2/personas or /v2/replicas - they have been superseded by /v2/pals and /v2/faces. Two of PostHog's four synced tables therefore target endpoints absent from today's API reference and should be re-verified against a live account. Static 4-endpoint config in sources/tavus/settings.py, no dynamic discovery; the spec exposes 20 GET list endpoints.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/canonical_descriptions.py
index 0e883b59c446..280dc8d47b21 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/canonical_descriptions.py
@@ -66,4 +66,13 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"updated_at": "The timestamp when the conversation was last updated.",
},
},
+ "memory_stores": {
+ "description": "A Tavus memory store — the persistent memory one PAL keeps for one participant across conversations.",
+ "docs_url": "https://docs.tavus.io/api-reference/memory-stores/list-memory-stores",
+ "columns": {
+ "memory_store_id": "The unique ID of the memory store.",
+ "pal_id": "The ID of the PAL this memory store belongs to.",
+ "participant_tag": "The developer-provided identifier of the participant this memory store is for.",
+ },
+ },
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/settings.py
index 122ba71b9565..b1de009517d3 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/settings.py
@@ -2,7 +2,7 @@ from dataclasses import dataclass, field
from typing import Optional
-@dataclass
+@dataclass(frozen=True)
class TavusEndpointConfig:
name: str
path: str
@@ -12,6 +12,8 @@ class TavusEndpointConfig:
# A stable (never-rewritten) creation timestamp to partition by. Left unset because the
# Tavus list envelopes cannot be curl-verified for a guaranteed creation field.
partition_key: Optional[str] = None
+ # False for list endpoints that return every row in one response, with no page/limit params.
+ paginated: bool = True
# Tavus v2 list endpoints. All are full-refresh only: the list endpoints expose no server-side
@@ -21,6 +23,9 @@ TAVUS_ENDPOINTS: dict[str, TavusEndpointConfig] = {
"replicas": TavusEndpointConfig(name="replicas", path="/replicas", primary_keys=["replica_id"]),
"personas": TavusEndpointConfig(name="personas", path="/personas", primary_keys=["persona_id"]),
"conversations": TavusEndpointConfig(name="conversations", path="/conversations", primary_keys=["conversation_id"]),
+ "memory_stores": TavusEndpointConfig(
+ name="memory_stores", path="/memory-stores", primary_keys=["memory_store_id"], paginated=False
+ ),
}
ENDPOINTS = tuple(TAVUS_ENDPOINTS.keys())
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/source.py
index 264649fa2cda..9df09dc0ef2a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/source.py
@@ -53,7 +53,7 @@ class TavusSource(ResumableSource[TavusSourceConfig, TavusResumeConfig]):
releaseStatus=ReleaseStatus.ALPHA,
caption="""Enter your Tavus API key to pull your Tavus data into the PostHog Data warehouse.
-You can generate an API key in the [Tavus Developer Portal](https://platform.tavus.io/api-keys). This single key grants read access to your videos, replicas, personas, and conversations.
+You can generate an API key in the [Tavus Developer Portal](https://platform.tavus.io/api-keys). This single key grants read access to your videos, replicas, personas, conversations, and memory stores.
""",
iconPath="/static/services/tavus.png",
docsUrl="https://posthog.com/docs/cdp/sources/tavus",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/tavus.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/tavus.py
index d32867f0674b..6f88e7992410 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/tavus.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/tavus.py
@@ -122,6 +122,7 @@ def tavus_source(
# The list envelope always carries `data`; a 200 missing it means the response
# shape changed — fail loud instead of silently advancing past lost rows.
"data_selector_required": True,
+ **({} if config.paginated else {"paginator": "single_page"}),
},
}
],
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/tests/test_tavus.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/tests/test_tavus.py
index 15e5908e978e..35e48c30e3a6 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/tests/test_tavus.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tavus/tests/test_tavus.py
@@ -141,6 +141,21 @@ class TestPagination:
assert params[0]["page"] == 1
assert [r["video_id"] for r in rows] == ["c"]
+ @mock.patch(CLIENT_SESSION_PATCH)
+ def test_unpaginated_endpoint_fetches_once_without_page_params(self, MockSession) -> None:
+ # /memory-stores returns every store with no total_count, so a full page must not trigger page 1.
+ session = MockSession.return_value
+ stores = [{"memory_store_id": f"m_{i}", "pal_id": "p_1", "participant_tag": f"user_{i}"} for i in range(100)]
+ params = _wire(session, [_response(stores)])
+
+ manager = _make_manager()
+ rows = _rows(_source(manager, endpoint="memory_stores"))
+
+ assert len(rows) == 100
+ assert session.send.call_count == 1
+ assert "page" not in params[0] and "limit" not in params[0]
+ manager.save_state.assert_not_called()
+
@mock.patch(CLIENT_SESSION_PATCH)
def test_missing_data_key_raises_loudly(self, MockSession) -> None:
session = MockSession.return_value
@@ -197,6 +212,7 @@ class TestTavusSourceResponse:
("replicas", "replica_id"),
("personas", "persona_id"),
("conversations", "conversation_id"),
+ ("memory_stores", "memory_store_id"),
]
)
def test_primary_key_matches_endpoint_config(self, endpoint: str, primary_key: str) -> None:
@@ -213,5 +229,6 @@ class TestTavusSourceResponse:
"replicas": ["replica_id"],
"personas": ["persona_id"],
"conversations": ["conversation_id"],
+ "memory_stores": ["memory_store_id"],
}
assert set(TAVUS_ENDPOINTS) == set(ENDPOINTS)