Alex Notov aaa76b9c44 Fix context management for SDK 0.69.0 and improve documentation
This commit fixes the memory cookbook to work with anthropic SDK 0.69.0
and improves documentation around context clearing behavior.

Changes:
- Update context_management parameter usage for SDK 0.69.0
  - Pass as direct parameter instead of extra_body
  - Update response handling to use getattr() for Pydantic objects
- Fix context clearing configuration in notebook
  - Lower clear_at_least threshold from 3000 to 50 tokens
  - Memory tool operations have small results (~50-150 tokens)
  - Add documentation explaining why threshold is low
- Add explanatory notes about context clearing behavior
  - Explain why token savings are small in the demo
  - Provide guidance for production configurations
  - Document that larger tool results would save more tokens

The notebook now works correctly with SDK 0.69.0 and provides clear
guidance for users configuring context management in their applications.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 15:16:15 -06:00
2024-08-19 08:43:44 -07:00
2024-03-03 17:15:16 -08:00
2025-09-07 15:47:39 -06:00

Claude Cookbooks

The Claude Cookbooks provide code and guides designed to help developers build with Claude, offering copy-able code snippets that you can easily integrate into your own projects.

Prerequisites

To make the most of the examples in this cookbook, you'll need an Claude API key (sign up for free here).

While the code examples are primarily written in Python, the concepts can be adapted to any programming language that supports interaction with the Claude API.

If you're new to working with the Claude API, we recommend starting with our Claude API Fundamentals course to get a solid foundation.

Explore Further

Looking for more resources to enhance your experience with Claude and AI assistants? Check out these helpful links:

Contributing

The Claude Cookbooks thrives on the contributions of the developer community. We value your input, whether it's submitting an idea, fixing a typo, adding a new guide, or improving an existing one. By contributing, you help make this resource even more valuable for everyone.

To avoid duplication of efforts, please review the existing issues and pull requests before contributing.

If you have ideas for new examples or guides, share them on the issues page.

Table of recipes

Skills

Tool Use and Integration

Third-Party Integrations

Multimodal Capabilities

Advanced Techniques

Additional Resources

  • Anthropic on AWS: Explore examples and solutions for using Claude on AWS infrastructure.
  • AWS Samples: A collection of code samples from AWS which can be adapted for use with Claude. Note that some samples may require modification to work optimally with Claude.
Description
A collection of notebooks/recipes showcasing some fun and effective ways of using Claude.
Readme MIT 178 MiB
Languages
Jupyter Notebook 98.7%
Python 1.3%