Native LLM Providers — No Framework Required
Call OpenAI, Anthropic, Azure, Bedrock, Vertex, and any OpenAI-compatible API directly with fetch. Unified schema, full token tracking (input/output/cached/reasoning), and streaming built-in.
Typed tools, explicit planning, configurable reasoning, resilient context handling, and inspectable execution — without leaving plain TypeScript.
If you are integrating the SDK for the first time, read the docs in this order:
import { createSmartAgent, createTool, createProvider, fromNativeProvider } from "@cognipeer/agent-sdk";
import { z } from "zod";
const lookup = createTool({
name: "lookup_owner",
description: "Return the owner for a project code",
schema: z.object({ code: z.enum(["ORBIT", "NOVA"]) }),
func: async ({ code }) => ({ owner: code === "ORBIT" ? "Ada Lovelace" : "Grace Hopper" }),
});
// OpenAI, Anthropic, Azure, Bedrock, Vertex, or any compatible endpoint
const model = fromNativeProvider(
createProvider({ provider: "openai", apiKey: process.env.OPENAI_API_KEY! }),
{ model: "gpt-4o" },
);
const agent = createSmartAgent({
model,
tools: [lookup],
runtimeProfile: "balanced",
planning: { mode: "todo" },
limits: { maxToolCalls: 6, maxContextTokens: 12000 },
});
const result = await agent.invoke({
messages: [{ role: "user", content: "Compare ORBIT and NOVA." }],
});
console.log(result.content);