Install
What’s included
| Export | Purpose |
|---|---|
createSynap | Async factory that initializes the Synap provider |
SynapProvider | Provider class with wrap and listen methods |
Quick start
synap.wrap returns a standard Vercel AI SDK LanguageModel — pass it anywhere you’d use a plain model.
How it works
On everygenerateText / streamText / generateObject call:
- Before — fetches the user’s Synap context and injects it as a system message
- Generates — proxies the request to the wrapped model unchanged
- After — ingests the completed user + assistant turn into Synap asynchronously
Works with any model
Wrap any Vercel AI SDK-compatible model:Streaming
Works withstreamText and streamObject without any changes:
Per-request scoping
Override the user scope per call by wrapping per-request:Anticipation stream (advanced)
synap.listen() opens a gRPC stream that pre-fetches context speculatively before the user’s request arrives, reducing perceived latency:
listen in long-lived server processes where you can predict who will send the next message.
Next steps
Mastra
SynapMemory and tools for the Mastra ADK.
Claude Agent SDK
Hooks and MCP server for the Claude Agent SDK.