An AI technical debt audit looks for the code and operating choices that make AI features expensive, difficult to change or unsafe to rely on. For a scale-up, the warning signs are often hidden in the path between a user request and a model response: orchestration layers, prompt construction, tool permissions, testing and model routing. Our AI strategy and solutioning service helps teams decide which risks to tackle first and what should be redesigned.
The checklist below is for teams whose AI proof of concept has become a production feature, or whose product now depends on several models, agents or retrieval steps. It is also useful before a major product release, a material increase in AI spend or technology due diligence. The aim is not to remove every abstraction or replace every framework. It is to find where the system has no clear owner, limit or recovery path.
AI technical debt is more than messy code. It includes hidden dependencies on model behaviour, costs that grow faster than use, and gaps in evidence about whether a change is safe. The foundational paper Hidden Technical Debt in Machine Learning Systems describes how machine learning systems accumulate debt through data dependencies, glue code and changes whose effects are hard to isolate. In a modern AI product, those risks can also sit in prompts, tool calls and model-provider settings.
A useful audit connects code inspection to production evidence. Check a representative user journey from request to response, then trace its prompt, model, tools, data, tests, logs and cost. The six warning signs below make that review concrete.
| Warning sign | What to inspect | Evidence of a healthier state |
|---|---|---|
| Fragile orchestration | Framework layers and provider-specific logic | A small, understandable call path with clear interfaces |
| Unhedged token use | Prompt size, cache behaviour and retries | Measured cost per task, limits and cache-aware prompt structure |
| Missing evaluations | Test coverage for model behaviour | Repeatable evaluations in the change and release process |
| Prompt sprawl | Prompt storage, ownership and release history | Versioned prompts with schemas and a rollback path |
| Unbounded tool authority | Agent permissions and side effects | Narrow tools, policy checks and approval for sensitive actions |
| Model lock-in | Model identifiers, provider errors and fallback | Tested routing, explicit budgets and documented recovery |
1. Fragile orchestration wrappers hide the real call path
An orchestration framework can speed up a prototype. It may handle prompt templates, retrieval, memory, tool selection and model calls in one place. The debt starts when your application depends on a deep stack of abstractions that the team cannot explain, test or change without risking unrelated behaviour.
Look for business rules embedded in framework chains, custom wrappers that wrap other wrappers, and provider-specific settings scattered through application code. Trace one real request. How many components transform it before it reaches the model? Where are retries applied? Can an engineer inspect the exact messages and tool definitions sent to the provider? If the answers require reading several layers of framework internals, troubleshooting will be slower than it needs to be.
This is not a case against frameworks. The useful question is whether an abstraction earns its place. A framework should reduce repeated work without hiding important decisions such as model selection, prompt assembly, error handling and streaming. A thin client that standardises timeouts, logging and response validation may be easier to own than a large orchestration layer. A mature framework may still be the right choice if the team understands its behaviour and has tests around the parts it relies on.
The Thoughtworks Technology Radar entry on LangChain is one perspective on the trade-offs of adopting a fast-moving framework. Treat it as a prompt for review, not a verdict on your stack. Your audit should ask what your code actually uses, how upgrade changes are tested and what happens if a dependency changes direction.
Try a small change as a practical test: swap the model provider in a non-production environment, or replace one tool integration. Record the files touched, the tests required and the behaviours that need manual checking. If a provider change forces edits across business logic, user-interface code and tool implementations, your integration boundary is too weak. If replacing a framework would mean rewriting everything, you have an architectural dependency worth understanding, even if you decide not to remove it now.
A healthier design separates application decisions from provider mechanics. The application should define the task and required output. A focused model client should handle provider requests, timeouts, retries and response parsing. Tool definitions should have stable interfaces and explicit permissions. Keep the raw request and response available in a safe, access-controlled trace so engineers can debug real failures without guessing what an abstraction did.
Write down what a provider or framework swap would involve. Do not promise that it can happen in an afternoon; that depends on the product. Instead, identify the seams, list the compatibility tests and estimate the actual work. If you are reviewing an agent architecture, our AI agents and automation service focuses on the path from a working prototype to a controlled production system.
2. Unhedged token consumption makes costs hard to predict
A model bill that grows faster than user activity is a signal to investigate, not proof of one specific problem. Long conversation histories, repeated context, retries, oversized tool results and reasoning-heavy requests can all raise cost per task. A useful audit follows the full request, rather than looking only at a monthly provider invoice.
Start by measuring input and output tokens per task type. Include retries and failed calls. Separate user-facing requests from background jobs, evaluations and development traffic. Then compare the size and composition of prompts over time. If each turn resends the entire conversation, or a retrieval step returns long passages that are not used, the product may be paying repeatedly for context that adds little value. Set a deliberate context policy: what history is kept, what is summarised, what is retrieved, and when a task should stop rather than continue looping.
Check caching too, but verify the rules for the provider and model you actually use. As comparative analyses of prompt caching across OpenAI, Anthropic and Gemini show, caching mechanics and eligibility differ across providers. Prompt caching generally depends on repeated prompt prefixes, so changing the beginning of a prompt can prevent a cache match. Anthropic explains its implementation and requirements in the Claude prompt caching documentation; OpenAI documents its approach in the API prompt caching guide. These are provider-specific features, and their behaviour, eligibility and economics can change. Do not assume a cache is helping because the code has a cache-related option enabled. Check provider responses and your own traces for evidence of cache reads and writes.
Prompt ordering is worth inspecting. Stable instructions and tool definitions may be repeated across calls, while timestamps, request identifiers and user-specific details vary. If volatile content is placed before otherwise reusable context, it may reduce the opportunity for a prefix match. Where the provider supports caching, put stable content in the cacheable section and dynamic data later, following the provider's current documentation. Measure the result instead of treating prompt rearrangement as a guaranteed saving.
Then inspect controls. Set maximum input and output sizes that suit each task. Add limits to retries, agent steps and tool-result size. Track cost by feature, customer or workflow where your privacy and billing arrangements permit. Alert on a rise in cost per task versus cost per token, not just total spend, because total spend will naturally change with usage. A useful dashboard should show successful completion as well as tokens consumed; a cheap response that fails the user is not an efficiency win.
Finally, test failure paths. A tool timeout that triggers several full model calls can multiply spend without producing a useful result. Retry only errors that may recover, use backoff where appropriate and stop after a clear limit. If the application cannot say what a successful task costs under normal and degraded conditions, it has an economic control gap. Make cost ownership part of the feature, alongside latency, reliability and user outcomes.
3. Vibe-check deployments have no dependable evaluation pipeline
A developer trying a few examples in a chat playground is useful during exploration. It is not enough to establish that a prompt or model change is safe. Model output varies, and a change that fixes one case may alter formatting, omissions or tool choices in another. A production team needs repeatable evidence before shipping changes that affect important user journeys.
The minimum useful evaluation begins with examples that reflect real work. Build a fixed dataset of representative inputs, including ordinary cases, edge cases and known failures. Store expected outcomes in a form that fits the task. For extraction, that may mean required fields, valid types and acceptable values. For classification, it may mean labelled examples and an agreed way to assess errors. For a customer-facing response, it may mean criteria for factual grounding, completeness and policy compliance rather than one exact string match.
Keep the dataset governed. Remove or protect personal information, control who can access it and record where examples came from. Include examples of failures that matter to the business, not just inputs that make the model look good. A small, carefully maintained set can be more useful than a large, noisy collection that nobody reviews. Make it possible to add an example when a production incident reveals a new failure mode.
Run the evaluations when prompts, model settings, retrieval logic, tool definitions or provider versions change. A pull request does not need to launch a large machine-learning platform. It needs an automated check that can compare the proposed version with a known baseline, flag material regressions and record which model and prompt were tested. Use deterministic checks where possible. Validate structured output against a schema, check that required fields exist and reject invalid tool arguments before they reach a system. Use human review for judgements that cannot be reliably reduced to a simple rule.
The PromptDebt study reports an analysis of 93,142 Python source files across LLM projects. The study identifies prompt design and framework integration among the debt patterns it examined. Its findings are a view of the projects and method in that study, not a universal estimate for every company. The practical lesson is narrower: prompts and framework choices are real engineering assets, so changes to them need review and regression evidence just like other production code.
Do not hide weak results behind one aggregate score. Break findings down by task type and failure category. A system can improve its average score while becoming worse at a rare but high-impact case. Decide in advance which failures block a release, which require a human fallback and which can be monitored after launch. Record model, prompt, retrieval and evaluation dataset versions with each run. If nobody can reproduce what was tested, the evaluation is not yet a reliable release control.
The evaluations for Claude agents guide explores evaluation patterns in more detail. During an audit, follow the evidence from a change request to the test run and then to the deployed version. If there is no link between them, your team is relying on memory and manual reassurance instead of a controlled release process.
4. Prompt sprawl leaves production behaviour without an owner
Prompts often begin as short strings near the code that calls a model. Over time, they grow into important product logic. Instructions may be copied into route handlers, background workers, front-end components, database seed scripts and provider dashboards. If engineers cannot identify the authoritative version, a prompt change can be difficult to review, reproduce or reverse.
Search the repository and deployment configuration for system prompts, tool descriptions, few-shot examples and model-specific instructions. Record where each prompt lives, which feature uses it, who owns it and how it reaches production. Look for near-duplicates with small differences. A forked prompt may be intentional, but an undocumented copy can drift until two parts of the product behave differently for no clear reason.
Treat prompts as versioned application artefacts. Keep them in a location where changes receive code review, have a commit or release identifier and can be rolled back. Where a prompt is stored in a separate registry or provider console, record a version and export or otherwise retain the deployed content. A registry is not automatically better than files in source control. The requirement is that the team can find the live version, understand who changed it and reproduce the behaviour it was intended to produce.
Separate stable instructions from task data. Define the variables a prompt accepts and validate them before use. A schema can catch missing or incorrectly typed inputs. Keep sensitive information out of prompt logs unless there is a clear purpose, access control and retention policy. For regulated or privacy-sensitive workflows, review what data is sent to a model provider and what the application stores. A prompt repository does not make a workflow compliant by itself, but it gives reviewers a more reliable place to inspect instructions and data handling.
A change process should make risk visible. For a prompt modification, note its purpose, affected tasks, expected improvement and known trade-offs. Run the relevant evaluation set. Roll out changes in a way that lets you compare behaviour or restore the previous version. Avoid making an edit directly in production without recording it. If a provider offers prompt-management features, decide whether the control, audit and access model fits your organisation before relying on it.
A strong audit also checks prompt ownership. Someone should be accountable for correctness, another person or process should review material changes, and product or operations teams should know when behaviour has changed. This matters when a prompt guides a workflow that can affect a customer, financial decision or staff process. Where teams work with regulated data, connect prompt review to the wider technology and privacy controls, rather than treating prompt text as harmless configuration.
The warning sign is not that prompts are long. Some tasks need detailed instructions. It is that they are untracked, duplicated or impossible to connect to a production outcome. Practitioners frequently note how massive system prompts are technical debt when instructions grow without ownership or modularity. A versioned prompt with tests and an owner is usually easier to improve than a supposedly simple string nobody can safely change.
5. Unbounded agent authority turns mistakes into side effects
An agent can be described as a model-driven process that selects tools or actions to complete a task. The risk changes when a tool can alter records, send messages, approve payments or run commands. If the model can reach powerful operations directly, an incorrect interpretation or manipulated input may produce a real side effect before a person can intervene.
Inventory every tool available to each agent. For each one, write down what it can read, what it can change, which users or records it can access and whether the action is reversible. Pay particular attention to broad database credentials, general-purpose shell access, unrestricted HTTP requests and tools that combine several operations behind one call. A tool name such as update_customer may conceal a broad permission to change fields that the task does not need.
Apply least privilege: give a component only the access required for its job. Prefer task-specific operations over a raw connection. Instead of exposing a general database client, offer a narrow function that can retrieve a permitted record or propose a specific update. Validate arguments in deterministic code before execution. Enforce tenant boundaries, rate limits and destination allowlists outside the model. The model can suggest an action, but trusted application code must decide whether that action is allowed.
Separate proposal from execution for high-impact actions. An agent may draft a payment, account change or customer communication, but a policy layer can check the proposal and require an authorised person to approve it. Approval should show enough context for the reviewer to make a decision, and the system should record who approved what. Do not confuse a prompt instruction such as do not make unauthorised changes with an access control. A model instruction is not a security boundary.
Test misuse as well as normal use. Try requests that ask the agent to access another customer's data, call tools out of sequence or make a prohibited change. Check whether untrusted retrieved content can influence the agent to ignore its task. Confirm that denied actions are logged without unnecessarily retaining sensitive information. Build a safe failure state: if policy checks or identity services are unavailable, the system should not silently execute a sensitive action.
The O'Reilly discussion of agent responsibilities and boundaries is useful context for separating what an agent can do from what it should be responsible for. The audit should turn that distinction into enforceable controls in your application. For organisations handling regulated workloads, these controls also need to fit the wider risk and security approach. PADISO's AI for financial services work is relevant when agent workflows touch financial processes.
Finally, keep an audit trail that can answer practical questions: what request initiated the action, what data and tools were involved, what policy decision was made and whether a person approved it. Redact or restrict sensitive content as needed. The point is not to log everything forever. It is to retain sufficient, protected evidence to investigate incidents, understand behaviour and improve controls.
6. Model deprecation lock-in leaves no recovery route
A production feature that calls one model identifier directly may be simple today. The debt appears when the model changes, the provider has an outage, rate limits interrupt service or the task no longer justifies that model's cost and latency. A hardcoded identifier is not automatically a problem. An untested dependency with no owner or fallback plan is.
Search configuration and code for model names, API versions, context limits and provider-specific options. Check whether these settings are centralised or repeated across services. Confirm who receives provider lifecycle notices and how the team decides whether to migrate, stay or change suppliers. Record the exact deployed configuration, not just a broad label such as latest model. Make sure the team can identify which requests used which model when investigating a production issue.
Design routing around the task, not a vague idea of a best model. A straightforward extraction or classification step may have different quality, speed and cost requirements from a complex reasoning task. Evaluate candidate models on your own task examples. Compare quality, latency, failure rates and cost per successful result, including retries and any human review the workflow needs. Do not route work to a smaller model simply because its token price is lower if it increases errors or rework.
Build fallback behaviour deliberately. A fallback might retry after a transient error, route to a second provider, queue work for later or ask the user to try again. Those options are not interchangeable. A second model can return a different answer, so it needs its own evaluations and output checks. Retrying a non-idempotent tool action can create duplicate side effects. The application should distinguish provider failure from a valid but low-confidence answer, and it should stop rather than loop indefinitely.
An inference gateway or internal client can centralise routing, authentication, observability and budget rules. It can also become another dependency, so keep its purpose narrow and test its behaviour. Make provider-specific capabilities explicit. If one provider supports a feature another does not, do not hide that difference behind a misleading common interface. The MCP server development service can help teams set clear interfaces for tool access, while model routing remains a separate decision about inference and recovery.
Run a migration rehearsal before a provider forces the issue. Use a representative evaluation set, compare outputs and latency, review security and data terms, and test the rollback. Keep credentials and provider configuration out of application logic. Establish budgets and alerts that can stop or contain runaway usage. A fallback plan should state what happens during an outage, what quality trade-off is acceptable and who can approve a change.
In a diligence review, this warning sign matters because lock-in can affect continuity, cost exposure and the amount of engineering work required to keep a product operating. The PADISO private equity technology advisory team can help connect codebase findings to a practical technology plan. The objective is not to claim that every company needs multiple providers. It is to know the consequence of relying on one, and to have evidence that your chosen dependency is managed.
How an AI technical debt audit turns six warning signs into an action plan
Do not begin by rewriting the AI stack. Pick one production journey that matters to customers or staff and trace it end to end. Capture the request path, model and prompt versions, tools, data sources, retries, evaluation evidence and cost. Then rate each warning sign by impact, likelihood and effort to address. A missing approval gate on a sensitive action deserves attention before tidying a low-risk wrapper.
A practical audit output is a short register with one row per finding:
| Field | What to record |
|---|---|
| Finding | The specific code path, setting or missing control |
| Evidence | A trace, test result, configuration or code reference |
| Impact | User, operational, security or financial consequence |
| Owner | The person responsible for the next decision |
| Action | A bounded change, not a vague instruction to refactor |
| Verification | The test or production signal that proves the change helped |
Group remediation into three horizons. Contain immediate risk first, such as restricting a tool or setting a spending limit. Improve repeatability next, by adding evaluations, prompt versions and traceability. Then address architectural changes such as replacing brittle wrappers or introducing task-based routing. This sequence reduces exposure without turning the audit into a large rewrite programme.
The Google Research paper on hidden technical debt in machine learning systems introduced the CACE idea, meaning changing one thing can affect many others in a machine learning system. Use that as a reminder to test dependencies, not as a reason to fear every change. Map which prompts, models, retrieval indexes and tools a feature depends on, then ensure the relevant tests run when any of those parts change.
Keep the scope proportionate. A low-risk internal summariser does not need the same controls as an agent that changes customer accounts. But every production feature should have a named owner, a way to detect failure and a response when something goes wrong. The audit is successful when leaders can see the important risks, engineers know what to fix and the business can make a clear decision about what to ship next.
Where PADISO fits
PADISO works with founders, operators and investors on AI strategy, production agents and platform engineering. We can review the architecture, operating controls and delivery plan together, then help your team prioritise practical remediation rather than prescribe a wholesale rebuild. The first step is to choose a production workflow and agree what evidence the audit needs to produce.
If you are not sure whether your organisation is ready to scale its AI work, take the PADISO AI readiness test. If you already have a live system and need an engineering review, talk with PADISO about the code path, risks and decision you need to make.