Reading Time: 12 minutes

Imagine building enterprise-grade integrations simply by describing what you need.

Anypoint Code Builder is the number one IDE for designing, developing, and deploying APIs, integrations, and automations – all from a single environment. While it accelerates development through reusable components and best-practice guidance, the complexity of Mule Runtime and languages like XML and OAS/RAML often slows developers down. Even experienced users face steep learning curves and time-consuming trial and error before delivering value. 

To solve this, we released Einstein for Anypoint Code Builder: Generative Flows, which uses AI to convert natural language prompts into fully functional Mule flows, dramatically reducing development time and effort. This approach empowers developers to build faster, onboard more easily, and unlock the full potential of Anypoint Code Builder.

Intelligent integration flow generation pipeline

Our goal is to transform prompts into relevant and engaging responses. By leveraging advanced techniques, we ensure that the LLM-generated responses are not only accurate but also meaningful, contextually appropriate, and specifically tailored to our use case – minimizing the risk of AI hallucination. Below is the high-level structure of the current AI pipeline for Generative Integration Flows, which effectively converts user prompts into precise XML code snippets.

Intelligent integration flow generation pipeline
Intelligent integration flow generation pipeline

User Prompts

User prompts are the natural language queries that users send to ACB describing their business needs. An example of this might be: “Create a flow that sends an email when a new case is created in Salesforce.”

History Conversation Summarization

Conversational interactions enable developers to build on previous flows, ensuring continuity and consistency. To fully capture the user’s intent, we pass the current prompt along with all relevant historical messages, including prior prompts and generated codes. 

The LLM analyzes this history, identifying the most pertinent information and consolidating it into a single, coherent prompt that reflects the complete user intention. This summarized prompt, which accurately represents the current flow in progress, also enhances subsequent processes, such as retrieval, by providing a comprehensive context.

Conversation history summarization module
Conversation history summarization module

Retrieval-Augmented Generation (RAG)

Retrieval-Augmented Generation (RAG) is an AI framework that aims to retrieve relevant information and ground prompts with the proprietary data, significantly reducing AI hallucinations and enhancing the accuracy and relevance of generated content.

Retrieval augmented generation module
Retrieval augmented generation module

Retrieval database

  • Data collection: A wide range of data sources are explored to extract rich information, supporting diverse use cases with over 7000 connector operations leveraged in the Generative Integration Flows feature.
  • Data processing: The dataset is filtered based on predefined criteria for good examples, deduplicated, and processed to retain only high-quality examples.
  • Sensitive data processing: Sensitive data within the dataset is detected and processed by a combination of PII detection through hugging face model and human review. 
  • Data labeling through LLMs: The LLM generates labels for the code snippets, addressing the challenge of ground truth labeling and significantly reducing the need for human labor.
Retrieval database construction pipeline
Retrieval database construction pipeline

Augmentor

The augmentor leverages the pre-built retrieval database to retrieve relevant information and enrich the vanilla user prompt before sending it to the Einstein Gateway. 

  • Semantic information retrieval: Retrieves relevant knowledge and examples from our pre-built retrieval database through semantic searching using a robust embedding model, which converts unstructured text into high-dimensional vectors. The user prompt is vectorized and compared against all vectors stored in the retrieval database. Three types of data are retrieved to support grounding: a list of relevant connectors, (2) a list of relevant operations, and (3) relevant examples identified by comparing prompts to both other prompts and operation descriptions.
Semantic information retrieval module
Semantic information retrieval module
  • Dynamic few-shot learning: Set a maximum token limit and prioritize the inclusion of the most important and relevant examples first, adding as many as possible within that limit. General instructions and MuleSoft proprietary data are then incorporated into the user prompt to guide the model’s behavior and reduce hallucination.
  • Toxicity defense mechanism inside augmentation: Augmentation instruction is revised to explicitly direct the model not to generate any toxic or illegal content and to be cautious about potentially harmful user inputs.
  • Conversation support: To enable conversational interaction, we include previous history messages within the same session, allowing users to add, update, or delete earlier flows. This enables developers to use multiple prompt-response pairs to generate the flow they want. 

LLM generation

Several LLMs are explored and compared, with the final model selection based on a balance of accuracy and cost-efficiency. Multiple generations are considered to broaden the exploration space.

Post-Processor

The Post-Processor processes the raw output from the LLM, separating the code from the explanation. 

Validator and toxicity detection

  • Validity check: The pre-built validator automatically verifies that the generated code snippets use the correct syntax and valid operations for the supported connectors, ensuring compatibility and functionality within the MuleSoft ecosystem.
  • Toxicity check: The toxicity detection metric from Einstein Gateway is also used to identify harmful content. Generations flagged as toxic are treated as INVALID, even if they pass validator checks, and will not be returned to the user.
Validation and toxicity detection module
Validation and toxicity detection module

Error correction mechanism 

The error correction mechanism aims to enhance overall performance by detecting multiple error patterns and correcting invalid code snippets, supplemented with additional relevant metadata.

  • Error pattern detection: If all generations from the first call are INVALID, an error correction mechanism is triggered. This mechanism analyzes the raw error messages from the validator, detects multiple types of error patterns, such as using wrong attributes or using a non-existent operation under a supported connector. 
  • Select the most easily fixable code snippet: By analyzing the number and complexity of errors across multiple generations, difficulty scores are calculated. Invalid code snippets are then ranked, and the one considered easiest to fix is selected for the second call.
  • Error message construction: To support error correction, the system constructs enriched error messages by retrieving relevant metadata. For example, if a generated code snippet is invalid due to incorrect attributes, it extracts and provides a list of valid attributes for the target operation. If the snippet includes a non-existent operation, the closest supported alternative is identified and suggested. This contextual guidance helps the model produce a corrected version during the second call.
  • Fix errors in the second call: The constructed error message is passed to the Augmentor for the second call, then forwarded to the LLM to correct errors and refine the output — significantly enhancing overall performance.
Error correction module
Error correction module

The future of integration development  

With Einstein for Anypoint Code Builder: Generative Flows, we are redefining how enterprise integrations are built. By turning natural language into functional Mule flows, we eliminate complexity and ensure developers never start from scratch – making it easier for anyone to become an expert. This AI-powered solution accelerates development, simplifies onboarding, and helps teams deliver value faster with Anypoint Code Builder.