Ask an AI agent today what people knew about an election, an earnings call or a software release before it happened, and it will happily find pages that already report the outcome. That makes honest evaluation of research agents and forecasting pipelines very hard. On 25 November 2026 Perplexity shipped a fix for this: Time Machine, a new snapshot_as_of parameter for its Search API and Context API that shows your agent the web as it was at a chosen moment.
This guide explains how Time Machine works, walks through working Python and cURL examples, and shows a practical “backtest your agent” pattern you can drop into an evaluation harness.
What Time Machine actually does
Every time Perplexity crawls a page for its index, it saves a copy along with the time the copy was saved. Over time each URL builds a version history. When you add snapshot_as_of to a request, Perplexity answers from that history instead of the live web:
- Search only considers pages that were published (or first crawled) by the cutoff.
- The cutoff is compared with the time a copy was saved, not with a date printed on the page.
- Each result uses the page’s latest copy saved at or before the cutoff, so its
title,snippetanddateall come from that older copy. - The Context API returns the full text of each page as stored at the cutoff. The live site is never contacted.
The response format is the same as a normal search, except that last_updated is omitted. According to the official Time Machine docs, there is no new endpoint and no setup: you add one field to requests you already make.
The rules you need to know
Before writing code, note the constraints from the documentation:
| Rule | Detail |
|---|---|
| Format | RFC 3339 timestamp with a time zone, e.g. 2026-11-01T00:00:00Z |
| Range | Not in the future and not more than 365 days ago |
| Works with | search_domain_filter and search_language_filter |
| Cannot combine with | search_recency_filter, the date filters, and People Search |
| SDK versions | perplexityai 0.50.0+ (Python), @perplexity-ai/perplexity_ai 0.45.0+ (TypeScript) |
Breaking a rule returns HTTP 400 with "type": "invalid_request" and a clear message such as snapshot_as_of must not be older than 365 days.
Limits matter. Time Machine requests have their own quota. On usage tiers 1–5 you get 50 Time Machine requests in total to each API, and each request counts as one unit even if it carries several queries or URLs. Over the limit you get a 429. Perplexity says pricing is the same as any other call (the launch post lists $5 per 1,000 Search requests and $1 per 1,000 URLs fetched through the Context API), but plan your evaluation runs around that small default quota, or contact Perplexity to raise it.
Step 1: Install the SDK and set your key
pip install --upgrade "perplexityai>=0.50.0"
export PERPLEXITY_API_KEY="pplx-..."
Step 2: Search the web as it was
This example asks for the latest stable Python release as python.org showed it 30 days ago. In Python, snapshot_as_of takes a timezone-aware datetime.
from datetime import datetime, timedelta, timezone
from perplexity import Perplexity
client = Perplexity() # reads PERPLEXITY_API_KEY
cutoff = datetime.now(timezone.utc) - timedelta(days=30)
search = client.search.create(
query="latest stable Python release",
snapshot_as_of=cutoff,
search_domain_filter=["python.org"],
max_results=5,
)
for r in search.results:
print(f"{r.date} {r.title}\n {r.url}")
A naive datetime (no tzinfo) is the most common mistake. Always build the cutoff with timezone.utc or an explicit offset.
The same request with cURL, using a fixed timestamp:
curl --fail-with-body https://api.perplexity.ai/search \
-H "Authorization: Bearer $PERPLEXITY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "latest stable Python release",
"snapshot_as_of": "2026-11-01T00:00:00Z",
"search_domain_filter": ["python.org"],
"max_results": 5
}'
Step 3: Read full pages at the same cutoff
Search results give you snippets. To let an agent actually read the pages, pass the URLs to the Context API with the same snapshot_as_of. Pages that cannot be shown as of the cutoff are omitted from search, so a search may return fewer results than max_results, or none. The Context API needs at least one URL, so guard for that:
if search.results:
ctx = client.context.create(
urls=[r.url for r in search.results],
snapshot_as_of=cutoff,
)
for page in ctx.results:
if page.status.type == "ok":
print(page.url, "->", page.metadata.title)
else:
# e.g. "no_content" when no stored copy exists for that time
print(page.url, "skipped:", page.status.type)
Using one cutoff for both steps is the whole point: the agent cannot accidentally “peek” at a newer version of a page while reading it.
A practical pattern: backtesting a research agent
Here is a small harness that freezes the web at a question’s “asked on” date, collects evidence, and stores it for later scoring against the known answer. Plug in your own model call where indicated.
from dataclasses import dataclass
from datetime import datetime, timezone
from perplexity import Perplexity
client = Perplexity()
@dataclass
class Case:
question: str
asked_on: datetime # timezone-aware
known_answer: str
domains: list[str] | None = None
def gather_evidence(case: Case, k: int = 3) -> list[str]:
kwargs = {"query": case.question, "snapshot_as_of": case.asked_on, "max_results": k}
if case.domains:
kwargs["search_domain_filter"] = case.domains
hits = client.search.create(**kwargs).results
if not hits:
return []
pages = client.context.create(urls=[h.url for h in hits],
snapshot_as_of=case.asked_on).results
return [p.url for p in pages if p.status.type == "ok"]
cases = [
Case("Which Python version is the newest stable release?",
datetime(2026, 10, 20, tzinfo=timezone.utc), "<fill in>", ["python.org"]),
]
for c in cases:
evidence = gather_evidence(c)
# answer = my_agent(c.question, evidence) # your model call here
print(c.question, "| evidence:", evidence)
Because every case uses one Search request and at most one Context request, you can estimate quota use up front: N cases cost about N units on each API. With the default 50-unit allowance, start with a focused set of high-value questions.
Using it inside agent tools
If you use Perplexity’s Agent API rather than calling Search directly, the docs say you set snapshot_as_of inside the filters of the web_search and fetch_url tools. That lets you run a whole tool-calling agent “in the past” without changing your orchestration code.
Gotchas
- Copies, not publish dates. A page published long ago but first crawled after your cutoff will not appear.
- No mixing with recency filters. Remove
search_recency_filterand date filters from shared request builders when Time Machine is on, or you will get a 400. - 365-day window. Evaluation sets older than a year cannot use this feature today.
- Fewer results are normal. Treat empty results as “nothing knowable at that time”, not as an error.
Takeaway
Time Machine turns “what did the web say back then?” into a single request parameter. For anyone building research agents, RAG pipelines or forecasting tools, it makes fair, leak-free evaluation practical: freeze the web at the question date, let the agent search and read, then score against what really happened. Start with a small benchmark that fits the default quota, keep the same cutoff for search and reading, and you will finally know whether a new model or prompt actually improved your agent.
Sources: Perplexity blog – Freeze the web with Perplexity Time Machine · Time Machine documentation · Search API reference
