import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
await client.agents.createAgent({
body: {
name: "fast-searcher",
description: "Searches the web quickly in text mode. Use for broad lookups.",
model: "holo4-35b-a3b",
environments: [{ id: "search-browser", kind: "web", mode: { type: "text" }, startUrl: "https://www.bing.com" }],
},
});
await client.agents.createAgent({
body: {
name: "visual-verifier",
description: "Visually inspects a page. Use to confirm a fact or read content behind interactions.",
environments: ["h/browser"],
},
});
await client.agents.createAgent({
body: {
name: "research-orchestrator",
description: "Splits research across subagents and merges one sourced report.",
environments: [],
subagents: ["fast-searcher", "visual-verifier"],
},
});
const result = await client.runSession({
agent: "research-orchestrator",
messages: "Compare the starting price of the latest Apple, Google, and Samsung flagship phones, with source URLs.",
});
console.log(result.answer);