{"id":310,"date":"2020-01-13T11:22:22","date_gmt":"2020-01-13T11:22:22","guid":{"rendered":"https:\/\/demosites.io\/web-agency-gb\/?p=12"},"modified":"2026-02-04T21:28:06","modified_gmt":"2026-02-04T08:28:06","slug":"web-design-trends-for-2022","status":"publish","type":"post","link":"https:\/\/www.sotic.co.nz\/?p=310","title":{"rendered":"How to Use AI Agents to Automate Programming"},"content":{"rendered":"\n<p>AI coding assistants started as \u201csmart autocomplete.\u201d AI&nbsp;<strong>agents<\/strong>&nbsp;go further: they can&nbsp;<em>plan<\/em>,&nbsp;<em>edit multiple files<\/em>,&nbsp;<em>run tests<\/em>,&nbsp;<em>debug failures<\/em>, and iterate until a task is done\u2014often inside your IDE or terminal.<\/p>\n\n\n\n<p>This article explains what \u201cagentic coding\u201d really is, how modern teams structure it, and how to adopt it safely and predictably.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. What an \u201cAI Agent\u201d Means in Software Development<\/h3>\n\n\n\n<p>An AI agent is typically an LLM wrapped in a loop that can:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Observe context<\/strong>\u00a0(repo files, logs, stack traces, tickets)<\/li>\n\n\n\n<li><strong>Reason + plan<\/strong>\u00a0what to do next<\/li>\n\n\n\n<li><strong>Act<\/strong>\u00a0by using tools (edit files, run commands, search docs)<\/li>\n\n\n\n<li><strong>Evaluate results<\/strong>\u00a0(tests, linters, runtime output)<\/li>\n\n\n\n<li>Repeat until done (or ask for human input)<\/li>\n<\/ol>\n\n\n\n<p>This \u201creason + act\u201d pattern is closely related to the well-known ReAct approach (reasoning traces interleaved with actions).&nbsp;<\/p>\n\n\n\n<p>In practice, the \u201ctools\u201d are what turn a model from \u201cchatty\u201d into \u201cuseful\u201d: shell execution, file editing, repo search, CI triggers, ticket\/PR APIs, etc.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Where Agents Deliver Real Value<\/h3>\n\n\n\n<p>Agents are strongest when there\u2019s a clear feedback loop (tests\/lint\/build) and the task is well-scoped. Common high-ROI use cases:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Bug fixing with reproduction steps<\/strong>\u00a0(agent runs tests, sees failure, patches, re-runs)<\/li>\n\n\n\n<li><strong>Refactors and migrations<\/strong>\u00a0(repeated mechanical edits + compilation\/test cycles)<\/li>\n\n\n\n<li><strong>Adding small features<\/strong>\u00a0with existing patterns (CRUD endpoint, UI component wired to API)<\/li>\n\n\n\n<li><strong>Writing tests<\/strong>\u00a0based on existing style (unit tests, snapshot tests, contract tests)<\/li>\n\n\n\n<li><strong>Investigations<\/strong>\u00a0(summarize code paths, find relevant files, explain behavior)<\/li>\n<\/ul>\n\n\n\n<p>This is why many tools emphasize iteration and self-healing\u2014agents can run code, see errors, and correct themselves.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. The Core Building Blocks of Agentic Coding<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">a) A controlled execution environment<\/h4>\n\n\n\n<p>Agents need to run commands and edit files, but you should treat them like a powerful intern:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>run in a\u00a0<strong>sandbox<\/strong>\u00a0(container \/ limited permissions)<\/li>\n\n\n\n<li>restrict secrets and prod credentials<\/li>\n\n\n\n<li>log everything (commands, diffs, tool calls)<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">b) Tool calling (a.k.a. function calling)<\/h4>\n\n\n\n<p>Instead of hoping the model \u201cdoes the right thing,\u201d you give it explicit tools with schemas\u2014e.g.,&nbsp;<code>read_file<\/code>,&nbsp;<code>apply_patch<\/code>,&nbsp;<code>run_tests<\/code>\u2014so actions are structured and auditable.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">c) Context connectors (IDE, repos, docs, tickets)<\/h4>\n\n\n\n<p>A growing standard here is&nbsp;<strong>MCP (Model Context Protocol)<\/strong>: an open protocol for connecting assistants to external systems and dev environments.&nbsp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">d) A workflow engine for long-running tasks<\/h4>\n\n\n\n<p>For multi-step jobs (hours, not minutes), you want resumability, checkpoints, and human-in-the-loop controls\u2014this is why \u201cdurable execution\u201d and stateful agent graphs show up in orchestration frameworks.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Three Adoption Patterns (Pick One That Fits)<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">a) IDE agent mode (fastest to adopt)<\/h4>\n\n\n\n<p>Tools like VS Code\u2019s Copilot agent mode are designed for iterative work: it gathers context, proposes a plan, edits code, and uses workspace tooling.&nbsp;<br>Best for: day-to-day feature work and fixes where a developer is supervising.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">b) Terminal-based repo agents (great for engineers who live in CLI)<\/h4>\n\n\n\n<p>Tools like&nbsp;<strong>Codex CLI<\/strong>&nbsp;run in your terminal, inspect repos, edit files, and run commands.&nbsp;<br>Best for: quick fixes, refactors, and tasks where you want explicit command visibility.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">c) \u201cPR bot\u201d \/ CI agent (highest leverage, highest governance needs)<\/h4>\n\n\n\n<p>An agent takes a ticket, makes a branch, pushes commits, and opens a PR with a summary + test evidence.<br>Best for: repetitive tasks (dependency bumps, migrations, test generation), at scale.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. A Practical Workflow That Actually Works<\/h3>\n\n\n\n<p>Here\u2019s a reliable \u201cagent loop\u201d you can implement with almost any agent tool:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Define acceptance criteria<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u201cAll unit tests pass\u201d<\/li>\n\n\n\n<li>\u201cNo lint errors\u201d<\/li>\n\n\n\n<li>\u201cAdds tests for bug\u201d<\/li>\n\n\n\n<li>\u201cNo public API changes\u201d<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Force a plan before coding<\/strong>\n<ul class=\"wp-block-list\">\n<li>files to touch<\/li>\n\n\n\n<li>approach<\/li>\n\n\n\n<li>risks \/ assumptions<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Constrain edits<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u201cOnly change\u00a0<code>src\/payments\/*<\/code>\u00a0and related tests\u201d<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Run a tight feedback loop<\/strong>\n<ul class=\"wp-block-list\">\n<li><code>lint \u2192 unit tests \u2192 integration tests \u2192 build<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Require a PR-style report<\/strong>\n<ul class=\"wp-block-list\">\n<li>what changed<\/li>\n\n\n\n<li>why it changed<\/li>\n\n\n\n<li>commands run + results<\/li>\n\n\n\n<li>remaining risks \/ follow-ups<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>Many teams find that \u201cplan-first + test-driven feedback\u201d is the difference between \u201cwow\u201d and \u201cwhy did it rewrite half my repo.\u201d<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6. Measure Quality Like a Grown-Up (Not With Vibes)<\/h3>\n\n\n\n<p>If you want to know whether agents are improving engineering output, use real benchmarks and internal scorecards.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>SWE-bench<\/strong>\u00a0is a widely used benchmark for real GitHub issue fixing (codebase + issue \u2192 patch).\u00a0<\/li>\n\n\n\n<li>The ecosystem around SWE-bench (like SWE-agent \/ mini-SWE-agent) also shows how simple an effective agent can be when you keep the loop tight and grounded in test results.\u00a0<\/li>\n<\/ul>\n\n\n\n<p>For your org, define a small internal suite:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u201cTop 20 recurring bug classes\u201d<\/li>\n\n\n\n<li>\u201cTop 10 refactor patterns\u201d<\/li>\n\n\n\n<li>\u201cTop 10 onboarding tasks\u201d<br>Track: success rate, time-to-merge, regression rate, reviewer effort.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">7. Security and Governance: The Part You Can\u2019t Skip<\/h3>\n\n\n\n<p>Agentic coding increases the \u201cblast radius\u201d because the model can&nbsp;<em>do<\/em>&nbsp;things, not just&nbsp;<em>suggest<\/em>&nbsp;them.<\/p>\n\n\n\n<p>Minimum safeguards:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Principle of least privilege<\/strong>\u00a0(read-only by default; write only when needed)<\/li>\n\n\n\n<li><strong>No secrets in agent context<\/strong>\u00a0(or use strict secret redaction)<\/li>\n\n\n\n<li><strong>Command allowlist \/ denylist<\/strong>\u00a0(especially for\u00a0<code>curl | bash<\/code>, package installs, git hooks)<\/li>\n\n\n\n<li><strong>Human approval gates<\/strong>\u00a0before pushing or opening PRs<\/li>\n\n\n\n<li><strong>Prompt injection awareness<\/strong>\u00a0(agents can be tricked by malicious files\/issues)<\/li>\n<\/ul>\n\n\n\n<p>These concerns are not theoretical\u2014tooling and connector layers have had real-world security discussions and patches, which is exactly why sandboxing + permissioning matters.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">8. A Simple \u201cStarter Playbook\u201d for Your Team<\/h3>\n\n\n\n<p>If you want a low-risk rollout:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Start with\u00a0<strong>supervised<\/strong>\u00a0IDE\/CLI agents for:\n<ul class=\"wp-block-list\">\n<li>writing tests<\/li>\n\n\n\n<li>fixing flaky tests<\/li>\n\n\n\n<li>small bugs with reproduction<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Add a\u00a0<strong>definition of done<\/strong>\u00a0template the agent must follow:\n<ul class=\"wp-block-list\">\n<li>plan \u2192 patch \u2192 tests \u2192 report<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Create \u201cagent skills\u201d \/ reusable runbooks:\n<ul class=\"wp-block-list\">\n<li>how your repo is structured<\/li>\n\n\n\n<li>how to run tests locally<\/li>\n\n\n\n<li>coding conventions<br>(Some platforms now formalize this idea as reusable agent skill bundles.)\u00a0<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Only then consider PR automation.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Closing Thought<\/h3>\n\n\n\n<p>The winning mindset is:&nbsp;<strong>agents are compilers for intent<\/strong>. They turn natural language into repo changes\u2014<em>but only if you give them constraints, tools, and feedback loops that make success measurable.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>AI coding assistants started as \u201csmart autocomplete.\u201d A&hellip;&nbsp;<a href=\"https:\/\/www.sotic.co.nz\/?p=310\" rel=\"bookmark\"><span class=\"screen-reader-text\">How to Use AI Agents to Automate Programming<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":417,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-310","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.sotic.co.nz\/index.php?rest_route=\/wp\/v2\/posts\/310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sotic.co.nz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sotic.co.nz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sotic.co.nz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sotic.co.nz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=310"}],"version-history":[{"count":1,"href":"https:\/\/www.sotic.co.nz\/index.php?rest_route=\/wp\/v2\/posts\/310\/revisions"}],"predecessor-version":[{"id":418,"href":"https:\/\/www.sotic.co.nz\/index.php?rest_route=\/wp\/v2\/posts\/310\/revisions\/418"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sotic.co.nz\/index.php?rest_route=\/wp\/v2\/media\/417"}],"wp:attachment":[{"href":"https:\/\/www.sotic.co.nz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sotic.co.nz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sotic.co.nz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}