Chapter 36 Further Reading: Programmatic AI — APIs, Python, and Automations

Resources are organized by theme. All URLs were verified at time of writing; API documentation in particular changes frequently — if a link is stale, the provider's documentation home page is the best starting point.


Official API Documentation

Anthropic API Reference https://docs.anthropic.com/en/api/getting-started

The authoritative reference for the Anthropic API. The Messages API reference documents every parameter, the Models page lists current models with context windows, and the Rate Limits page provides current tier-based limits. The Cookbook section (https://github.com/anthropics/anthropic-cookbook) contains worked examples across a wide range of use cases.

Anthropic Python SDK https://github.com/anthropics/anthropic-sdk-python

The SDK source code and README. The README is often more up to date than the documentation website for specific method signatures and return types. The examples/ directory contains short, focused code examples.

Anthropic Prompt Caching Documentation https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching

Prompt caching reduces costs for workflows that reuse the same large system prompt or context across many requests. Essential reading for batch processing pipelines. Can reduce costs by 50-90% for prompts that are cacheable.

OpenAI API Documentation https://platform.openai.com/docs/introduction

The equivalent resource for OpenAI. The API reference at https://platform.openai.com/docs/api-reference/chat is the key reference for the chat completions endpoint used in this chapter.

OpenAI Python SDK https://github.com/openai/openai-python

The OpenAI Python SDK source code and examples. The examples/ directory is particularly useful.

OpenAI Cookbook https://cookbook.openai.com

Practical, runnable examples of OpenAI API use cases. Frequently updated with new patterns and integrations. The "Best Practices for Prompt Engineering" and "How to Format Inputs to ChatGPT Models" articles are particularly relevant.


Python Fundamentals for API Integration

"Python Crash Course" by Eric Matthes (3rd Edition) The most accessible introduction to Python for practitioners who have not programmed before. Covers all the Python concepts needed for the code in this chapter: functions, classes, file I/O, error handling, and working with JSON. The project-based approach in the second half is appropriate for practitioners learning Python to build automations.

Real Python: Working with APIs in Python https://realpython.com/api-integration-in-python/

A well-written tutorial covering HTTP APIs, authentication, and the requests library. While the Anthropic and OpenAI SDKs abstract away the HTTP layer, understanding what is happening underneath makes debugging much more effective. Free article.

"Automate the Boring Stuff with Python" by Al Sweigart https://automatetheboringstuff.com (free online)

The canonical book for practitioners who want to use Python for automation without becoming professional developers. Covers file processing, CSV/Excel manipulation, email automation, and scheduling — all directly relevant to the automation patterns in this chapter. Available free online.


Error Handling and Reliability

Martin Fowler: Retry https://martinfowler.com/articles/patterns-of-distributed-systems/retry.html

Fowler's pattern library entry on the Retry pattern — the foundational pattern behind exponential backoff. Concise and authoritative. Explains the cases where retry is appropriate and where it is not.

Martin Fowler: Exponential Backoff https://martinfowler.com/bliki/ExponentialBackoff.html

Fowler's explanation of exponential backoff and jitter. Short, precise, and worth reading before implementing retry logic in any production system.

"Release It! Design and Deploy Production-Ready Software" by Michael Nygard (2nd Edition) The comprehensive resource on building reliable software systems. Chapter-length treatments of circuit breakers, timeouts, bulkheads, and other stability patterns apply directly to API integration design. Particularly valuable for practitioners building automations that will run in production.


Data Processing and Pipelines

"Data Pipelines with Apache Airflow" by Bas P. Harenslak and Julian Rutger de Ruiter For practitioners building scheduled, complex data pipelines that incorporate AI API calls, Airflow is the professional standard. This book covers pipeline design, dependency management, and error recovery at scale. More advanced than what this chapter covers, but the right reference for production data pipeline work.

pandas Documentation: Getting Started https://pandas.pydata.org/docs/getting_started/

Pandas is the standard Python library for working with tabular data (CSV, Excel, database outputs). For the CSV processing patterns in this chapter, pandas provides more robust tools than the standard csv module. The "Getting Started" tutorial is a two-hour investment that pays substantial dividends in data processing work.

"Python for Data Analysis" by Wes McKinney (3rd Edition) Written by the creator of pandas, this is the authoritative guide to data manipulation in Python. Essential for practitioners who will regularly process structured data in their AI automations.


Security

OWASP Secrets Management Cheat Sheet https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html

The authoritative reference for secrets management best practices. Covers environment variables, secrets managers, key rotation, and audit logging. Read this before moving any API integration to a shared or production environment.

GitGuardian: How to Revoke and Rotate Exposed API Keys https://blog.gitguardian.com/how-to-revoke-api-keys/

Practical guidance for what to do when you discover an API key has been exposed. The triage process, revocation steps, and prevention practices are all covered. Keep this bookmarked — you will want it when you need it, and you will not want to search for it in a moment of urgency.

HashiCorp Vault Documentation https://developer.hashicorp.com/vault/docs

For team environments, Vault is the professional-grade secrets management solution. Complex to set up but provides audit logging, automatic key rotation, and fine-grained access control. The "Getting Started" tutorial provides a working overview.


Cost Management

Anthropic Pricing Page https://www.anthropic.com/pricing

Current token pricing for all Claude models. API pricing changes periodically; always verify current prices rather than relying on figures in any written resource (including this book).

OpenAI Pricing Page https://openai.com/api/pricing

Equivalent pricing reference for OpenAI models.

"Cloud FinOps" by J.R. Storment and Mike Fuller A comprehensive guide to managing cloud costs, with a mindset directly applicable to AI API cost management. The practices for cost visibility, budgeting, and optimization translate well to API usage management. More relevant as API usage scales to production workloads.