+++ recipe archive +++

Cookbook

71 recipes, each a complete program you can copy and run. Every recipe is type-checked against the current packages and comes from — or links to — a runnable example in the repository.

71 recipes16 sections

Run a recipe on its own

Recipes use top-level await, so run them in an ES module project. Each recipe lists the packages to add and the command to run it.

new project · bash
mkdir cogitator-recipes && cd cogitator-recipes
npm init -y && npm pkg set type=module
pnpm add -D tsx typescript @types/node

Most recipes call Google Gemini, which has a free tier — get a key at Google AI Studio. Swap the provider and model to use OpenAI, Anthropic or a local Ollama model instead.

Or run the full examples

repository · bash
git clone https://github.com/cogitator-ai/Cogitator-AI.git && cd Cogitator-AI
pnpm install && pnpm build
echo "GOOGLE_API_KEY=your-key" > .env
npx tsx examples/core/01-basic-agent.ts

+++ sections +++

Getting Started4A first agent with tools and streaming, the built-in tools, typed JSON answers and a scaffolded project.Agents & Tools5Cache expensive tools, pause for approval, hand conversations between agents, keep long chats inside the context window.Memory & RAG7Threads that remember, token-aware context, hybrid search, knowledge graphs and retrieval-augmented agents.Workflows3DAG workflows with tool, agent and function nodes, conditional branches, human approvals and map-reduce.Swarms5Several agents on one task: debate, pipeline, delegation, voting and negotiation.Reasoning & Learning5Explore several solution paths, learn from past runs, replay and fork runs, reason about cause and effect.Safety & Cost3Block prompt injection, filter harmful input and output, guard dangerous tools and keep spending under a budget.MCP & A2A6Use MCP servers, expose your tools and agents over MCP, and talk to other agents over A2A.Servers & Frameworks8Serve agents over REST, SSE and WebSocket from Express, Fastify, Hono, Koa, Next.js and Tetsu, or behind the OpenAI and AI SDK interfaces.Deno & Edge2The Hono adapter on Deno and on Cloudflare Workers.Evals3Measure agents with datasets, metrics, LLM judges, assertions and statistically tested A/B comparisons.Voice4Speech-to-text, agent and text-to-speech pipelines, realtime speech-to-speech and WebSocket voice servers.Browser Agents3Agents that drive a real browser: scraping, filling forms and browsing with stealth.Messaging Channels3Put an agent on Telegram or a WebChat socket, or build a full personal assistant from a config object.Infrastructure5Persistent memory in Redis and PostgreSQL, distributed job queues, sandboxed execution and deployment.Advanced5Agents that extend themselves, logic programming, constraint solving, verified plans and WASM-sandboxed tools.