Blink is a tool for building and sharing AI agents.
- Leverages the familiar AI SDK at it's core.
- Built-in tools for making Slack, GitHub, and Discord bots.
- Every agent is simply a Node HTTP server - no cloud required.
Install the blink package with your favorite package manager:
bun i -g blinkCreate an agent:
mkdir my-agent cd my-agent blink initStart development mode:
Note
You'll need to provide your own API keys to use language models. Put them in .env.local and the dev server will automatically load them.
blink devYou can now edit src/agent.ts and the dev server will hot-reload your agent.
Bundle your agent as a Node package to share it with others:
blink build npm publishOptionally, deploy your agent to blink.so:
Note
blink.so is not required to use Blink. We guarantee that Blink agents will always be local-first.
blink deployHere are some examples of agents commonly built with Blink:
- Coding Agent with tools and context specific to your codebase.
- Customer Support Agent directed to understand your product and documentation.
- Slack Bot with information relevant to your company.
- GitHub Bot with custom tools to interact with your repositories.
- Everything Agent that does all of the above to show the full power of Blink.
Blink has built-in APIs for managing chats, storage, and tools.
Blink allows you to start new chats from web requests:
import blink from "blink"; const agent = blink.agent(); agent.on("request", async (request, context) => { // Check if this is a request you'd like to start a chat for. // e.g. if this is a webhook from Slack, start a chat for that thread. // Specify a unique key for the chat so that on subsequent requests, the same chat is used. const chat = await blink.chat.upsert(`slack-${request.body.thread_ts}`); await blink.chat.message( chat.id, { role: "user", parts: [ { type: "text", text: "Hello, how can I help you today?", }, ], }, { // Blink manages chat state for you. Interrupt, enqueue, or append messages. behavior: "interrupt", } ); // This would trigger the chat event handler in your agent. }); // ... agent.on("chat", ...) ... agent.serve();Locally, all chats are stored in ./.blink/chats/<key>.json relative to where your agent is running.
In the cloud, chats keys are namespaced per-agent.
Blink has a persistent key-value store for your agent:
import { convertToModelMessages, streamText, tool } from "ai"; import blink from "blink"; import { z } from "zod"; const agent = blink.agent(); agent.on("chat", async ({ messages }) => { return streamText({ model: "anthropic/claude-sonnet-4", system: "You are a helpful assistant.", messages: convertToModelMessages(messages), tools: { set_memory: tool({ description: "Set a value to remember later.", inputSchema: z.object({ key: z.string(), value: z.string(), }), execute: async ({ key, value }) => { await blink.storage.set(key, value); return "Saved memory!"; }, }), get_memory: tool({ description: "Get a value from your memory.", inputSchema: z.object({ key: z.string(), }), execute: async ({ key }) => { const value = await blink.storage.get(key); return `The value for ${key} is ${value}`; }, }), delete_memory: tool({ description: "Delete a value from your memory.", inputSchema: z.object({ key: z.string(), }), execute: async ({ key }) => { await blink.storage.delete(key); return `Deleted memory for ${key}`; }, }), }, }); }); agent.serve();Locally, all storage is in ./.blink/storage.json relative to where your agent is running.
In the cloud, storage is namespaced per-agent.
Blink has helpers for tool approvals, and commonly used tools.
Some tools you'd prefer to approve manually, particularly if they're destructive.
import { convertToModelMessages, streamText, tool } from "ai"; import blink from "blink"; import { z } from "zod"; const agent = blink.agent(); agent.on("chat", async ({ messages }) => { return streamText({ model: "anthropic/claude-sonnet-4", system: "You are a helpful assistant.", messages: convertToModelMessages(messages), tools: { harmless_tool: tool({ description: "A harmless tool.", inputSchema: z.object({ name: z.string(), }), execute: async ({ name }) => { return `Hello, ${name}!`; }, }), ...blink.tools.withApproval({ messages, tools: { destructive_tool: tool({ description: "A destructive tool.", inputSchema: z.object({ name: z.string(), }), execute: async ({ name }) => { return `Destructive tool executed!`; }, }), }, }), }, }); }); agent.serve();Blink will require explicit approval by the user before destructive_tool is executed - displaying a UI to the user to approve or reject the tool call.
Blink has SDK packages for common tools, like Slack, GitHub, and Search:
import github from "@blink-sdk/github"; import { convertToModelMessages, streamText } from "ai"; import blink from "blink"; const agent = blink.agent(); agent.on("chat", async ({ messages }) => { return streamText({ model: "anthropic/claude-sonnet-4", system: "You are a helpful assistant.", messages: convertToModelMessages(messages), tools: { ...github.tools, }, }); }); agent.serve();By default, GitHub tools will not have authentication. Provide context to tools:
import blink from "blink"; blink.tools.withContext(github.tools, { accessToken: process.env.GITHUB_TOKEN, // optionally, specify app auth, or your own Octokit instance });You can override any descriptions to customize behavior:
import github from "@blink-sdk/github"; import { convertToModelMessages, streamText } from "ai"; import blink from "blink"; const agent = blink.agent(); agent.on("chat", async ({ messages }) => { return streamText({ model: "anthropic/claude-sonnet-4", system: "You are a helpful assistant.", messages: convertToModelMessages(messages), tools: { ...github.tools, // Override the default tool with your own description. create_issue: { ...github.tools.create_issue, description: "Create a GitHub issue. *Never* tag users.", }, }, }); }); agent.serve();You do not need to use the AI SDK with Blink. Return a Response in sendMessages using withResponseFormat:
import * as blink from "blink"; import OpenAI from "openai"; const client = new OpenAI(); const agent = blink.agent(); agent.on("chat", async ({ messages }) => { const stream = await client.chat.completions .create({ model: "gpt-4o", messages: messages.map((m) => ({ role: m.role, content: m.parts .map((p) => { if (p.type === "text") { return p.text; } }) .join("\n"), })), stream: true, }) .withResponse(); return blink.withResponseFormat(stream.response, "openai-chat"); }); agent.serve();Create a blink.config.ts file in your project root (next to package.json):
import { defineConfig, buildWithEsbuild } from "blink/build"; export default defineConfig({ entry: "src/agent.ts", outdir: "dist", build: buildWithEsbuild({ // ... esbuild options ... }), });By default, Blink uses esbuild to bundle your agent.
The build function can be customized to use a different bundler if you wish.
Blink is a tool for building AI agents, not a framework. It's simple at it's core. Every agent is an HTTP server that follows a basic protocol.
You provide the tools, and Blink handles the rest. We believe that the language models are the most important part of the equation, and we allow you to leverage the full power of them.
Blink will never require the cloud to run agents. Blink is MIT licensed - you don't have to trust us.
blink deploy runs your agent in the cloud at blink.so.
This allows you to share your agent with others, and to access it from anywhere.