/recipes
AI agent recipes for TypeScript
Small, end-to-end solutions for the moments that make an agent production-ready. Pick a recipe, copy the code, and keep the underlying package contracts visible.
71 standalone recipes · full reference · choose a use case
A/B prompts with feature flags
Ship multiple prompts, route users deterministically, measure which wins.
Open recipe →Adapter contract tests
Verify any adapter against the ADR 0001 invariants A1–A10 with the shared test harness.
Open recipe →Adapter ensemble
Send one request to N models in parallel, aggregate the answers into a single output.
Open recipe →Adapter router
Auto-pick an adapter per request based on cost, latency, capabilities, or a custom classifier.
Open recipe →agentskit ai — natural-language agent generator
Describe an agent in plain English, get a typed AgentSchema + tool stubs + runtime wiring.
Open recipe →Auto-summarization
Wrap any ChatMemory so it compacts oldest messages into a summary whenever stored tokens exceed a budget.
Open recipe →Background agents (cron + webhooks)
Run agents on a schedule or in response to incoming webhooks, without pulling in a job-queue dependency.
Open recipe →Browser-only chat (WebLLM / WebGPU)
Ship a chat agent that runs 100% in the user's browser — no server, no API key, no telemetry. Privacy contract holds because no inference data ever leaves the device.
Open recipe →Chat with RAG
A streaming React chat that answers from your own documents. Vector store, embeddings, retrieval, hooked up in 30 lines.
Open recipe →Code reviewer agent
An agent that reads a git diff, runs the test suite, and posts a structured review.
Open recipe →Confirmation-gated tool
A dangerous tool the runtime refuses to execute without explicit human approval.
Open recipe →Connect AgentsKit to your coding agent
Fix MCP setup across Codex, Claude, Cursor, Cline, and Continue with pinned configurations and an executable server proof.
Open recipe →Cost guard
Enforce a dollar budget per run. Tokens → cost → abort, all via contract primitives.
Open recipe →Cost-guarded chat
A chat that aborts the run when token usage exceeds your budget — using only an observer.
Open recipe →Custom adapter
Wrap any LLM API as an AgentsKit adapter. Plug-and-play with the rest of the kit in 30 lines.
Open recipe →Deterministic replay
Record a real agent session once, then replay it bit-for-bit in tests and bug repros — no more flaky LLM traces.
Open recipe →Devtools server
Expose a live feed of agent events so any browser extension or custom dashboard can inspect a running agent.
Open recipe →Discord bot
A Discord bot powered by AgentsKit. Replies in threads, calls tools, remembers per-channel.
Open recipe →Document loaders
Fetchers for URL, GitHub, Notion, Confluence, Drive, PDF, and cloud stores into your RAG pipeline.
Open recipe →Durable execution (Temporal-style)
Wrap side-effectful steps so crashes, deploys, and retries replay from a step log instead of starting over.
Open recipe →Edit + regenerate messages
Let users correct a prompt, edit the model's answer, or re-run any assistant turn — with correct truncation and streaming.
Open recipe →Encrypted memory
Client-side AES-GCM encryption for any ChatMemory — keys never leave the caller, backing store only sees ciphertext.
Open recipe →Eval suite for an agent
Score an agent's quality in CI. A test suite for agents, not for code.
Open recipe →Evals in CI
Run agent evals on every PR, fail builds below a minimum accuracy, surface results in the PR UI.
Open recipe →Fallback chain
Try adapters in order — on error, fall through to the next without duplicating tool calls.
Open recipe →Generative UI + artifacts
A typed JSON schema the agent emits, a framework-agnostic element tree, plus rich artifacts (code, markdown, HTML, charts).
Open recipe →Graph memory
Non-linear memory for entities and relationships. Backs anything from in-memory Maps to Neo4j.
Open recipe →Hierarchical memory (MemGPT-style)
Three tiers — working, recall, archival — so long-running agents don't lose context and don't blow the window.
Open recipe →Human-in-the-loop approvals
Pause an agent at a named gate, persist the decision, resume deterministically.
Open recipe →Local trace viewer
Persist agent spans to disk and open a self-contained HTML waterfall — Jaeger-style, no server required.
Open recipe →Mandatory tool sandbox
Enforce a sandbox policy across every tool the agent can call — allow-list, deny-list, require-sandbox, per-tool validators.
Open recipe →MCP bridge (bidirectional)
Consume any MCP server as AgentsKit tools, or expose your AgentsKit tools to MCP hosts — over stdio or any transport.
Open recipe →More provider adapters
Mistral, Cohere, Together, Groq, Fireworks, OpenRouter, Hugging Face, LM Studio, vLLM, llama.cpp — one line each.
Open recipe →Multi-agent research team
A planner that delegates to a researcher and a writer. Real multi-agent in 30 lines.
Open recipe →Multi-agent topologies
Ready-made supervisor, swarm, hierarchical, and blackboard builders — four ways to combine agents into one.
Open recipe →Open specs — A2A, Manifest, Eval Format
Three small, versioned specs so agents, skill packs, and eval datasets travel across tools.
Open recipe →PDF Q&A
Ask questions about a local PDF file. Extract, chunk, embed, retrieve, answer.
Open recipe →Persistent memory across sessions
A chat that remembers yesterday's conversation. SQLite-backed. Works in 5 lines.
Open recipe →Personalization
Persisted user profile that conditions every agent response.
Open recipe →PII redaction
Strip emails, phone numbers, SSNs, and other PII from messages before they hit the model or your logs.
Open recipe →Progressive tool calls
Start executing a tool before the model finishes streaming its arguments.
Open recipe →Prompt diff
Git blame for prompts — find which prompt change is responsible for an output change.
Open recipe →Prompt injection detector
Score incoming text for injection attempts — heuristics + optional model classifier (Llama Guard, Rebuff).
Open recipe →Prompt snapshot testing
Jest-style snapshot tests for prompts, with semantic tolerance so small wording drift doesn't break CI.
Open recipe →Provider integrations
Compatibility recipes for legacy tool projections. The canonical integration catalog is in @agentskit/integrations.
Open recipe →RAG reranking + hybrid search
Wrap your vector retriever with BM25 hybrid scoring and custom rerank functions.
Open recipe →Rate limiting
Token-bucket rate limits keyed by user / IP / API key with per-tier bucket config.
Open recipe →Recipe: Bail / Qwen routing
Use the bail (Alibaba DashScope) / qwen adapter alongside Western providers, with cost-aware routing for Asia-Pacific traffic.
Open recipe →Recipe: Figma design extraction
Pull frames from a Figma file, render them as PNGs, and feed them to a vision-capable model for design QA.
Open recipe →Recipe: HubSpot / Airtable / Shopify daily pulse
A single agent that pulls today's signals from your CRM, ops board, and storefront — then drafts a Slack digest.
Open recipe →Recipe: Jira triage agent
An agent that watches a Jira project, classifies new tickets, and assigns them — using the jira integration.
Open recipe →Recipe: Scaffolding with @agentskit/templates
Generate a build-ready AgentsKit package skeleton — tool, skill, adapter, embedder, memory, browser-adapter, or flow — in a few lines of Node.
Open recipe →Recipe: Sentry incident bot
Watch a Sentry project for new errors; cluster, summarise, and assign owners.
Open recipe →Recipe: vector filter helpers
Use matchesFilter to evaluate vector-store filter predicates outside an adapter, and pair with postgresWithRoles for row-level security.
Open recipe →Replay a session against a different model
Re-run a recorded cassette through any adapter to compare quality, latency, or cost without touching production traffic.
Open recipe →Schema-first agents
Define your agent in YAML or JSON and get a typed AgentSchema you can feed the runtime.
Open recipe →Scraping, voice, maps, browser agent
Firecrawl + Jina Reader, OpenAI Images + ElevenLabs + Whisper + Deepgram, Nominatim + OpenWeatherMap + CoinGecko, and a BYO-Playwright browser agent.
Open recipe →Self-debug tool
On tool error, let the agent read the error + schema and draft corrected arguments for a retry.
Open recipe →Signed audit log
Hash-chained, HMAC-signed audit log for SOC 2 / HIPAA friendly evidence — tamper-evident and authenticated.
Open recipe →Skill marketplace + ready-made skills
Publish + install versioned skills through a registry. Four new ready-made skills.
Open recipe →Speculative execution
Run the same request across N adapters in parallel, keep the winner, abort the losers.
Open recipe →Swap providers without rewriting the agent
Run one agent path with OpenAI, Anthropic, Gemini, OpenRouter, Groq, or Ollama.
Open recipe →Time-travel debug
Step through a recorded agent session, rewrite a tool result, and replay from that point forward.
Open recipe →Token budget compiler
Declare a token budget, let AgentsKit trim messages and summarize history to fit.
Open recipe →Tool composer
Chain N tools into a single macro tool — a fixed recipe the model can invoke with one schema.
Open recipe →Trigger adapters (email / teams / postgres-cdc)
Reference adapter snippets that wrap heavy drivers (nodemailer, imapflow, botbuilder, pg-logical-replication) into the driver-free contracts the AgentsKitOS triggers package consumes.
Open recipe →Unified multi-modal
One API for text, image, audio, video, and file inputs — regardless of provider.
Open recipe →Vector memory adapters
Drop-in VectorMemory for pgvector, Pinecone, Qdrant, Chroma, and Upstash Vector.
Open recipe →Virtualized memory
Transparently handle giant conversations by keeping a hot window active and paging the rest.
Open recipe →Vue / Svelte / Solid / React Native / Angular
One package per framework. Same ChatReturn contract as @agentskit/react — pick the binding that matches your stack.
Open recipe →Wrap a non-streaming endpoint
Turn a one-shot provider into a streaming adapter so UIs see identical ergonomics.
Open recipe →