Skip to content

Agent SDK · Flagship

@cognipeer/agent-sdk

A smart runtime for autonomous agents, in plain TypeScript. Typed tools, explicit planning, configurable reasoning, resilient context handling, and inspectable execution — without a framework in the way.

  • Package @cognipeer/agent-sdk
  • Language TypeScript
  • Providers OpenAI · Anthropic · Azure · Bedrock · Vertex · any OpenAI-compatible endpoint

The SDK calls model providers directly over fetch — no framework required — with a unified schema and full token accounting across input, output, cache, and reasoning tokens. On top of that minimal loop sits a smart runtime: reasoning and reflection, runtime profiles for different agent behaviors, durable planning, summarization with recovery paths, skills for large tool catalogs, and pause/resume with human approval gates.

ts
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" }),
});

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);

What the runtime gives you

Native providers, no framework required

Call OpenAI, Anthropic, Azure, Bedrock, Vertex, and any OpenAI-compatible API directly with fetch. One unified schema, full token tracking, streaming built in.

Reasoning and reflection

One reasoning config enables provider-native reasoning plus post-tool plain-text reflections. Notes persist on state.reflections and stream through reflection events.

Runtime profiles for different agent behaviors

fast, balanced, deep, and research are real tradeoff bundles for context budget, delegation depth, memory policy, and summarization behavior — not just labels.

Summarization with recovery paths

Long-running agents compact tool-heavy history without going blind. Archived outputs stay recoverable through get_tool_response when the agent needs raw evidence again.

State, resume, and human control

Pause execution, snapshot state, restore later, and gate risky tools through approvals without losing the agent's working context.

Tracing, debugging, and evaluation

Inspect tool calls, summaries, handoffs, token drift, and partial sink failures through structured traces built for real operational debugging.

Where to go next

Studio · Pulse · Console · Agent SDK and more — the Cognipeer documentation hub