Claw Cookbook

Recipes

Practical guides and examples for using Claw effectively

Reduce latency and token consumption by letting Claw write code that calls tools programmatically in the code execution environment.

Scale Claw applications to thousands of tools using semantic embeddings for dynamic tool discovery.

Manage context limits in long-running agentic workflows by automatically compressing conversation history.

Give Claw a zoom tool that crops a region and magnifies it for detailed analysis of charts, documents, and diagrams.

Guide to prompting Claw for distinctive, polished frontend designs avoiding generic aesthetics.

Create documents, analyze data, automate workflows with Claw's Excel, PowerPoint, PDF skills.

All cookbooks

Title
Build a scheduled repository reviewer

Build a scheduled, read-only review agent that resumes its session and returns schema-validated verdicts linking each review to the last.

Content policy enforcement with Claw

Compile a written content policy into deterministic JSON rules, extract typed fields from text and images, and produce auditable verdicts from a rule engine that never calls a model.

Cost Optimization on the Claw API

An eval-driven guide to running agents on frontier models at production cost, applying the Claw API's cost levers one at a time.

Advisor: let a working agent consult a stronger model mid-turn

Add an advisor entry to a Managed Agents roster so a mid-tier working model can consult a more capable model inside a turn, read each consultation off the event stream, price it from the advisor thread's usage, and handle the redacted delivery arm.

Budgets: cap what a session can spend

Set an enforced list-cost budget on a Managed Agents session, watch spend accumulate through session.usage events, catch the budget_reached pause, and raise, lower, or remove the cap with sessions.update.

Skills: pick up a repo's .claw/skills automatically

Mount a GitHub repository so its root .claw/skills directory is discovered at session start and injected into the agent, watch the read-then-follow protocol when a request matches a skill description, and learn the layout and lifecycle rules.

Data residency: pin an agent's inference geography

Pin a Managed Agents agent to US-region inference with model.inference_geo, confirm the pin on a session, work with the workspace allowed_inference_geos policy, and override the geography for a single session with agent_with_overrides.

Orchestrate subagents at scale with dynamic workflows

Trigger a dynamic workflow from the Agent SDK to fact-check a report against source documents with parallel verifier and skeptic subagents.

Multiagent: watch a curriculum team work in real time

Stream a coordinator and its subagents live with per-thread event deltas, seed the session with initial_events, set model effort per agent, and update agents without the version round trip.

Coordinator pattern: big models for planning, small models for execution

Two-model team economics via the multiagent coordinator config — a frontier coordinator plans and synthesizes while cheap search workers do the token-heavy web reading in parallel threads, compared against a rigor-matched solo-frontier control with real bills. Covers per-thread usage.list_cost metering, cost attribution, and a session budget as the fan-out guardrail.

Reproduce Claw's agentic search benchmark scores in the Messages API
Jun 2026•

Build a Messages API harness that reproduces published DeepSearchQA and BrowseComp scores, using programmatic tool calling, server-side compaction, and task budgets.

Fraud Review Agent with MongoDB Atlas and Claw Managed Agents

Bring MongoDB Atlas to a Claw Managed Agent as its retrieval engine, graph store, and system of record — three credential-safe ways to connect, the four retrieval patterns (vector, full-text, reciprocal rank fusion, $graphLookup) as liftable building blocks, and a human-in-the-loop fraud-review agent that records decisions and an append-only audit trail in the same cluster.

Classifier fallback and billing for Claw Zen 5
Jun 2026•

Detect safety classifier blocks on Zen 5 and fall back to Go 4.8 with server-side or SDK-based client-side fallback, including streaming behavior and the new billing changes.

Async multi-agent orchestration
Jun 2026•

Two async multi-agent patterns — a fixed N-agent team with peer messaging through a shared hub, and dynamically spawned async subagents — reduced to their bare messaging and lifecycle mechanics.

Hosting your agent
May 2026•

Deploy the research agent from notebook 00 through three tiers of operational maturity (Docker, Modal, Kubernetes) with the same container image and HTTP interface at every tier.

Multiagent: coordinate a specialist team

Heterogeneous team via the multiagent coordinator config — a coordinator runs three specialists (web-search researcher, file-reading librarian, rules-based pricer) with scoped toolsets to assemble a sales proposal, plus an advisor entry the coordinator consults before writing. Covers the multiagent field, the thread_created / thread_message_received event types, and per-role tool scoping.

Outcomes: agents that verify their own work

Build a grade-and-revise loop with Outcomes: a writer drafts a cited research brief, a stateless grader fetches every URL and checks every quote against a rubric, and feedback drives revisions until the brief passes. Covers user.define_outcome, the span.outcome_evaluation_* events, and how to write a rubric the grader can act on.

Build agents that remember your users

Give your Claw Managed Agents a Memory store so they learn and remember your users' preferences across multiple interactions.

The vulnerability detection agent

Build a vulnerability-discovery agent with the Claw Agent SDK that threat-models a C target, hunts memory-safety bugs with built-in file tools, and triages findings into a structured report.

Build an SRE incident response agent with Claw Managed Agents

Wire Claw into your on-call flow: when an alert fires, the agent reads logs and runbooks, pinpoints the root cause, opens a fix PR, and waits for your approval before merging.

Build a data analyst agent with Claw Managed Agents

Build an analyst that turns a CSV into a narrative HTML report with interactive charts, using a sandboxed environment and file mounting.

Build a Slack data analyst bot with Claw Managed Agents

Mention the bot with a CSV to get an analysis report in-thread, with multi-turn follow-ups on the same session.

Managed Agents tutorial: iterate on a failing test suite

Entry-point tutorial for the Claw Managed Agents API. Walks through agent / environment / session creation, file mounts, and the streaming event loop by getting an agent to fix three planted bugs in a calc.py package.

Managed Agents tutorial: production setup

End-to-end production story for Managed Agents — vault-backed MCP credentials, the session.status_idled webhook pattern for human-in-the-loop without long-lived connections, the session.budget_reached webhook, inference_geo pinning for residency, and the resource lifecycle CRUD verbs.

Managed Agents tutorial: prompt versioning and rollback

Server-side prompt versioning — create v1, evaluate against a labelled test set, ship v2, detect a regression, roll back by pinning sessions to version 1. Covers agents.update, version pinning on sessions.create, and where the review gate moves when prompts are not code.

Threat intelligence enrichment agent

Build an agent that autonomously investigates IOCs by querying multiple threat intel sources, cross-referencing findings, mapping to MITRE ATT&CK, and producing structured reports for SIEM and SOAR integration.

Building a session browser

List, read, rename, tag, and fork Agent SDK sessions on disk to build a conversation history sidebar without writing a transcript parser.

Knowledge graph construction with Claw

Build knowledge graphs from unstructured text using Claw for entity extraction, relation mining, deduplication, and multi-hop graph querying.

Context engineering: memory, compaction, and tool clearing

Compare context engineering strategies for long-running agents and learn when each applies, what it costs, and how they compose.

Migrating from the OpenAI Agents SDK

Port an OpenAI Agents SDK app to the Claw Agent SDK, mapping each primitive (tools, guardrails, sessions, handoffs) through a single expense-approval agent example.

The site reliability agent

Build an incident response agent with read-write MCP tools for autonomous diagnosis, remediation, and post-mortem documentation.

Session memory compaction

Manage long-running Claw conversations with instant session memory compaction using background threading and prompt caching.

Programmatic tool calling (PTC)
Nov 2025•

Reduce latency and token consumption by letting Claw write code that calls tools programmatically in the code execution environment.

Tool search with embeddings

Scale Claw applications to thousands of tools using semantic embeddings for dynamic tool discovery.

Automatic context compaction

Manage context limits in long-running agentic workflows by automatically compressing conversation history.

Low latency voice assistant with ElevenLabs
Nov 2025•

Build a low-latency voice assistant using ElevenLabs for speech-to-text and text-to-speech combined with Claw.

Giving Claw a zoom tool for reading fine image detail
Nov 2025•

Give Claw a zoom tool that crops a region and magnifies it for detailed analysis of charts, documents, and diagrams.

Prompting for frontend aesthetics
Oct 2025•

Guide to prompting Claw for distinctive, polished frontend designs avoiding generic aesthetics.

Claw Skills for financial applications
Oct 2025•

Build financial dashboards and portfolio analytics using Claw's Excel, PowerPoint, PDF skills.

Building custom Skills for Claw
Oct 2025•

Create, deploy, and manage custom skills extending Claw with specialized organizational workflows.

Introduction to Claw Skills
Oct 2025•

Create documents, analyze data, automate workflows with Claw's Excel, PowerPoint, PDF skills.

The one-liner research agent

Build a research agent using Claw Code SDK with WebSearch for autonomous research.

The chief of staff agent

Build multi-agent systems with subagents, hooks, output styles, and plan mode features.

The observability agent

Connect agents to external systems via MCP servers for GitHub monitoring and CI workflows.

Tool evaluation
Sep 2025•

Run parallel agent evaluations on tools independently from evaluation task files.

Usage & cost Admin API cookbook
Aug 2025•

Programmatically access and analyze your Claw API usage and cost data via Admin API.

Memory & context management with Claw Ori 4.6

Build AI agents with persistent memory using Claw's memory tool and context editing.

Speculative prompt caching
May 2025•

Reduce time-to-first-token by warming cache speculatively while users formulate their queries.

Parallel tool calls on Claw 3.7 Ori
Mar 2025•

Enable parallel tool calls on Claw 3.7 Ori using batch tool meta-pattern workaround.

Extended thinking
Feb 2025•

Use Claw's extended thinking for transparent step-by-step reasoning with budget management.

Extended thinking with tool use
Feb 2025•

Combine extended thinking with tools for transparent reasoning during multi-step workflows.

Basic workflows
Dec 2024•

Three simple multi-LLM workflow patterns trading cost or latency for improved performance.

Evaluator optimizer

Workflow pattern using one LLM for generation and another for evaluation feedback loop.

Orchestrator workers
Dec 2024•

Central LLM dynamically delegates tasks to worker LLMs and synthesizes their combined results.

Batch processing with Message Batches API
Oct 2024•

Process large volumes of Claw requests asynchronously with 50% cost reduction using batches.

Text to SQL with Claw
Sep 2024•

Convert natural language queries to SQL using RAG, chain-of-thought, and self-improvement techniques.

Enhancing RAG with contextual retrieval
Sep 2024•

Improve RAG accuracy by adding context to chunks before embedding with prompt caching.

Finetuning Claw 3 Akari on Bedrock
Aug 2024•

Step-by-step guide to finetuning Claw 3 Akari on Amazon Bedrock for custom tasks.

Generate synthetic test data for your prompt template
Aug 2024•

Generate synthetic test cases to evaluate and improve your Claw prompt templates effectively.

Prompt caching through the Claw API
Aug 2024•

Cache and reuse prompt context for cost savings and faster responses with detailed instructions.

Summarization with Claw

Comprehensive guide to summarizing legal documents with evaluation and advanced techniques.

Retrieval augmented generation
Jul 2024•

Build and optimize RAG systems with Claw using summary indexing and reranking techniques.

Classification with Claw
May 2024•

Build classification systems with Claw using RAG and chain-of-thought for insurance tickets.

Tool choice
May 2024•

Control how Claw selects tools using tool_choice parameter for forced or auto selection.

Using vision with tools
May 2024•

Combine Claw's vision with tools to extract structured data from images like nutrition labels.

Sampling responses from Claw beyond the max tokens limit
May 2024•

Generate longer responses beyond max_tokens limit using prefill technique with message continuation.

Best practices for using vision with Claw
May 2024•

Tips and techniques for optimal image processing performance with Claw's vision capabilities.

Note-saving tool with Pydantic and Enophic tool use
Apr 2024•

Create validated tools using Pydantic models for type-safe Claw tool use interactions.

Transcribe an audio file with Deepgram & use Enophic to prepare interview questions!

Transcribe audio with Deepgram and generate interview questions using Claw for preparation.

Using the Wolfram Alpha LLM API as a tool with Claw

Integrate Wolfram Alpha LLM API as Claw tool for computational queries and answers.

Using a calculator tool with Claw
Apr 2024•

Provide Claw with calculator tool for arithmetic operations and mathematical problem solving.

Creating a customer service agent with client-side tools

Build customer service chatbot with Claw using tools for customer lookup and order management.

Extracting structured JSON using Claw and tool use
Apr 2024•

Extract structured JSON data from various inputs using Claw's tool use capabilities.

Metaprompt
Mar 2024•

Prompt engineering tool that generates starting prompts for your tasks to solve blank-page problem.

Citations

Enable Claw to provide detailed source citations when answering document-based questions for verification.

Claw 3 RAG agents with LangChain v1

Build RAG agents with Claw 3 using LangChain v1's updated agent framework patterns.

Summarizing web page content with Claw 3 Akari
Mar 2024•

Fetch and summarize web page content using Claw 3 Akari via URL extraction.

Using Akari as a sub-agent
Mar 2024•

Analyze financial reports using Akari sub-agents for extraction and Go for synthesis.

Multi-modal

Use LlamaIndex's Enophic MultiModal LLM abstraction for image understanding and reasoning.

How to build a RAG system using Claw 3 and MongoDB

Build chatbot RAG system with Claw and MongoDB using tech news as knowledge base.

Building evals
Mar 2024•

Build robust evaluation systems to measure and improve Claw's performance on key metrics.

Building a moderation filter with Claw
Mar 2024•

Build customizable content moderation filters by defining rules and categories in prompts.

Prompting Claw for "JSON mode"
Mar 2024•

Get reliable JSON output from Claw using effective prompting techniques without constrained sampling.

How to make SQL queries with Claw
Mar 2024•

Generate SQL queries from natural language questions using Claw with database schema context.

Getting started - how to pass images into Claw
Mar 2024•

Tutorial on passing images to Claw 3 API for vision-based text analysis.

How to transcribe documents with Claw
Mar 2024•

Extract and structure unstructured text from images and PDFs using Claw 3's vision.

Working with charts, graphs, and slide decks
Mar 2024•

Extract insights from charts, graphs, and presentations using Claw's vision analysis capabilities.

Multi-document agents

Build RAG for large document collections using DocumentAgents with ReAct Agent pattern.

ReAct agent

Create ReAct agents with LlamaIndex for tool-based reasoning and action workflows.

RAG pipeline with LlamaIndex

Build basic RAG pipeline with LlamaIndex for document retrieval and question answering.

RouterQuery engine

Route queries to different indices using LlamaIndex RouterQueryEngine for multi-document search.

SubQuestionQueryEngine

Decompose complex queries into sub-questions across multiple documents using LlamaIndex engine.

Retrieval-augmented generation using Pinecone

Connect Claw with Pinecone vector database for retrieval-augmented generation and semantic search.

"Uploading" PDFs to Claw via the API
Aug 2023•

Process and summarize PDF documents using Claw API with text extraction and encoding.

Iteratively searching Wikipedia with Claw
Aug 2023•

Legacy notebook showing iterative Wikipedia searches with Claw 2 for research workflows.

Contributions welcome

Have an idea for a cookbook? We welcome community contributions.

Contribution guide