Snap-Agent SDK

A light yet powerful SDK for
building AI agents

SnapAgent is a TypeScript-first SDK for building stateful AI agents. It supports multiple LLM providers, runs on the edge, and has a plugin system that stays out of your way. ~63 KB.

What's in the box

The things you'd want from an agent SDK, without the things you wouldn't.

Multi-Provider

Use OpenAI, Anthropic, or Google models. Switch providers per-agent without changing your app code.

Edge Compatible

Works on Cloudflare Workers, Vercel Edge, and Deno Deploy. Small enough (~63 KB) to actually run there.

Plugin System

Add RAG, tools, middleware, and analytics as plugins. They run in priority order and compose cleanly.

Stateful Threads

Conversation history is managed for you. Store it in Upstash Redis, MongoDB, or write your own adapter.

Streaming

Stream responses with onChunk, onComplete, and onError callbacks. Works out of the box.

Built-in RAG

Add semantic search to agents with minimal config. Embeddings, indexing, and retrieval are handled for you.

Get started

Three steps. That's it.

  • Install

    npm install @snap-agent/core ai @ai-sdk/openai — add providers and storage adapters as needed.

  • Create an agent

    Pick a name, write instructions, choose a model and provider. Optionally add plugins.

  • Send messages

    Create a thread and chat. History, context, and streaming are handled automatically.

Plugins

Everything goes in one plugins array. Middlewares run first, then RAG and tools, then analytics. Simple priority system, no magic.

RAG

Semantic search and document retrieval for knowledge bases and docs.

Tools

Let agents call APIs, run calculations, look up data.

Middleware

Rate limiting, moderation, logging. Intercept requests and responses.

Analytics

Track usage and token consumption. Runs last in the plugin pipeline.

How it compares

Simplicity at ~63 KB

No complex APIs. A lightweight core and plugin system. SnapAgent fits where they don't.

Not locked in

OpenAI's SDK only works with OpenAI. SnapAgent supports OpenAI, Anthropic, and Google from the start.

Persistence included

Upstash Redis for edge, MongoDB for server, or bring your own. No manual session management.

Give it a try

MIT licensed. Open source. On GitHub and NPM.