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
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.
★★★★★OpenClaw v2026.3.7 introduces major enhancements to context engine plugins, persistent channel bindings for Discord/Telegram, multi-language UI support (Spanish), improved web search capabilities, and Docker containerization optimizations. The release includes a breaking change requiring explicit gateway auth mode configuration. Key additions enable alternative context management strategies, durable ACP thread routing, per-topic agent overrides, and enhanced security with config validation.
★★★★★This content discusses strategies for optimizing Gemini 3 performance for specific use cases, achieving 10x improvements. It references prompt engineering best practices and introduces the Superdesign agent as a tool for implementation. The video likely covers techniques for tailoring large language models to particular applications through effective prompting and agent-based workflows.
★★★★★LangChain v0.3.28 is a maintenance and security release that addresses a critical ReDoS vulnerability (CVE-2024-58340) in MRKL and ReAct action regex patterns. The release includes improvements to UUID7 for run IDs, enhanced OpenAI streaming support, better Anthropic model integration, and extensive code quality improvements including Pydantic deprecation fixes, Ruff linting enhancements, and documentation standardization.
★★★★★Claude Code v2.1.71 introduces the `/loop` command for recurring prompt execution and cron scheduling tools, adds rebindable voice activation keybindings, and expands bash auto-approval allowlist with common utilities. The release focuses on stability improvements, fixing critical issues like stdin freezes in long sessions, CoreAudio initialization delays, OAuth token refresh failures, and image processing context overflow. Multiple UX and plugin management enhancements improve startup performance, fork isolation, and multi-instance reliability.
★★★★★Microsoft AutoGen python-v0.5.7 release introduces improvements to AzureAISearchTool with unified search methods (full-text, vector, and hybrid), enhanced SelectorGroupChat with model_context parameter for better speaker selection, and improved OTEL tracing with additional metadata. The release also includes various bug fixes and improvements to agent runtime, documentation, and integrations with external services like Anthropic Bedrock and MCP servers.
★★★★★