Framework
A web research agent may need several sources within one response deadline. Select the search adapters, define which sites the agent can use, and keep enough attribution to tell a reader where a result came from.
Agents reach the public web through @open-mercato/web-research: an engine that
runs several search sources concurrently under one deadline, fuses their results,
and narrates what it did. Each source is a separate npm package, so a deployment
installs only what it uses and anyone can publish their own.
The previous implementation picked one provider from an env var. That meant a single point of failure (one 429 starved the whole run), no way to combine a fast free source with an accurate paid one, and – because the default adapter returned bare URLs with empty snippets – an agent had to spend a page fetch per link before it learned anything.
The engine addresses each of those directly:
unavailable (no key), empty
(nothing matched), blocked (429/captcha), timeout and error are distinct,
because each one should produce different behaviour. Collapsing them into a
thrown error – as the old code did – makes them indistinguishable.degraded.| Package | id | Notes |
|---|---|---|
@open-mercato/web-research-model | model-native | Uses the agent's own LLM with its native web search. No extra key, no extra vendor. Enabled by default. Works on Anthropic, OpenAI and Azure OpenAI / Foundry. |
@open-mercato/web-research-serp | serp-html | Our own crawler over public SERP HTML. Free, no key, no dependencies. Off by default – enabling it is the operator's decision. |
@open-mercato/web-research-firecrawl | firecrawl | Keyed API that returns page content inline. |
@open-mercato/web-research-tavily | tavily | Keyed API oriented at LLM consumption. |
@open-mercato/web-research-exa | exa | Keyed API with an embeddings index. Filters by domain and publication date natively, and returns the passages it judged relevant rather than a page preview. Priced per call and reports the cost of each search in the live step feed. |
@open-mercato/web-research-searxng | searxng | Client for an instance you run. SearXNG is AGPL-3.0, so we ship the client only. |
@open-mercato/web-research-browser | browser | Renders blocked SERPs and JavaScript-only pages in a Playwright sidecar. Ships Playwright as a dependency and downloads the Chromium binary on first use, so installing the package is the only step. |
readiness() is synchronous and
I/O-free, so an unconfigured adapter is skipped before it costs anything – and
is reported as skipped, with the reason.concurrency adapters start at once; each time one settles the next
queued adapter starts.race resolves on the first adapter that meets the minimum;
quorum (default) waits for minAdapters successes; exhaustive runs
everything. Past the soft deadline the engine only keeps waiting while it has
nothing at all – holding back a usable answer for a straggler is the worse
failure.blocked/empty and a browser adapter
is ready, the scheduler runs it. This decision is made in code, not by
prompting the model, so it costs no round-trip and behaves the same every time.Note · Why reciprocal rank, not blended scores
An LLM citation list has no score at all, a SERP has an opaque one, and a paid API has its own scale. Rank is the only signal every source genuinely agrees on, and RRF naturally rewards a result that two independent sources both surfaced.
Env is the deployment default; a tenant row overrides it. Edit it at Agents → Web search, which also shows per-adapter health.
OM_WEB_SEARCH_ADAPTERS=serp-html,model-native # ordered; default: model-native
OM_WEB_SEARCH_SETTLE_MODE=quorum # race | quorum | exhaustive
OM_WEB_SEARCH_CONCURRENCY=2
OM_WEB_SEARCH_MIN_RESULTS=5
OM_WEB_SEARCH_SOFT_DEADLINE_MS=6000
OM_WEB_SEARCH_HARD_DEADLINE_MS=15000
OM_WEB_SEARCH_LAST_RESORT=model-native
OM_WEB_SEARCH_ALLOW_DOMAINS= # empty = allow all
OM_WEB_SEARCH_DENY_DOMAINS=
OM_WEB_SEARCH_ALLOW_PRIVATE_HOSTS= # empty = every private address refused
Azure exposes web_search as a Responses API built-in, and model-native
picks it up automatically once the agent's provider is azure. Two things follow
from how Azure implements it, and both are worth a deliberate decision rather
than a discovery:
An admin can also block the tool for a whole subscription
(az feature register --name OpenAI.BlockedTools.web_search …), in which case the
adapter reports unavailable rather than a transient error.
Azure is configured with AZURE_OPENAI_API_KEY plus either
AZURE_OPENAI_RESOURCE_NAME (preferred – the SDK assembles the endpoint) or
AZURE_OPENAI_BASE_URL pointing at the /openai prefix.
agent_orchestrator.web_search returns ranked results with snippets, confidence
and provenance, an optional prose answer, and a diagnostics block naming what
each adapter did. Setting includeContent: true reads the top pages in the same
call – prefer it over a fetch per result.
agent_orchestrator.web_fetch retrieves one URL as readable text. render: 'auto'
(the default) escalates to the browser tier only when the plain read classifies as
a JavaScript shell.
Both are read-only. web_search needs the agent_orchestrator.web_search ACL
feature; web_fetch needs that and agent_orchestrator.web_fetch, so a tenant
can be granted discovery without arbitrary URL retrieval.
All egress goes through one hardened client. Adapters never call fetch
themselves – that would bypass every control below in a single step.
new URL('http://[::ffff:127.0.0.1]/').hostname is
::ffff:7f00:1, which a dotted-quad check never matches). The guard also blocks
the entire local-use IPv4/IPv6 translation prefix 64:ff9b:1::/48 and 6to4
addresses (2002::/16) whose embedded IPv4 destination is non-public. Public
IPv6, including 6to4 and well-known NAT64 addresses embedding public IPv4,
remains allowed. These checks apply to literals and DNS answers in both the
HTTP client and browser proxy. Whether a local-use destination could reach an
internal service depends on the deployment's IPv6 routing.web_fetch; add it to the deny list as well when only an adapter
should talk to it. The browser tier never gets this – it renders public pages
only.lastResort, which
otherwise bypasses enabled on exactly the short runs the ceiling exists for.OM_WEB_RESEARCH_BROWSER_NO_SANDBOX=1
is the explicit, logged opt-out for environments that genuinely cannot.Every adapter transition emits agent_orchestrator.web_search.progress
(clientBroadcast), so an operator watching a run sees which source was queried,
whether it answered or was blocked, and why. Payloads are summary-only – the SSE
frame cap is 4KB – and are never returned to the model, which gets the compact
diagnostics block instead.
Run the om-create-web-research-adapter skill, or follow
packages/web-research/AGENTS.md. The shape:
export const myAdapterModule = defineAdapterModule({
id: 'my-source',
kind: 'api', // 'serp' | 'api' | 'model' | 'browser'
contractVersion: CONTRACT_VERSION,
optionsSchema: z.object({ apiKey: z.string().min(1).optional() }),
createAdapter: (options) => ({
id: 'my-source',
kind: 'api',
capabilities: { search: true, fetch: false, snippets: true, content: false,
freshness: false, siteFilter: true, cost: 'metered' },
readiness: () => (options.apiKey ? READY : notReady('API key is not set')),
async search(request, context) {
try {
const response = await context.http.request(/* … */)
return searchOk(/* … */)
} catch (error) {
return toOutcomeFailure(error)
}
},
}),
})
Declare it in your package.json and the generator finds it:
{ "openMercato": { "webResearchAdapter": { "id": "my-source" } },
"peerDependencies": { "@open-mercato/web-research": "^0.6.0" } }
Then yarn add @acme/web-research-my-source && yarn generate. It appears in the
settings page with a form built from your own optionsSchema, disabled until an
operator enables it.
@open-mercato/web-research/testing publishes describeAdapterContract() – the
same suite the shipped adapters run. It pins the behaviour the scheduler depends
on, most importantly that an adapter reports rather than throws.
Warning · A broken adapter must not break the others
The MCP server loads every module tool through one ESM graph, where a single
failed import drops all of them. The loader therefore converts any adapter fault – bad descriptor, contract-version mismatch, invalid options, a constructor that
throws – into an unavailable placeholder carrying the reason, so it shows up as
one skipped adapter instead of a missing tool set.