Skip to content

SDK Overview

Seepient Agent is a headless AI agent framework for building LLM-powered applications. The SDK provides a functional, composable API -- no class hierarchies, no boilerplate. Import a function, pass a prompt, get a result.

Architecture

Seepient Agent is organized in three layers of increasing statefulness:

askSeepient()    -- One-shot. Stateless. No memory between calls.
createSeepient() -- Stateful. Multi-turn with session persistence.
Server           -- Remote. REST + WebSocket for distributed deployments.

Every layer delegates to the same core agent loop, so tool execution, hook lifecycle, abort handling, and usage tracking behave identically regardless of which entry point you use.

Functional API philosophy

The SDK is built around plain functions and plain objects, not class instances:

  • askSeepient(prompt, options?) -- returns a Promise<AskSeepientResult>, or a Promise<AskSeepientStreamResult> with async iterables when { stream: true }
  • createSeepient(options?) -- returns a Promise<Seepient> with .chat(), .chatStream(), and lifecycle methods

Configuration is passed as options objects. Return types are plain interfaces. There are no base classes to extend.

Installation

Prerequisites

Seepient Agent requires Node.js >= 22.19.0.

bash
npm install seepient
bash
pnpm add seepient
bash
yarn add seepient

Import patterns

typescript
import { askSeepient, createSeepient } from "seepient";
typescript
import type {
  AskSeepientOptions,
  AskSeepientResult,
  AskSeepientStreamResult,
  Seepient,
} from "seepient";
typescript
import { trustedHostTool, preparedTool, brokerConnector, CORE_TOOLS, COMM_TOOLS, ADVANCED_TOOLS, ALL_TOOLS } from "seepient";
typescript
import { settings, gateway, createProviderManagerApi } from "seepient";
typescript
import { runSeepientServer } from "seepient/server";

Quick examples

One-shot text generation

typescript
import { askSeepient } from "seepient";

const result = await askSeepient("Explain recursion in one paragraph");
console.log(result.text);
console.log(result.usage.totalTokens);

Streaming

typescript
import { askSeepient } from "seepient";

const stream = await askSeepient("Write a haiku about programming", {
  stream: true,
  onText: (delta) => process.stdout.write(delta),
});

const finalText = await stream.fullText;

Multi-turn agent

typescript
import { createSeepient } from "seepient";

const agent = await createSeepient({
  model: "gpt-5.4",
  systemPrompt: "You are a concise coding assistant.",
});

const reply = await agent.chat("What is a closure in JavaScript?");
console.log(reply.text);

// Context is preserved -- follow-up questions work naturally
const followUp = await agent.chat("Show me an example");
console.log(followUp.text);

Custom tools

typescript
import { askSeepient, trustedHostTool } from "seepient";

const weatherTool = trustedHostTool({
  definition: {
    type: "function",
    function: {
      name: "get_weather",
      description: "Get the current weather for a city",
      parameters: {
        type: "object",
        properties: {
          city: { type: "string", description: "City name" },
        },
        required: ["city"],
      },
    },
  },
  execute: async (args) => {
    const { city } = (args ?? {}) as { city: string };
    return `Weather in ${city}: 72F, sunny`;
  },
});

const result = await askSeepient("What is the weather in Tokyo?", {
  tools: [weatherTool],
});

Migration Note: Permission Pipeline & Pre-Grants

Starting in v0.6.1, the permission pipeline is mandatory and active by default across all SDK entry points (createSeepient, askSeepient).

  • The legacy permissionPipeline flag has been removed.
  • The legacy grants option has been removed. Instead, use consentMode: "autonomous" to permit safe unattended execution within policy boundaries, or define explicit scoped capability sets via principalPolicy or deploymentCeiling.

HTTP SSE endpoint

typescript
import { askSeepient } from "seepient";

app.get("/chat", async (req, res) => {
  const stream = await askSeepient(req.query.prompt as string, { stream: true });
  return stream.toResponse();
});

Provider support

Seepient Agent supports multiple LLM providers out of the box:

Providerprovider valueDefault model
OpenAI"openai"gpt-5.4
Anthropic"anthropic"claude-sonnet-4-6-20260320
GLM"glm"opus
OpenAI-compatible"openai-compatible"gpt-5.4 (configurable baseUrl)

Configure providers via environment variables, .env, or the seepient setup CLI wizard.

Built-in tools

Seepient Agent ships with a set of built-in tools organized into groups:

GroupTools
Coreexecute_shell_command, read_file, write_file, edit_file, get_current_datetime, manage_todos, render_widget
Commsend_email, web_search, send_notification
Advancedread_website, take_screenshot, generate_image, optimize_prompt, use_skill

Pass tool names as strings, or use group names ("core", "comm", "advanced", "all") to include entire groups.

API reference pages

PageDescription
createSeepient()Stateful multi-turn agent with session persistence and provider management
askSeepient()One-shot agent execution (streaming via stream: true) with automatic tool loops and security boundaries
Settings APIProgrammatic configuration facade for reading, updating, and watching settings
Provider ManagementCatalog querying, accounts, assignments, and resolution preview
Custom ToolsExplicit trust models: preparedTool, brokerConnector, trustedHostTool
MCP GatewayConnect Model Context Protocol servers and REST endpoints
ProvidersMulti-provider LLM support and model routing
SkillsReusable skill packages with automatic catalog injection
Hooks and MiddlewareLifecycle callbacks and request/response pipelines
Session PersistenceBuilt-in atomic files, in-memory, and custom storage backends
Stateless WorkersZero-disk multi-tenant embedding and storage contracts
Types ReferenceComplete TypeScript types reference

Released under the Business Source License 1.1.