A cutting-edge pattern involves AI agents using a CLI to pull their own runtime failure traces from monitoring tools like Langsmith. The agent can then analyze these traces to diagnose errors and modify its own codebase or instructions to prevent future failures, creating a powerful, human-supervised self-improvement loop.
Unlike simple chatbots, AI agents tackle complex requests by first creating a detailed, transparent plan. The agent can even adapt this plan mid-process based on initial findings, demonstrating a more autonomous approach to problem-solving.
AI code editors can be tasked with high-level goals like "fix lint errors." The agent will then independently run necessary commands, interpret the output, apply code changes, and re-run the commands to verify the fix, all without direct human intervention or step-by-step instructions.
Unlike previous models that frequently failed, Opus 4.5 allows for a fluid, uninterrupted coding process. The AI can build complex applications from a simple prompt and autonomously fix its own errors, representing a significant leap in capability and reliability for developers.
In an extreme example of recursive development, Block's team uses their open-source AI agent, Goose, to write most of the new code for the Goose project itself. The ultimate goal is for the agent to become completely autonomous, rewriting itself from scratch for each release.
Instead of manually refining a complex prompt, create a process where an AI agent evaluates its own output. By providing a framework for self-critique, including quantitative scores and qualitative reasoning, the AI can iteratively enhance its own system instructions and achieve a much stronger result.
Instead of codebases becoming harder to manage over time, use an AI agent to create a "compounding engineering" system. Codify learnings from each feature build—successful plans, bug fixes, tests—back into the agent's prompts and tools, making future development faster and easier.
When an AI tool makes a mistake, treat it as a learning opportunity for the system. Ask the AI to reflect on why it failed, such as a flaw in its system prompt or tooling. Then, update the underlying documentation and prompts to prevent that specific class of error from happening again in the future.
To maximize an AI agent's effectiveness, establish foundational software engineering practices like typed languages, linters, and tests. These tools provide the necessary context and feedback loops for the AI to identify, understand, and correct its own mistakes, making it more resilient.
In traditional software, code is the source of truth. For AI agents, behavior is non-deterministic, driven by the black-box model. As a result, runtime traces—which show the agent's step-by-step context and decisions—become the essential artifact for debugging, testing, and collaboration, more so than the code itself.
When an agent fails, treat it like an intern. Scrutinize its log of actions to find the specific step where it went wrong (e.g., used the wrong link), then provide a targeted correction. This is far more effective than giving a generic, frustrated re-prompt.