Tool Use
Patterns for agents using tools effectively
Build a playbook about Tool Use
Save articles from this feed, then generate a personalized implementation guide
OpenClaw v2026.3.12 introduces major UI/dashboard improvements with modular views, fast-mode toggles for OpenAI and Anthropic models, provider-plugin architecture for Ollama/vLLM/SGLang, Kubernetes deployment support, and subagent session control. The release includes 30+ fixes addressing security vulnerabilities (device pairing, plugin auto-load, Unicode obfuscation), model compatibility issues (Kimi Coding, OpenRouter, Moonshot), chat deduplication across platforms (Slack, Telegram, iMessage, Mattermost), and infrastructure stability (session discovery, plugin caching, Windows updates).
★★★★★Google ADK Python v1.27.0 introduces major enhancements across core agent functionality, LLM model support, and observability. Key additions include A2A request interceptors, pluggable auth integrations, PDF support for Anthropic models, streaming capabilities, and new optimization tools. The release also expands tool ecosystems with Skills support, BigQuery enhancements, and improved human-in-the-loop interactions in the web interface.
★★★★★This cookbook demonstrates Claude 3.7 Sonnet's extended thinking feature, which provides transparent step-by-step reasoning with budget management. Extended thinking enables Claude to show its internal reasoning process through thinking content blocks before delivering final answers. The guide covers setup, basic examples, streaming with thinking, token counting, redacted thinking, and error handling with practical Python code examples.
★★★★★Claude 3.7 Sonnet may not make parallel tool calls by default even when enabled. This cookbook demonstrates a workaround using a "batch tool" meta-pattern that wraps multiple tool invocations, encouraging the model to call multiple tools simultaneously in a single response. By introducing a batch_tool that accepts an array of tool invocations, developers can improve latency and efficiency by processing multiple tool calls in parallel rather than sequentially.
★★★★★Speculative prompt caching is a technique that reduces time-to-first-token (TTFT) by warming up Claude's cache while users are still formulating their queries. Instead of waiting until a user submits their question to load context into the cache, the system begins cache warming immediately when the user starts typing. This cookbook demonstrates the pattern using SQLite source code as example context, showing how to implement it with the Anthropic Python SDK using async operations and prompt caching controls.
★★★★★This cookbook demonstrates how to build AI agents with persistent memory using Claude's memory tool and context editing capabilities. It addresses challenges of long-running agents losing learned patterns between sessions and context window overflow by implementing cross-conversation learning and automatic context management. The guide covers practical implementations for use cases like code review assistants, research assistants, and customer support bots, with setup instructions and best practices for memory security and organization.
★★★★★The Usage & Cost Admin API cookbook provides a practical guide for programmatically accessing Claude API usage and cost data through Anthropic's Admin API. It enables token-level monitoring across models and workspaces, detailed cost breakdowns by service type, and cache efficiency analysis. The guide includes security best practices, API endpoint documentation, and Python code examples for tracking consumption patterns, attributing expenses, and generating financial reports.
★★★★★This cookbook demonstrates how to connect Claude agents to external systems using MCP (Model Context Protocol) servers for GitHub monitoring and CI workflows. The guide covers integrating Git and GitHub MCP servers to enable agents to interact with repositories, manage workflows, and perform observability tasks. By leveraging MCP servers, agents gain access to specialized tools for Git operations, GitHub platform integration, and CI/CD monitoring without relying on command-line interfaces.
★★★★★This cookbook article introduces the Claude Agent SDK for building multi-agent systems, using a Chief of Staff agent for a startup as the primary example. It demonstrates key features including persistent memory via CLAUDE.md files, bash tool execution for Python scripts, and coordination of specialized subagents. The article progressively builds a comprehensive agent system that aggregates insights from multiple domains to provide executive summaries and actionable recommendations for a CEO managing a $10M Series A startup.
★★★★★This cookbook teaches how to build a research agent using Claude Agent SDK with WebSearch tool for autonomous information gathering and synthesis. The guide demonstrates creating a functional research agent in just a few lines of code, then progresses to production improvements including conversation memory, system prompts for specialized behavior, and multimodal research capabilities. The agent autonomously decides when and how to search, follows promising leads, and synthesizes findings without predefined workflows.
★★★★★This cookbook guide teaches developers how to create, deploy, and manage custom skills for Claude that extend its capabilities with organization-specific workflows and domain knowledge. Custom skills are specialized expertise packages bundled as markdown files, scripts, and resources that codify organizational knowledge, ensure consistency, and automate complex workflows while maintaining privacy. The guide covers skill architecture, SKILL.md requirements, progressive disclosure for token optimization, and provides utility functions for skill management including creation, listing, and deletion.
★★★★★This cookbook teaches how to build financial dashboards, portfolio analytics, and automated reporting workflows using Claude's Excel, PowerPoint, and PDF skills. It covers three main use cases: creating comprehensive financial models with formulas and charts in Excel, generating executive presentations from financial data, and automating multi-format reporting pipelines. The guide includes setup instructions, data loading examples, and helper functions for working with the Anthropic SDK to create professional financial documents directly through Claude's interface.
★★★★★This cookbook demonstrates building a low-latency voice assistant by combining ElevenLabs (speech-to-text and text-to-speech) with Claude for intelligent responses. The guide covers installation, API setup, and crucially, latency optimization techniques including Claude's streaming API and sentence-by-sentence TTS synthesis. Performance measurements show streaming reduces perceived latency by ~31% compared to non-streaming approaches, with TTS first-chunk delivery in 0.39 seconds.
★★★★★This cookbook teaches developers how to manage long-running Claude conversations by implementing session memory compaction using background threading and prompt caching. Rather than waiting for context limits to be exceeded (reactive approach), the pattern enables instant compaction by proactively building summaries in the background. The guide covers writing effective session memory prompts, implementing background threading for zero-latency compaction, and applying prompt caching to reduce costs by ~80%. It includes Python code examples demonstrating both traditional (slow) and instant (fast) compaction strategies for conversational applications.
★★★★★This cookbook demonstrates building an autonomous SRE incident response agent using the Claude Agent SDK with read-write MCP tools for safe infrastructure access. The agent can investigate incidents by querying metrics and logs, diagnose root causes, apply remediations by editing configs and restarting services, and document post-mortems. The pattern uses a subprocess-based MCP server with scoped tool access, clear tool descriptions, and human-in-the-loop workflows to enable autonomous yet controlled incident response.
★★★★★This guide introduces Claude Skills, specialized capability packages that enable document creation, data analysis, and workflow automation through Excel, PowerPoint, and PDF generation. Skills use a three-tier progressive loading model (metadata → full instructions → linked files) to optimize token usage and efficiency. The tutorial covers environment setup, API configuration, skill discovery, and practical quick-start examples for Excel, PowerPoint, and PDF workflows.
★★★★★This cookbook demonstrates how to build a crop tool for Claude to analyze images with greater detail by zooming into specific regions. The tool uses normalized coordinates (0-1) to let Claude request cropped sections of charts, documents, and diagrams without needing to know pixel dimensions. An agentic loop handles tool calls iteratively until Claude provides a final answer, enabling precise analysis of small text, chart comparisons, and technical details.
★★★★★This cookbook demonstrates automatic context compaction for managing token limits in long-running agentic workflows. It shows how the Claude Agent Python SDK can automatically compress conversation history when token usage exceeds a threshold, enabling tasks to continue beyond the 200k token context limit. The example uses a customer service agent processing support tickets, where each ticket requires multiple tool calls that accumulate in conversation history. By implementing context compaction with the compaction_control parameter, agents can maintain focus and efficiency across many iterations without manual context management.
★★★★★This cookbook demonstrates how to scale Claude applications from dozens to thousands of tools using semantic embeddings for dynamic tool discovery. Instead of front-loading all tool definitions (which consumes context and increases latency), the approach provides Claude with a single tool_search tool that returns relevant capabilities on demand, reducing context usage by 90%+. The guide walks through implementing client-side semantic search using SentenceTransformer embeddings to match user queries with appropriate tools from large libraries, making it practical for production applications managing extensive tool ecosystems.
★★★★★Programmatic Tool Calling (PTC) enables Claude to write and execute code that calls tools directly within the code execution environment, eliminating round-trips through the model for each tool invocation. This approach significantly reduces latency and token consumption, especially when dealing with large datasets or sequential tool dependencies. The cookbook demonstrates PTC using a team expense management API scenario where Claude analyzes employee expenses across multiple tool calls, filters irrelevant data programmatically, and identifies budget overages without excessive context window usage.
★★★★★