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.
Use OpenAI, Anthropic, or Google models. Switch providers per-agent without changing your app code.
Works on Cloudflare Workers, Vercel Edge, and Deno Deploy. Small enough (~63 KB) to actually run there.
Add RAG, tools, middleware, and analytics as plugins. They run in priority order and compose cleanly.
Conversation history is managed for you. Store it in Upstash Redis, MongoDB, or write your own adapter.
Stream responses with onChunk, onComplete, and onError callbacks. Works out of the box.
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.
Semantic search and document retrieval for knowledge bases and docs.
Let agents call APIs, run calculations, look up data.
Rate limiting, moderation, logging. Intercept requests and responses.
Track usage and token consumption. Runs last in the plugin pipeline.
How it compares
No complex APIs. A lightweight core and plugin system. SnapAgent fits where they don't.
OpenAI's SDK only works with OpenAI. SnapAgent supports OpenAI, Anthropic, and Google from the start.
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.