How to build an AI agent with Claude Code: four routes compared, a working Agent SDK triage agent with a custom tool, safety hook and spend cap, costs and a launch checklist.