Build Your First AI Agents: Five Practical Agents and One Reusable Architecture

₹1,499.00
Indian rupee (₹) – INR
  • Indian rupee (₹) – INR
  • United States dollar ($) – USD

A practical, offline-first guide to building AI agents in Python. You write one small runtime, one typed tool layer, and then five real agents — research, document Q&A, repository review, business operations, and security triage — with the approval gates, cost limits, and evaluation that make an agent usable outside a demo. Runs offline: no API key, no account, no network to follow along. Five worked agents: every chapter ends with a project you can run and a test you can read. One architecture: the same runtime and tool contract reused in all five.

Most agent tutorials stop at the first successful tool call. This book starts where those stop: what happens when the model asks for a tool that does not exist, when the arguments are wrong, when the action is irreversible, when the context does not fit, and when a change to the prompt quietly breaks the behavior that used to work.

You build one small, readable agent runtime and then use it, unchanged, for five different jobs. Nothing in the book depends on a paid service: the whole project runs against a scripted provider, so you can follow every example with no API key, no account, and no network. Live providers are opt-in and sit behind the same interface.

Sample: build-your-first-ai-agents-0.1.0-sample

What you build

  • AgentKit — a runtime with a budgeted loop, typed tool calls, an approval gate, an event log, and a cost ledger.
  • A research agent — gathers evidence under a URL policy and publishes only what it actually read.
  • A document intelligence agent — ingests documents with page and section intact, then answers with citations or refuses.
  • A repository review agent — reads code inside a read-only jail, inside a token budget, with two independent reviewers.
  • A business operations agent — a state machine that stops at human approval and cannot write the record itself.
  • A security intelligence agent — turns a report into structured findings without ever inventing an evidence reference.

Why this book is different

  • Refusals are first-class. Every failure returns a typed refusal the model can read and recover from, instead of an exception that ends the run.
  • Safety is code, not advice. Registry, schema, policy, and approval are four separate checks with tests, not a chapter of warnings.
  • Cost is measured. Tokens and money are recorded per run, and the loop stops at a limit you set rather than a limit you hope for.
  • Evaluation is included. Recorded runs replay against a scripted provider, so a prompt change becomes a diff you can read.
  • Everything is offline. Copy the examples, run the tests, and see the same output the book shows.

What is inside the download

Item Detail
PDF edition 253 pages, typeset, with numbered listings, tables, and diagrams
EPUB3 edition Reflowable text with cover, for e-readers and phones
Free sample 37-page excerpt: front matter and the first chapters
Diagrams Every architecture figure as editable SVG and print PNG
Code bundle The complete Python project, with tests and the five worked agents
Cover artwork 1600 x 2560 storefront cover plus print-size cover artwork
Checksums SHA-256 digest for every file, so you can prove a copy is intact

Who it is for

  • Developers who can read Python and have called an LLM API at least once.
  • Engineers who have a demo agent and now need something they can put in front of users.
  • Teachers and reviewers who want a small, honest reference implementation to argue with.

Who it is not for

  • Readers looking for a no-code agent builder or a prompt collection.
  • Readers who want a framework tour; the book builds a runtime instead of surveying five of them.
  • Anyone who needs GPU training or fine-tuning — the book treats the model as a service.

What you need

Requirement Notes
Python 3.12 or newer The code bundle targets 3.12+
uv Used to sync and run the project; a plain virtual environment also works
No API key The offline path is complete; live providers are optional configuration
No network Only needed if you opt into a hosted model provider

License, in one paragraph

The book text and figures are yours to read, quote with attribution, and teach from. The code is yours to run, modify, and ship inside your own products, including commercial ones. You may not resell or redistribute the book file or the code bundle itself. Third-party and font notices are included in the download.