Skip to content
eBook Charts
US
AI Agents in Python That You Can Trust

AI Agents in Python That You Can Trust

Kai London

$39.99

Buy on Amazon View on Apple Books

Prefer it in print? See every format on Amazon →

Price on Apple Books. Amazon’s price may differ.

Read a lot? Try Kindle+ * · Compare subscriptions

Published
Genres
ComputersComputers & InternetProfessional & TechnicalEngineeringBusiness & Personal Finance

Description

You have watched an LLM call a tool, loop a few times and produce something impressive. Then it looped forever, burned your budget, deleted the wrong file, or confidently reported a task it never finished. The frameworks promised autonomy; what you needed was control. This book teaches you to build AI agents from scratch in Python, so that every line of the loop is yours and every behaviour can be tested, bounded and stopped. You start with a twenty-line agent loop and grow it, chapter by chapter, into a system with validated tool schemas, working memory that respects context limits, explicit planning, retrieval-grounded decisions, MCP server integration, multi-agent coordination contracts, human approval gates, simulation-based evaluation, observability and failure recovery. You will build: - A provider-neutral agent loop with step, token and cost budgets - Tool definitions generated from Python signatures and validated before execution - Memory layers that summarise, compact and persist state across runs - A planner that produces checkable steps and replans when steps fail - Your own MCP server and an MCP client inside your agent - Coordination contracts that let several agents work without stepping on each other - Approval gates, kill switches and intervention points that humans actually use - A simulation harness and evaluation suite that catch regressions before users do - Tracing, budgets and recovery paths that make failures boring The three capstone projects bring it together: a research agent with provenance-tracked evidence, an issue-triage agent with human approval gates, and a multi-agent workflow tested against adversarial task cases. Every chapter has runnable code, a worked example with inputs and expected outputs, a pitfall you will otherwise hit, and exercises with success criteria. This book is for Python developers who can already write functions, classes and tests and who want to ship tool-using agents they understand completely. No framework lock-in, no hand-waving about autonomy, and no code you cannot read.