The Agent Attack Surface
Prompt injection, the lethal trifecta, poisoned tools, and slopsquatting — and the layered defences that keep a stranger's text from steering your agent.
Engineering in the age of AI agents
A field guide for software engineers learning to work with agents instead of against them — context, guardrails, tests, conventions, and the judgement that ties them together. Written by an engineer who ships with agents every day. Free, forever.
The first edition shipped in March 2026. Since then the tools converged, cloud agents started sending pull requests, and prompt injection went from a curiosity to a string of real incidents. This edition catches up — and fixes what I got wrong.
Prompt injection, the lethal trifecta, poisoned tools, and slopsquatting — and the layered defences that keep a stranger's text from steering your agent.
From driving a coding agent to shipping your own: owning the loop and the context, humans as a tool call, durable state, and evals.
Compaction, context rot, sub-agents, AGENTS.md, skills, hooks, cloud agents that return PRs — and a rewritten chapter on models.
The perishable details — models, prices, products — moved to one dated appendix, so the chapters can age gracefully.
It started with porting the Claude Agent SDK from Python to Go — using Claude Code itself. Over a hundred prompts, and one realisation: most of them were wasted, because I didn't yet know how to direct the work. Not because the model wasn't smart enough. Because I wasn't.
The keystrokes and boilerplate fall away. Systems thinking, taste, and judgement become the whole game.
The tools arrived faster than the practices. This is the honest engineering guide — no hype, no doom, real scar tissue.
Context, guardrails, tests, conventions. Tools change every quarter. Those compound over a career.
The craft isn't dying. It's molting.
The outer shell — the keystrokes, the syntax, the boilerplate — that part is falling away. But the animal underneath? The part that knows what to build and why, that smells a bad abstraction from three files away? That part is more alive than ever.
From the ForewordNineteen chapters in five parts, from what an agent really is to how whole teams work with them — plus two appendices.
What changed, and what an agent really is
The fundamental loop of software engineering is breaking. What it means to go from writing software to engineering it — with a crew of agents at your side.
1:46 filmModel, tools, loop, and harness. What makes something truly agentic, how tool calling actually works, how agents fail, and the right mental model for working with them.
2:36 filmThe durable foundations: context, guardrails, git, tests, conventions, memory
The most important skill in agentic engineering is context engineering. Curating what agents see, compaction, sub-agents for isolation, and why bigger windows didn't remove the tax.
2:33 filmThe trust gradient, real permission configs, hooks the model can't talk its way around, sandboxing, and the ethics of delegation.
2:35 filmSmall commits, descriptive messages, branch-per-task, worktrees for parallel agents, and reviewing at the volume agents produce.
2:30 filmTests become the agent's eyes. TDD as a superpower, fast test suites as agent infrastructure, and the virtuous cycle of better tests and more autonomous agents.
2:45 filmConsistent structure, AGENTS.md instruction files, and skills — conventions your agents can execute, not just read.
2:34 filmMemory for agentic workflows — capturing knowledge across sessions and agents, separating knowledge from execution state, and keeping memory safe.
2:28 filmReach, risk, intent, and the models underneath
MCP, remote servers, and connecting agents to databases, monitoring, and project management — without drowning them in tools.
2:35 filmPrompt injection, the lethal trifecta, poisoned tools, slopsquatting, and layered defences that limit the blast radius.
2:38 filmFrom doing to articulating. Plan-first workflows, specs, constraints, task decomposition, voice and visual context, and skills as the modern prompt library.
2:28 filmCapability, cost, privacy, and speed. Open-weight models, subscriptions versus API spend, honest ROI, and matching the model to the task.
2:38 filmMany agents, pipelines, and building your own
Sub-agents for context isolation, background agents that return PRs, the handover pattern, and knowing when more agents isn't better.
2:37 filmAgents in CI/CD — review bots, the overnight agent turned product, cost control, and untrusted input when nobody's watching.
2:26 filmFrom driving a coding agent to shipping your own — owning the loop, the context, human approvals, durable state, and evals.
2:38 filmFailure, restraint, teams, and what lasts
War stories from the field — the eager refactorer, the hallucinated library, the poisoned ticket — plus a diagnostic playbook for fixing agent failures.
2:39 filmThe overhead tax, architecture decisions, security-critical code, hostile input, legacy codebases, and the craft argument.
2:30 filmMeasured versus perceived productivity, code review at volume, a path for junior engineers, knowledge distribution, compliance, and hiring.
2:52 filmThe craft isn't dying — it's shedding its skin. What changed my mind since the first edition, and why the captain still matters.
2:31 filmTech-savvy but don't write code? The same ideas, translated for designers, PMs, founders and everyone else on the crew. About the Crew Member's Guide →
The horizon is wider than you think. Why this book exists — and why it's for you.
The line between technical and non-technical is dissolving. What's changing, and why it matters for your role.
Every app is a restaurant — front of house, kitchen, and pantry. A plain-language tour of how software actually works.
Observe, plan, act, check — repeat. The mental model that makes everything else click.
The two-captains story that changes how you think about prompts — and why you should ask for a plan first.
An agent can only work with what's on the bench. Setting up the right inputs, keeping the bench tidy, and checking the output.
Start tight. Loosen with evidence. How much autonomy to give, and when to pull the reins.
Connecting the agent to the world beyond its window — connectors, tools, and integrations.
When the email gives your agent orders. Prompt injection, the lethal trifecta, and the three-question check before you connect anything.
From idea to working prototype in a weekend. Your first hands-on walkthrough.
The sealed envelope — how the internet keeps secrets. Security explained without jargon.
The principles transfer to everything. A second walkthrough that proves you don't need to be a programmer.
The mistakes are inevitable. The recovery is a skill. Real war stories and how to handle them.
Sometimes the right tool is your own hands. Knowing when agents aren't the answer — and when it only feels faster.
You are the quality control. Reviewing work that agents did while you were away — and why your attention is the new bottleneck.
You speak two languages now. How to bridge the gap between technical and non-technical colleagues.
Ten minutes, three times a week. How to stay current without drowning in the firehose.
Which tool do you actually open on Monday morning? The state of the tools, September 2026.
Now go build something. You were always technical enough.
No sign-up, no email wall. PDF for reading at a desk, EPUB for e-readers. Download it as often as you like.
The Agentic Crew — second edition, September 2026
Prefer slides? Try the interactive presentation. Past versions live in the revision archive.
More from the series
The same ideas for people who don't write code. English and Català.
Exercises for your own machine: fork, build, ship, and pentest with an agent.
This project is free and always will be.
☕ Buy me a coffeeAI-narrated audiobooks, chapter by chapter: both books, two voices, English and Catalan. It remembers where you stopped.
Your AI guide to The Agentic Crew.
Runs entirely in your browser — private & offline-capable.
⚠️ Polly is a very small model (0.5B) and may hallucinate. She's trained on the book but take answers with a grain of salt!