Agentic Coding with OpenAI Codex CLI: Build intelligent agent workflows using Agentic Engineering, MCP, hooks, and delivery automation
Comprehensive guide to Codex CLI: prompting, AGENTS.md, MCP, hooks, skills, sub-agents, orchestration, CI/CD, security, and enterprise deployment, with exercises
Key FeaturesMove from first principles to production workflows and team-scale agentic practice.Apply proven patterns for orchestration, code review, migration, testing, and CI/CD delivery.Harden agent sessions with approval modes, kernel-level sandboxing, and security practices.Purchase of the print or Kindle book includes a free PDF eBookBook Description
Agentic Coding with OpenAI Codex CLI is a comprehensive guide to agentic AI development with OpenAI’s command-line coding agent. Across six parts, you’ll move from first principles to production workflows and team-scale practice: prompting and AGENTS.md configuration, approval modes and kernel-level sandboxing, model selection, context and cost management, MCP servers, hooks, skills, sub-agents and orchestration, worktrees, CI/CD integration, security hardening, and enterprise deployment.
Later chapters cover debugging and testing agentic workflows, AI code review, practical engineering guides (codebase migration, backend, frontend, and infrastructure as code), and the bigger picture: benchmarks, competing tools, harness engineering, and how to structure an agentic engineering team.
Whether you’re a solo developer looking to multiply your output or an engineering lead rolling out agentic workflows across a team, this book gives you the mental models and practical techniques to work effectively with AI coding agents.
It draws on real-world experience and community insights, and every chapter includes learning objectives, worked examples, and hands-on exercises.
What you will learnSet up, authenticate, and prompt Codex CLI effectivelyWrite AGENTS.md rules and apply patterns that avoid common pitfallsChoose approval modes, kernel-level sandboxing, and trust boundariesManage model selection, reasoning effort, context windows, and costExtend the agent with MCP servers, hooks, and skillsCoordinate sub-agents, multi-agent orchestration, and worktreesIntegrate Codex into CI/CD, security hardening, and enterprise deploymentApply Codex to code review, migration, backend, frontend, and infrastructure as codeWho this book is for
This book is for software developers who are comfortable in a terminal and want to use AI agents for real engineering work rather than isolated code suggestions. It is also useful for tech leads and engineering managers who need a framework for adopting agentic coding safely at team or enterprise scale. DevOps practitioners and architects interested in integrating agent workflows into delivery pipelines will also find it relevant. Some experience with version control and command-line tools is assumed; no prior knowledge of Codex CLI is required.
Table of ContentsWhat Is Codex CLI?Getting Started with Codex CLIPrompting Codex CLI EffectivelyAGENTS.md: Patterns and PitfallsApproval Modes and Trust BoundariesModel Selection and Reasoning EffortContext Window ManagementMCP: Consuming and ServingHooks: Intercepting the Agent LifecycleThe Skills Ecosystem: Using and Writing SkillsSub-Agents and Parallel ExecutionMulti-Agent Orchestration PatternsWorktrees and Isolated ExecutionCost Management and Quota StrategyCI/CD IntegrationSecurity HardeningEnterprise DeploymentDebugging and Diagnosing Agent Failures
(N.B. Please use the Read Sample option to see further chapters)
From the Publisher
The Claim
Hand the agent the whole task
Codex CLI reads your repository, runs your tests, makes commits and follows the rules you write in AGENTS.md. This book is about the task with a beginning, a middle and an end: the refactor, the feature, the failing build. Written for mid-to-senior engineers who already use AI-assisted development and are comfortable in a terminal.
Endorsed by
Shalini Goyal
Executive Director, AI & Engineering, JPMorgan.
“A well-structured guide that progresses from Codex CLI fundamentals and effective prompting to MCP, reusable skills, multi-agent orchestration, security, and CI/CD integration. It provides a clear path from experimenting with AI coding agents to deploying reliable agentic workflows in real-world engineering environments.”
Thomas Rice
Microsoft AI Business Solutions Architect, EMCOR Facilities Services.
“A practical guide to agentic coding that goes beyond prompting to cover MCP, agent orchestration, security, CI/CD, and multi-agent workflows. A valuable resource for developers and technical leaders looking to move from AI experimentation to real-world implementation.”
Yacob Cohen Arazi
Prompt Software Engineer, NVIDIA.
“A comprehensive and practical reference for Codex CLI, covering everything from configuration and permissions to skills, sub-agents, MCP, hooks, and sandboxing. An excellent resource for developers looking to use Codex effectively and understand its more advanced capabilities.”
Inside the book
What you will be able to do
Approval modes and trust boundaries. Decide what the agent may do before it does it, and move up the permission ladder as trust grows. Chapter 5.MCP and hooks. Wire in your own tools and intercept every step of the agent lifecycle. Chapters 8 and 9.Sub-agents and orchestration. Run parallel work under one orchestrator: in-process, in local worktrees, or as cloud fan-out. Chapters 11 to 13.Security hardening and CI/CD. Take the agent into your pipeline and harden it for production. Chapters 15 to 17.28 chapters in six parts. 670 pages.
What stays true when the tool changes:
“Codex CLI releases weekly, sometimes more often. That’s not a reason to distrust the book: the architecture, the mental models, and the core workflows are stable. It does mean you should treat specific flags and configuration options as starting points rather than gospel.”
Daniel Vaughan, from the preface. The same note tells you to treat the changelog and the tool’s own help output as more authoritative than the printed page.
Daniel Vaughan
Head of Forward Deployed Engineering, HCLTech AI Labs.
Vaughan led cloud strategy and architecture for real-time payment products at Mastercard in London, and spent eight years at the European Bioinformatics Institute in Cambridge. He wrote Cloud Native Development with Google Cloud for O’Reilly and is a Google Developer Expert.
At HCLTech AI Labs he built the Forward Deployed Engineering practice from the ground up, running pods where a shared architect, a few engineers and a team of agents deliver the output of a much larger team.
He wrote this book with the assistance of AI coding agents, which he considers appropriate given the subject. The editorial judgements and architectural decisions are his.

