Skip to main content

Introduction

BackSearchToolset gives an agent web search and page fetch bounded to a cutoff date — “the web as it existed on or before date X”. Every request carries an as_of date and the backing archive only returns documents archived on or before it: news, SEC filings, Wikipedia and the general web by default, plus arXiv on request. This is what makes the tools leakage-safe for evaluation and prediction tasks: an agent researching a question dated to the past never sees anything published after the cutoff. There are two ways to use it:
  • As an environment toolset — declare BackSearchToolset and the agent gets web_search / web_fetch tools.
  • Standalone — call Backsearch / Backfetch directly from any Python or agent loop, no environment required.
Requires openreward >= 0.1.134; corpus selection (OPENREWARD_WEB_CORPUS) and automatic retries need >= 0.1.157. The web tools authenticate with your standard OPENREWARD_API_KEY — no separate key is needed.
BackSearchToolset is always backed by the backdated corpus — it ignores OPENREWARD_SEARCH_BACKEND, so its point-in-time guarantee cannot be switched off by configuration. If you want the same two tools with a swappable provider (Tavily and others), use WebToolset instead.

Configuration

The only required setting is your OpenReward API key (the same key the rest of the SDK uses). In a hosted environment it is forwarded automatically as a session secret.
Search runs over a frozen archive. An as_of before a source’s first capture returns nothing from that source, not an error. See What is in the archive for the coverage of each source.

Choosing corpora

By default a search fans out across news, SEC filings, Wikipedia and the general web. arXiv is held out of that set because papers are noise on most non-academic queries, so an environment that needs the literature names it:
Naming corpora replaces the default set. An unrecognised name is silently ignored (matching is case-sensitive), so a typo returns ordinary results rather than an error — check the corpus field on each hit in result.data["hits"] to confirm what served. The corpus names are listed in the API reference.

Using the toolset in an environment

Declare BackSearchToolset at class level. Unlike the harness toolsets, it is not sandbox-backed — it talks to the web service over HTTP — so your environment does not need a self.sandbox.
The agent then sees two tools:

Selecting it by name in a session

BackSearchToolset is a registered built-in, so a client can also attach it to a session by name:

Composing with other toolsets

Because it needs no sandbox, BackSearchToolset composes cleanly with sandbox-backed toolsets — e.g. web research plus a file workspace:
All tools from both toolsets are exposed, and the framework rejects duplicate tool names. BackSearchToolset uses web_search / web_fetch, which do not collide with the file/CLI toolsets.

Progressing the cutoff

The cutoff is resolved on every tool call, in priority order:
  1. an explicit as_of= passed to the toolset constructor (a static pin), else
  2. env.web_as_of, else
  3. the OPENREWARD_WEB_AS_OF environment variable, else
  4. the backend default (today).
Because env.web_as_of is read live — not snapshotted when the toolset is built — an environment whose simulated clock advances stays correctly bounded to its current day. Expose it as a @property or a callable:
This matters because the framework builds and caches one toolset instance per environment for the whole session — a construction-time snapshot would freeze the date at the first call.

Standalone usage

The same backdated search and fetch are available without an environment:
Backsearch returns up to 8 hits per call (k=8 by default). Both run(...) calls return a WebToolResult: Backsearch.run accepts allowed_domains / blocked_domains and a per-call as_of; Backfetch.run takes a url, a prompt, and a per-call as_of.

Notes

  • Citations. Search output is formatted so the model is reminded to cite the returned URLs as markdown links in its final answer.
  • Caching. Fetches are cached in-process for 15 minutes, keyed by (cutoff, url), so repeated fetches at the same cutoff are fast and never mix content across dates.
  • Retries. Transient backend failures (connection errors, 429, 5xx) are retried with exponential backoff, 3 attempts by default. Policy decisions and other 4xx responses are never retried. Tune with OPENREWARD_WEB_MAX_ATTEMPTS and OPENREWARD_WEB_BACKOFF_BASE_S.
  • Soft errors. Bad inputs (unparseable URL, blocked domain, missing key) come back as a normal result with .ok == False and a clear message rather than as an exception, so an agent can read it and recover.

Next Steps

Using Toolsets

Compose document toolsets and build custom ones

Harness Toolsets

Expose agent-native CLI tool surfaces backed by a sandbox

Building Agentic Environments

Create sandbox-based environments from scratch

Keeping Secrets Secret

How API keys and secrets reach your environment

BackSearch API

The same engine as a standalone HTTP API, with coverage and field reference