# LLM Book Index: AI-Native Agent Engineering subtitle: From Zero to Production with OpenAI Agents SDK, Claude Agent SDK, and AI Harnesses author: Muhammad Usman Akbar site: https://muhammadusmanakbar.com/ai-agents-book navigation_api: https://muhammadusmanakbar.com/api/ai-agents-book-nav flat_chapter_list: https://muhammadusmanakbar.com/api/ai-agents-book-nav?format=flat chapter_content_api: https://muhammadusmanakbar.com/api/ai-agents-book-content/{slug} published: 2026-07-31 chapters: 52 ## About A beginner-to-expert AI agent development tutorial covering durable agent engineering, OpenAI Agents SDK, Claude Agent SDK, tools, MCP, memory, orchestration, security, evaluations, observability, deployment, and a vendor-neutral production AI harness. ## Full book structure ### Start Here - About This Book url: https://muhammadusmanakbar.com/ai-agents-book/about-this-book content: https://muhammadusmanakbar.com/api/ai-agents-book-content/about-this-book description: Learn how this zero-to-production path builds practical AI-agent expertise through one evolving, testable SupportOps system. - What Is AI-Native Agent Engineering? url: https://muhammadusmanakbar.com/ai-agents-book/ai-native-engineering content: https://muhammadusmanakbar.com/api/ai-agents-book-content/ai-native-engineering description: Distinguish assistants, deterministic workflows, and agents, then choose the least complex architecture that can satisfy the task. - How Does the Agent Loop Work? url: https://muhammadusmanakbar.com/ai-agents-book/the-agent-loop content: https://muhammadusmanakbar.com/api/ai-agents-book-content/the-agent-loop description: Understand observe-decide-act-verify cycles, tool results, stop conditions, and the controls that turn an LLM call into an agent. - What Is an AI Harness? url: https://muhammadusmanakbar.com/ai-agents-book/the-ai-harness content: https://muhammadusmanakbar.com/api/ai-agents-book-content/the-ai-harness description: Map the control layer around an agent: prompts, tools, policy, state, budgets, telemetry, evaluations, approvals, and recovery. ### Foundations - Python and TypeScript Essentials for Agent Builders url: https://muhammadusmanakbar.com/ai-agents-book/python-typescript-essentials content: https://muhammadusmanakbar.com/api/ai-agents-book-content/python-typescript-essentials description: Learn the async, typing, environment, package, and error-handling skills needed to follow both agent SDK learning paths. - Models, Messages, Instructions, and Context url: https://muhammadusmanakbar.com/ai-agents-book/models-messages-instructions-context content: https://muhammadusmanakbar.com/api/ai-agents-book-content/models-messages-instructions-context description: Understand what the model receives, how instructions differ from data, and why context quality matters more than context volume. - Structured Outputs and Validation url: https://muhammadusmanakbar.com/ai-agents-book/structured-outputs-and-validation content: https://muhammadusmanakbar.com/api/ai-agents-book-content/structured-outputs-and-validation description: Turn probabilistic model output into typed application input using schemas, validation, business rules, and explicit repair behavior. - Tools and Capability Boundaries url: https://muhammadusmanakbar.com/ai-agents-book/tools-and-capability-boundaries content: https://muhammadusmanakbar.com/api/ai-agents-book-content/tools-and-capability-boundaries description: Design narrow, typed agent tools with least privilege, timeouts, idempotency, audit events, and results that cannot become hidden commands. - State, Memory, and Sessions url: https://muhammadusmanakbar.com/ai-agents-book/state-memory-and-sessions content: https://muhammadusmanakbar.com/api/ai-agents-book-content/state-memory-and-sessions description: Separate conversation history, run state, business truth, long-term memory, and checkpoints so agents can resume without corrupting work. - Retrieval, Grounding, and Citations url: https://muhammadusmanakbar.com/ai-agents-book/retrieval-grounding-and-citations content: https://muhammadusmanakbar.com/api/ai-agents-book-content/retrieval-grounding-and-citations description: Build evidence packets that are relevant, tenant-safe, freshness-aware, citation-ready, and resilient to instructions hidden in retrieved content. - How Do You Choose an Agent Architecture? url: https://muhammadusmanakbar.com/ai-agents-book/agent-architecture-decisions content: https://muhammadusmanakbar.com/api/ai-agents-book-content/agent-architecture-decisions description: Choose among single agents, workflows, routers, handoffs, managers, and event-driven systems using evidence and explicit tradeoffs. ### OpenAI Agents SDK - Set Up and Run Your First OpenAI Agent url: https://muhammadusmanakbar.com/ai-agents-book/setup-and-first-openai-agent content: https://muhammadusmanakbar.com/api/ai-agents-book-content/setup-and-first-openai-agent description: Install the OpenAI Agents SDK, run a focused Python agent, inspect its result and trace, and verify configuration safely. - Define OpenAI Agents, Instructions, Models, and Output url: https://muhammadusmanakbar.com/ai-agents-book/agents-instructions-models-and-output content: https://muhammadusmanakbar.com/api/ai-agents-book-content/agents-instructions-models-and-output description: Configure a focused OpenAI agent with dynamic context and Pydantic output while keeping runtime dependencies outside model context. - Add Function Tools and Hosted Tools url: https://muhammadusmanakbar.com/ai-agents-book/function-and-hosted-tools content: https://muhammadusmanakbar.com/api/ai-agents-book-content/function-and-hosted-tools description: Give an OpenAI agent typed capabilities through function tools, then decide when hosted platform tools are the safer or simpler choice. - Run, Stream, and Inspect OpenAI Agent Results url: https://muhammadusmanakbar.com/ai-agents-book/running-streaming-and-results content: https://muhammadusmanakbar.com/api/ai-agents-book-content/running-streaming-and-results description: Control the OpenAI agent loop, stream progress without confusing it with completion, and consume final output, history, state, and usage. - Manage OpenAI Sessions and Resumable State url: https://muhammadusmanakbar.com/ai-agents-book/sessions-and-resumable-state content: https://muhammadusmanakbar.com/api/ai-agents-book-content/sessions-and-resumable-state description: Choose among application history, SDK sessions, server-managed continuation, and serialized run state without duplicating context. - Orchestrate OpenAI Agents with Handoffs and Managers url: https://muhammadusmanakbar.com/ai-agents-book/handoffs-and-orchestration content: https://muhammadusmanakbar.com/api/ai-agents-book-content/handoffs-and-orchestration description: Choose between ownership-transfer handoffs and manager-called agents, then evaluate routing, context, policy, latency, and failure. - Add Guardrails and Human Approval url: https://muhammadusmanakbar.com/ai-agents-book/guardrails-and-human-approval content: https://muhammadusmanakbar.com/api/ai-agents-book-content/guardrails-and-human-approval description: Use OpenAI input, output, and tool guardrails for automated checks, then pause and resume sensitive tool calls for human review. - Connect OpenAI Agents with MCP and Integrations url: https://muhammadusmanakbar.com/ai-agents-book/mcp-and-integrations content: https://muhammadusmanakbar.com/api/ai-agents-book-content/mcp-and-integrations description: Choose hosted or runtime-managed MCP connections, constrain external tool trust, and make lifecycle, approval, and supply-chain risk explicit. - Trace, Debug, and Evaluate OpenAI Agent Workflows url: https://muhammadusmanakbar.com/ai-agents-book/tracing-debugging-and-evals content: https://muhammadusmanakbar.com/api/ai-agents-book-content/tracing-debugging-and-evals description: Use OpenAI traces to explain individual runs, then convert requirements and failures into repeatable agent evaluations and release gates. - Capstone: Build SupportOps with the OpenAI Agents SDK url: https://muhammadusmanakbar.com/ai-agents-book/openai-supportops-capstone content: https://muhammadusmanakbar.com/api/ai-agents-book-content/openai-supportops-capstone description: Combine typed triage, read tools, specialist handoffs, approval-gated mutation, sessions, traces, and evaluations into one vertical slice. ### Claude Agent SDK - Set Up and Run Your First Claude Agent url: https://muhammadusmanakbar.com/ai-agents-book/setup-and-first-claude-agent content: https://muhammadusmanakbar.com/api/ai-agents-book-content/setup-and-first-claude-agent description: Install the Claude Agent SDK, run a read-only repository agent, inspect streamed messages, and understand the bundled runtime. - Understand the Claude Agent Loop and Built-In Tools url: https://muhammadusmanakbar.com/ai-agents-book/agent-loop-and-built-in-tools content: https://muhammadusmanakbar.com/api/ai-agents-book-content/agent-loop-and-built-in-tools description: Trace Claude message and tool cycles, constrain built-in file, search, shell, web, and orchestration capabilities, and enforce budgets. - Manage Claude Sessions, Resume, Fork, and Persistence url: https://muhammadusmanakbar.com/ai-agents-book/sessions-resume-fork-and-persistence content: https://muhammadusmanakbar.com/api/ai-agents-book-content/sessions-resume-fork-and-persistence description: Capture Claude session IDs, continue conversations, resume across processes, fork experiments, and persist state with explicit isolation. - Use Claude Structured Output and Streaming url: https://muhammadusmanakbar.com/ai-agents-book/structured-output-and-streaming content: https://muhammadusmanakbar.com/api/ai-agents-book-content/structured-output-and-streaming description: Request JSON-schema output, distinguish final structured results from partial stream events, and design reconnectable user experiences. - Give Claude Custom Tools with MCP url: https://muhammadusmanakbar.com/ai-agents-book/custom-tools-and-mcp content: https://muhammadusmanakbar.com/api/ai-agents-book-content/custom-tools-and-mcp description: Create typed in-process tools, expose them through an SDK MCP server, control tool names and permissions, and handle untrusted results. - Use Claude Subagents and Context Isolation url: https://muhammadusmanakbar.com/ai-agents-book/subagents-and-context-isolation content: https://muhammadusmanakbar.com/api/ai-agents-book-content/subagents-and-context-isolation description: Define specialized Claude subagents with separate prompts and tools, control delegation, detect invocation, and bound fan-out and context. - Configure Claude Permissions, Approval, and Sandboxing url: https://muhammadusmanakbar.com/ai-agents-book/permissions-approval-and-sandboxing content: https://muhammadusmanakbar.com/api/ai-agents-book-content/permissions-approval-and-sandboxing description: Combine allow/deny rules, permission modes, callbacks, hooks, and OS isolation so tool authority is explicit and enforceable. - Extend Claude with Hooks, Skills, Commands, Plugins, and Memory url: https://muhammadusmanakbar.com/ai-agents-book/hooks-skills-commands-plugins-memory content: https://muhammadusmanakbar.com/api/ai-agents-book-content/hooks-skills-commands-plugins-memory description: Place deterministic lifecycle controls in hooks and package reusable agent knowledge without confusing configuration with authorization. - Track Claude Cost, Usage, and OpenTelemetry url: https://muhammadusmanakbar.com/ai-agents-book/cost-tracking-and-observability content: https://muhammadusmanakbar.com/api/ai-agents-book-content/cost-tracking-and-observability description: Read result usage and cost, export OpenTelemetry safely, correlate agent spans with application traces, and build actionable budgets. - Host and Securely Deploy Claude Agents url: https://muhammadusmanakbar.com/ai-agents-book/hosting-and-secure-deployment content: https://muhammadusmanakbar.com/api/ai-agents-book-content/hosting-and-secure-deployment description: Deploy Claude Agent SDK subprocesses with isolated filesystems, scoped credentials, controlled networks, persistent sessions, and safe scaling. - Capstone: Build a Claude Repository Maintenance Agent url: https://muhammadusmanakbar.com/ai-agents-book/claude-repository-agent-capstone content: https://muhammadusmanakbar.com/api/ai-agents-book-content/claude-repository-agent-capstone description: Combine read tools, isolated edits, tests, subagent review, permissions, hooks, sessions, budgets, and telemetry into a safe repository workflow. ### The AI Harness - Design a Provider-Neutral AI Harness Contract url: https://muhammadusmanakbar.com/ai-agents-book/provider-neutral-harness-contract content: https://muhammadusmanakbar.com/api/ai-agents-book-content/provider-neutral-harness-contract description: Define stable run, event, tool, policy, budget, checkpoint, adapter, evaluator, and outcome contracts without erasing SDK strengths. - Route Models and Providers with Evidence url: https://muhammadusmanakbar.com/ai-agents-book/model-and-provider-routing content: https://muhammadusmanakbar.com/api/ai-agents-book-content/model-and-provider-routing description: Select model and provider paths using capability, policy, quality, latency, availability, and cost rather than a hardcoded favorite. - Engineer Context and Version Prompt Assets url: https://muhammadusmanakbar.com/ai-agents-book/context-engineering-and-prompt-assets content: https://muhammadusmanakbar.com/api/ai-agents-book-content/context-engineering-and-prompt-assets description: Build minimal, attributable context packets and treat prompts, skills, examples, and retrieval rules as versioned software assets. - Build a Tool Registry and Policy Engine url: https://muhammadusmanakbar.com/ai-agents-book/tool-registry-and-policy-engine content: https://muhammadusmanakbar.com/api/ai-agents-book-content/tool-registry-and-policy-engine description: Separate tool discovery from authorization with risk metadata, exact schemas, contextual policy decisions, approvals, and audit evidence. - Build the State Store, Memory Lifecycle, and Compaction url: https://muhammadusmanakbar.com/ai-agents-book/state-store-memory-and-compaction content: https://muhammadusmanakbar.com/api/ai-agents-book-content/state-store-memory-and-compaction description: Persist events, checkpoints, tool attempts, sessions, and validated memories while compacting context without losing operational truth. - Engineer Queues, Retries, Idempotency, and Recovery url: https://muhammadusmanakbar.com/ai-agents-book/queues-retries-idempotency-and-recovery content: https://muhammadusmanakbar.com/api/ai-agents-book-content/queues-retries-idempotency-and-recovery description: Make long-running agent work durable with leased jobs, retry ownership, idempotent effects, reconciliation, cancellation, and dead-letter review. - Enforce Budgets, Stop Conditions, and Runaway Prevention url: https://muhammadusmanakbar.com/ai-agents-book/budgets-stop-conditions-and-runaway-prevention content: https://muhammadusmanakbar.com/api/ai-agents-book-content/budgets-stop-conditions-and-runaway-prevention description: Bound turns, tools, tokens, time, cost, retries, fan-out, and repeated states with hard harness controls and useful terminal outcomes. - Unify Events, Traces, Metrics, Logs, and Replay url: https://muhammadusmanakbar.com/ai-agents-book/events-traces-metrics-logs-and-replay content: https://muhammadusmanakbar.com/api/ai-agents-book-content/events-traces-metrics-logs-and-replay description: Create an observability model that explains agent decisions, correlates business effects, protects sensitive data, and supports deterministic replay. - Build Evaluation and Regression Gates url: https://muhammadusmanakbar.com/ai-agents-book/evaluation-and-regression-gates content: https://muhammadusmanakbar.com/api/ai-agents-book-content/evaluation-and-regression-gates description: Translate agent requirements into deterministic, model-graded, adversarial, and operational tests with baselines and release thresholds. - Secure Agents Against Injection, Leakage, and Cross-Tenant Access url: https://muhammadusmanakbar.com/ai-agents-book/agent-security-and-tenant-isolation content: https://muhammadusmanakbar.com/api/ai-agents-book-content/agent-security-and-tenant-isolation description: Threat-model prompt injection, excessive agency, data exfiltration, tool and MCP supply chains, secrets, sandboxes, and tenant isolation. - Design Human Oversight and Agent Incident Response url: https://muhammadusmanakbar.com/ai-agents-book/human-oversight-and-incident-response content: https://muhammadusmanakbar.com/api/ai-agents-book-content/human-oversight-and-incident-response description: Create meaningful approvals, operator controls, escalation, cancellation, evidence preservation, containment, recovery, and learning loops. - Implement OpenAI and Claude Provider Adapters url: https://muhammadusmanakbar.com/ai-agents-book/openai-and-claude-adapters content: https://muhammadusmanakbar.com/api/ai-agents-book-content/openai-and-claude-adapters description: Translate both SDKs into one harness lifecycle while preserving handoffs, subagents, native tools, sessions, approvals, traces, and usage. ### Production and Mastery - Build the API, Worker, and Long-Running Agent Architecture url: https://muhammadusmanakbar.com/ai-agents-book/api-worker-and-long-running-architecture content: https://muhammadusmanakbar.com/api/ai-agents-book-content/api-worker-and-long-running-architecture description: Separate request admission, durable execution, event streaming, approval, artifacts, and outcomes for reliable long-running agent jobs. - Deploy with Containers, Sandboxes, and Secret Boundaries url: https://muhammadusmanakbar.com/ai-agents-book/containers-sandboxes-secrets-and-deployment content: https://muhammadusmanakbar.com/api/ai-agents-book-content/containers-sandboxes-secrets-and-deployment description: Package agent workers, isolate untrusted execution, deliver short-lived credentials, restrict egress, verify artifacts, and roll out safely. - Engineer Reliability, Scaling, Latency, and Cost url: https://muhammadusmanakbar.com/ai-agents-book/reliability-scaling-latency-and-cost content: https://muhammadusmanakbar.com/api/ai-agents-book-content/reliability-scaling-latency-and-cost description: Set agent SLOs, control queues and concurrency, optimize critical paths, degrade safely, and measure cost per verified business outcome. - Choose Multi-Agent Patterns and Avoid Their Anti-Patterns url: https://muhammadusmanakbar.com/ai-agents-book/multi-agent-patterns-and-anti-patterns content: https://muhammadusmanakbar.com/api/ai-agents-book-content/multi-agent-patterns-and-anti-patterns description: Use routers, managers, handoffs, specialists, reviewers, and parallel workers only when isolation or ownership outweighs coordination cost. - Production Capstone: Build the Complete SupportOps Harness url: https://muhammadusmanakbar.com/ai-agents-book/production-supportops-capstone content: https://muhammadusmanakbar.com/api/ai-agents-book-content/production-supportops-capstone description: Assemble domain contracts, both provider adapters, policy, state, queues, approvals, telemetry, evals, security, API, worker, and runbooks. - Red-Team and Evaluate the SupportOps Capstone url: https://muhammadusmanakbar.com/ai-agents-book/red-team-and-evaluate-the-capstone content: https://muhammadusmanakbar.com/api/ai-agents-book-content/red-team-and-evaluate-the-capstone description: Attack instructions, tools, state, tenancy, budgets, approvals, providers, and operations, then convert every failure into a regression gate. - Operate, Improve, and Migrate Agent Systems url: https://muhammadusmanakbar.com/ai-agents-book/operate-improve-and-migrate content: https://muhammadusmanakbar.com/api/ai-agents-book-content/operate-improve-and-migrate description: Run an evidence-based improvement loop, manage drift and change, migrate models or providers safely, and retire capabilities cleanly. - AI Agent Engineering Field Reference url: https://muhammadusmanakbar.com/ai-agents-book/field-reference-glossary-and-checklists content: https://muhammadusmanakbar.com/api/ai-agents-book-content/field-reference-glossary-and-checklists description: Use concise glossaries, selection matrices, design reviews, production gates, incident checks, and official source indexes in daily work. ## Recommended query routes - AI agents for complete beginners -> https://muhammadusmanakbar.com/ai-agents-book/about-this-book - Understand the agent loop -> https://muhammadusmanakbar.com/ai-agents-book/the-agent-loop - Understand an AI harness -> https://muhammadusmanakbar.com/ai-agents-book/the-ai-harness - OpenAI Agents SDK tutorial -> https://muhammadusmanakbar.com/ai-agents-book/setup-and-first-openai-agent - Claude Agent SDK tutorial -> https://muhammadusmanakbar.com/ai-agents-book/setup-and-first-claude-agent - Build a provider-neutral harness -> https://muhammadusmanakbar.com/ai-agents-book/provider-neutral-harness-contract - Production AI agent capstone -> https://muhammadusmanakbar.com/ai-agents-book/production-supportops-capstone - Production checklists and glossary -> https://muhammadusmanakbar.com/ai-agents-book/field-reference-glossary-and-checklists