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.
Web search
Section titled “Web search”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/webImage search
Section titled “Image search”const images = await client.searchImages({ query: "data center aisle", count: 5 });// POST /agent/search/imagescount is 1 to 20, and defaults to 10.
News search
Section titled “News search”const news = await client.searchNews({ query: "GPU supply", count: 5, offset: 0 });// POST /agent/search/newsThis takes the same query, count, and offset as web search.
Broad news corpus
Section titled “Broad news corpus”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/headlinesEach 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.
Cancel a search
Section titled “Cancel a search”The three search* methods accept an AbortSignal as a second argument.
await client.searchWeb({ query: "…" }, { signal: AbortSignal.timeout(5_000) });Related resources
Section titled “Related resources”- Agent API overview — the client and its errors.
- Billing overview — how metered usage draws on credits.