@aimpathyminds/yaagents-client
v0.4.0
Published
YAAgents TypeScript client — Agentic REST Profile v0.3
Maintainers
Readme
@aimpathyminds/yaagents-client
TypeScript client for the YAAgents Agentic REST Profile v0.2.
- Zero runtime dependencies — uses the global
fetchAPI (Node ≥ 18 / all modern browsers) - Dual ESM + CJS bundle with shipped
.d.tstypes - Discriminated-union result style (
result.type === "clarification_required") and exception-style (client.strict()) helpers - Declares YAAgents Profile v0.2 support
Install
npm install @aimpathyminds/[email protected]Or with pnpm:
pnpm add @aimpathyminds/[email protected]Quick start
import { YaAgentsClient, PROFILE_VERSION } from "@aimpathyminds/yaagents-client";
const client = new YaAgentsClient({
baseUrl: "https://api.example.com",
token: process.env.YAAGENTS_TOKEN!,
tenantId: "tenant-1",
});
// Result-style (discriminated union — never throws)
const result = await client.campaigns.byId("c1").optimizations().create({ goal: "ctr" });
if (result.type === "clarification_required") {
console.log("Needs input:", result.requiredInputs);
}
// Exception-style (strict mode — throws typed AgenticErrorBase subclass)
const strict = client.strict();
const data = await strict.campaigns.byId("c1").optimizations().create({ goal: "ctr" });License
Apache-2.0 — see ../LICENSE.
