Skip to content

Search and news

An agent can search the web and the news without holding its own provider keys. Alfe makes the call and meters it against your credits. See live pricing for rates.

All examples use the @alfe.ai/agent-api-client.

search.ts
const results = await client.searchWeb({
query: "agent memory architectures", // up to 400 characters
count: 10, // 1 to 20, default 10
offset: 0, // 0 to 9, default 0
});
// POST /agent/search/web
const images = await client.searchImages({ query: "data center aisle", count: 5 });
// POST /agent/search/images

count is 1 to 20, and defaults to 10.

const news = await client.searchNews({ query: "GPU supply", count: 5, offset: 0 });
// POST /agent/search/news

This takes the same query, count, and offset as web search.

The news methods search a larger corpus with date, source, and language filters. They return normalized articles.

const { articles } = await client.newsSearch({
query: "chip export rules",
from: "2026-10-01",
to: "2026-11-01",
language: "en",
limit: 20,
});
// POST /agent/news/search
const { articles: top } = await client.newsHeadlines({ category: "technology", limit: 10 });
// POST /agent/news/headlines

Each article has title, url, source, publishedAt, and snippet, and may have sentiment. provider optionally picks the source corpus (apitube or newsdata). newsdata allows at most 50 results and needs dates as YYYY-MM-DD. The maximum limit is otherwise 100.

The three search* methods accept an AbortSignal as a second argument.

await client.searchWeb({ query: "…" }, { signal: AbortSignal.timeout(5_000) });