How to Coexist with AI Agents in Legacy Backends

Computing/Software3 min read

TuBrief Editorial Written with AI assistance from the source video. The video is the authority. Source video: It's been a while! · Maximilian Schwarzmüller

Setting Priorities: What to Delegate

Developers managing legacy systems face a crossroads every day: should I resolve accumulated technical debt, or build the new features needed right now? As research suggests that about 72% of global IT budgets are spent on maintaining existing systems (IDC, 2024), most of our time is also tied up in the legacy of the past.

The problem is that you cannot delegate all tasks to an AI agent. If you introduce agents blindly, you are likely to fall into a productivity paradox where your workload actually increases. Divide your tasks into two categories:

  • Agent Delegation Area: Simple tasks far removed from business logic, such as writing DTOs, implementing utility functions, or generating boilerplate code.
  • Direct Control Area: Core domains where business policies are complexly intertwined, and exception control flows.

Categorize your weekly task list using these criteria. Even delegating just the simple tasks to an agent can reduce developer burnout and boost weekly productivity by over 30%.

Building a Sandbox for Safe Experimentation

Merging code created by an agent directly into production is a gamble. As Gartner's analysis indicates that 95% of generative AI pilot programs as of 2025 failed to demonstrate financial results, introducing AI without integrated design is a waste of time.

Build an environment to isolate and safely test specific modules.

  1. Check Test Coverage: If the test coverage of the target module is below 80%, write characterization tests to lock in the behavior of the existing logic before using an agent.
  2. Isolated Execution Environment: Use E2B SDK or Docker to create a virtual sandbox completely separated from the production network.
  3. Result Verification: You must include negative tests to verify how the code written by the agent reacts to abnormal input values.

Having this sandbox environment can save you at least 5 hours of debugging time every week.

Technical Debt Prompts to Accelerate Code Reviews

PR review is a time-consuming task. You can accelerate the review process by having an agent identify technical debt. For this, the prompt you provide to the agent should follow the STCO (System, Task, Context, Output) structure:

  • System: Assign the role of a Senior Backend Architect.
  • Task: Request an analysis of technical debt within the code and suggestions for refactoring.
  • Context: Specify the current project's constraints, such as JPA persistence layer specifications or history of distributed traffic spikes.
  • Output: Have it output vulnerabilities and specific modification snippets in Markdown format.

If you use tools like Repomix to extract only core interfaces and structures instead of the entire codebase to input into the agent, you can reduce token usage by over 70%.

Tools are just tools. If you do not go through a 4-step checklist (checking for build bypasses, inspecting duplicate code, tracing memory leaks, and performing negative tests) to manually verify the results produced by the agent, the system will eventually fester. Let the machines handle the typing, but you must keep your hand on the macro-directional steering wheel of the system.

Related Video

It's been a while!

Maximilian Schwarzmüller1:55:13

More from the community

Comments

Log in to leave a comment.

No comments yet.