December 16, 2025
A key (and common) barrier to broad enterprise success with AI agents are legacy APIs. Temperamental and brittle, this aging infrastructure will remain the heart of enterprise IT for the foreseeable future.
To take advantage of all the agentic age has to offer, organizations need to make legacy infrastructure and functionality available to large language models (LLMs).
The best way to do this? Take the ambiguity of APIs off the table by packaging them into deterministic pipelines exposed as MCP tools.
No other solution currently available (no matter how clever) can safely do the job.
The context of agent-based code execution
On the subject of clever solutions, Anthropic and Cloudflare recently explored the benefits of building LLM systems that write code for the purpose of accomplishing tasks. In this approach, the model codes a solution using code snippets supplied through a file system along with a task description. A sandbox environment executes the script and returns outputs to the LLM, which continues its workflow.
This path serves straightforward tasks that use modern systems with well-documented, importable abstractions. It addresses real Model Context Protocol (MCP) pain points around performance and context usage, but it overlooks significant constraints posed by legacy enterprise APIs.
As any integration engineer in the enterprise knows, these interfaces—often custom-built, verbose, and tightly bound to critical systems—won’t be replaced overnight.
For AI agents to deliver meaningful impact in the near term, they must bridge modern, code-efficient ecosystems (enabled by MCP and code execution) with the enduring landscape of legacy systems that drive global operations.
Legacy APIs aren’t going anywhere
Long-running enterprises rely on SOAP, XML-RPC, custom SDKs, or proprietary interfaces that weren’t designed for agentic automation. These systems hold ledgers, move shipments, process claims, and route the payments that keep global operations running.
These systems will persist: they represent billions of dollars of infrastructure investment and compliance and confidentiality obligations. Each API call embeds institutional knowledge, business logic, and operational dependencies that cannot simply be “modernized” by mandate.
So LLM-backed agents will need to work with them. But when using legacy APIs directly, LLMs often improvise inappropriately or retrieve the wrong string during unconstrained interactions, causing an error and breaking the workflow. Mediating those interactions through live coding does little to mitigate failure modes.
The Problem with API-Level Autonomy
API-level autonomy allows LLMs or agents to interact with APIs directly. They reason over the schema or documentation, decide which calls to make, assemble parameters, sequence the interactions, and interpret responses—all dynamically at runtime.
In theory, this enables agents to adapt to incomplete documentation and legacy interfaces, but in enterprise reality, API-level autonomy is risky for three main reasons:
- Chatty APIs: Web-based APIs bound to business processes expect careful sequencing, repeated authentication, and step-by-step exchanges. Each step compounds the potential for the LLM to misinterpret requirements, deliver incorrect parameter values, or forget earlier context, and a single error can derail the entire process.
- Data sensitivity: Legacy APIs often surface personally identifiable information (PII). Without strict controls, sensitive data can enter the model’s working context or tool logs, creating significant compliance and confidentiality risks.
- Sensitive processes: An agent that fails on a read-only record-pull creates a minor frustration. An agent that fails mid-way through an account creation task could send support personnel scrambling.
Researchers have found lackluster results with allowing agents to interact freely with HTTP APIs. A 2024 study found that a GPT-4o backed agent achieved the correct outcome using APIs just 29% of the time.
Agentic coding isn’t the answer
In the approach outlined by Anthropic and Cloudflare, LLMs to live-write TypeScript code to achieve straightforward tasks. The LLMs deftly stitch together well-documented abstractions due to their ample training on coding data.
This won’t work for legacy enterprise APIs that lack abstraction layers or importable SDKs. Models could instead code API interactions directly, but this introduces noise; enterprise APIs don’t obey uniform behaviors, leaving the LLM to guess at the proper approach.
Adding complexity, business processes often demand rigid task ordering.
In an airline booking interface, for example, the system must:
- Hold the customer’s selected seat.
- Process the customer's payment.
- Book the seat for the customer.
- Send a confirmation message.
Process the payment before the seat hold, and the customer could pay for a seat they don’t receive. Book the seat before payment, and the customer could get the seat for free.
Iteration amplifies these potential costs. Even with complete API documentation at inference time, LLMs may require several attempts to write code that successfully executes end-to-end. In the example above, an LLM that requires two attempts to complete the workflow could charge the customer twice.
Compounding these issues, iterative coding attempts would balloon context windows and increase latency. They could also impede proper record keeping if the business needs code-level logs in addition to those from API interactions.
The answer: Encapsulated MCP pipelines for legacy APIs
Instead of exposing each low-level request and response, agents should interact with legacy systems through predefined, code-governed pipelines that enforce business processes and absorb operational complexity on their behalf.
Each pipeline functions as a controlled execution environment, managing authentication, error recovery, and data transformation before any output reaches the agent's context window.
This architecture:
- Minimizes token usage.
- Reduces the risk of cascading failure.
- Enforces business processes.
- Improves context efficiency.
- Protects data privacy.
Developers can code these pipelines directly, or build them through a low-code integration platform. With Digibee, users build endpoint-level abstractions for business APIs and chain them together in a drag-and-drop interface. They can even include error-handling blocks for common failure modes, and deploy the tool to an MCP server with a few clicks. From there any agent can use it, whether built in Digibee or not.
By wrapping API functionality, the pipeline minimizes direct agent interaction. The agent supplies the required parameters and receives only the needed final information. All intermediate exchanges (and sensitive data) remain outside the model’s working memory.
This approach grounds LLM code execution in the messy reality of archaic enterprise systems that may never be modernized. The encapsulated pipelines provide the connective tissue that lets AI agents act intelligently across both modern and legacy environments.
Example: Bridging modern and legacy ecosystems
Let's look at an example. A business traveler asks a customer support chatbot which upcoming flights she can upgrade to first class.
Then, the following happens:
- The agent invokes an MCP pipeline tool: get_upgrade_opportunities(customer_id).
- Inside the pipeline (invisible to the agent):
- Authenticates with the legacy airline API
- Retrieves all upcoming customer bookings
- Cross-references seat availability across flights
- Filters for flights where first-class seats are available and customer is in coach
- Transforms the data into a clean, structured format
- The pipeline returns only the relevant upgrade opportunities to the agent's context.
- The agent presents the information to the customer.
Should the customer choose to upgrade, the agent would execute the request through another MCP pipeline: process_seat_upgrade(booking_id, new_seat_class).
This pipeline would internally handle the entire multi-step process—holding the seat, processing payment, confirming the booking, and sending confirmation—as a single deterministic workflow.
What does this mean?
- The agent never touches the legacy APIs directly, never writes filtering code, and never manages the complex sequencing.
- It simply orchestrates pre-built, auditable MCP pipelines that encapsulate known business processes.
This balanced approach delivers both the trustworthiness of deterministic workflows and the flexibility of agentic reasoning.
The practical path to enterprise-ready AI agents
The promise of AI agents is enormous. Realizing that promise requires more than breakthroughs in reasoning or model architecture; it demands infrastructure that lets agents operate both modern and decades-old systems.
Code execution solves part of this problem: enabling efficiency, scalability, and control for modern integrations. But without equivalent support for legacy interfaces, even the most capable agents will struggle to deliver results where they matter most.
With Digibee, developers can close this gap. By encapsulating legacy API interactions inside secure, composable pipelines, Digibee gives AI agents a consistent, code-governed interface for every system they touch—whether it’s cloud-native or running in a data center built twenty years ago.
As organizations explore how to deploy agents responsibly and at scale, Digibee provides the missing foundation. It’s not just a bridge between old and new systems; it’s the orchestration layer that makes true hybrid automation possible.


