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.
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);Getting started
Install the SDK and get a working agent into your app fast.
Native providers
Connect OpenAI, Anthropic, Azure, Bedrock, Vertex, or any compatible endpoint with no extra dependencies.
Architecture
The base loop, the smart wrapper, and where runtime decisions actually happen.
Planning for autonomous agents
Durable plans that live on result.state.plan instead of transient UI events.
Skills & progressive disclosure
Expose cheap capability headers first, then let the model open skills and bind only what it needs.
API reference
Agent construction, tools, adapters, prompting, state, and runtime internals.
Examples
Runnable patterns for tools, planning, summarization, sub-agents, guardrails, and more.
Release notes
What shipped, release by release.
Contributing
How the project is developed and how to propose changes.
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
- Getting started — a working agent into your app, fast.
- Core concepts — what lives in state, what's an event, and what gets summarized.
- Skills & progressive disclosure — for agents with a large or optional tool catalog.
- Architecture — the smart wrapper, the base loop, and where runtime decisions are made.

