SDK
Typed clients for TypeScript and Python. Both read your key from AREX_API_KEY.
TypeScript
research.run creates a Run and waits for the answer; research.create, get, wait, cancel and delete handle each step. Errors are ArexError subclasses.
Shell
npm install @arex-research/ts-sdkTypeScript
import { Arex } from "@arex-research/ts-sdk";
const arex = new Arex(); // reads AREX_API_KEY
const { results } = await arex.search("how are AI agents evaluated", { limit: 5 });
for (const { url } of results) {
const page = await arex.contents(url, { maxCharacters: 4000 });
}
const run = await arex.research.run("Compare agent evaluation benchmarks", { mode: "fast" });
console.log(run.result.answer);Python
Requires Python 3.10 or later. AsyncArex offers the same calls with async.
Shell
pip install arex-python-sdkPython
from arex import Arex
with Arex() as arex: # reads AREX_API_KEY
search = arex.search("how are AI agents evaluated", limit=5)
for item in search.results:
page = arex.contents(item.url, max_characters=4000)
run = arex.research.run("Compare agent evaluation benchmarks", mode="fast")
assert run.result is not None # always set once run() returns
print(run.result.answer)As agent tools
Wrap the SDK calls as tools in Pi SDK or LangGraph.
import { Arex } from "@arex-research/ts-sdk";
const arex = new Arex(); // reads AREX_API_KEY
export const arexTools = [
{
name: "arex_search",
description: "Search the web for ranked URLs and snippets.",
parameters: {
type: "object",
properties: { query: { type: "string" }, limit: { type: "number" } },
required: ["query"],
},
execute: async ({ query, limit = 5 }: { query: string; limit?: number }) =>
arex.search(query, { limit }),
},
{
name: "arex_contents",
description: "Read clean markdown text from a public URL.",
parameters: {
type: "object",
properties: { url: { type: "string" } },
required: ["url"],
},
execute: async ({ url }: { url: string }) =>
arex.contents(url, { maxCharacters: 8000 }),
},
{
name: "arex_research",
description: "Answer a question with cited web sources in one call.",
parameters: {
type: "object",
properties: { query: { type: "string" } },
required: ["query"],
},
execute: async ({ query }: { query: string }) =>
arex.research.run(query, { mode: "fast" }),
},
];