Luna
Employee
Employee

This article introduces a new Snap called the “Multi Pipeline Function Generator”. The Multi Pipeline Function Generator is designed to take existing Pipelines in your SnapLogic Project and turn their configurations into function definitions for LLM-based tool calling.

It achieves the following:

  1. It replaces the existing chain of function generators, therefore reduces the length of the worker pipeline.
  2. Combined with our updates to the tool calling snaps, this snap allows multiple tool calling branches to be merged into a single branch, simplifying the pipeline structure.
  3. With it, users can directly select the desired pipeline to be used as a tool from a dropdown menu. The snap will automatically retrieve the tool name, purpose, and parameters from the pipeline properties to generate a function definition in the required format.

Problem Statement

Currently, the complexity of the agent worker pipeline increases linearly with the number of tools it has. The image below shows a worker pipeline with three tools. It requires three function generators and has three tool calling branches to execute different tools.

This becomes problematic when the number of tools is large, as the pipeline becomes very long both horizontally and vertically.

image-20250408-214120.png

Current Agent Worker Pipeline With Three Tools

Solution Overview

One Multi Pipeline Function Generator snap can replace multiple function generators (as long as the tool is a pipeline; it's not applicable if the tool is of another type, such as OpenAPI or APIM service).

image-20250408-215436.png

 New Agent Worker Pipeline Using “Multi Pipeline Function Generator”

Additionally, for each outputted tool definition, it includes the corresponding pipeline's path. This allows downstream components (the Pipeline Execute snap) to directly call the respective tool pipeline with the path, as shown below.

image-20250408-221513.png

The Multi Pipeline Function Generator snap allows users to select multiple tool pipelines at once through dropdown menus. It reads the necessary data for generating function definition from the pipeline properties. Of course, this requires that the data has been set up in the pipeline properties beforehand (will be explained later). The image below shows the settings for this snap.

image-20250408-220049.png

Snap Settings 

How to Use the Snap

To use this snap, you need to:

 

  1. Fill in the necessary information for generating the function definition in the properties of your tool pipeline.
    1. The pipeline's name will become the function name
    2. The information under 'info -> purpose' will become the function description.
    3. Each key in your OpenAPI specification will be treated as a parameter, so you will ALSO need to add the expected input parameters to the list of pipeline parameters.
      1. Please note that in the current design, the pipeline parameters specified here are solely used for generating the function definition. When utilizing parameters within the pipeline, you do not need to retrieve their values using pipeline parameters. Instead, you can directly access the argument values from the input document, as determined by the model based on the function definition.
  2. Then, you can select this pipeline as a tool from the dropdown menu in the Multi Pipeline Function Generator snap.
  3. In the second output of the tool calling snap, we only need to keep one branch. In the pipeline execute snap, we can directly use the expression $sl_tool_metadata.path to dynamically retrieve the path of the tool pipeline being called. See image below.

Below is an example of the pipeline properties for the tool 'CRM_insight' for your reference.

image-20250414-233258.png

image-20250408-223734.png

 image-20250408-223708.png

Below is the settings page of the original function generator snap for comparison. As you can see, the information required is the same. The difference is that now we directly fill this information into the pipeline's properties.

image-20250408-223956.png 

image-20250408-224438.png

Step 3 - reduce the number of branches

More Design Details 

The tool calling snap has also been updated to support $sl_tool_metadata.path, since the model's initial response doesn't include the pipeline path which is needed. After the tool calling snap receives the tools the model needs to call, it adds the sl_tool_metadata containing the pipeline path to the model's response and outputs it to the snap's second output view. This allows us to use it in the pipeline execute snap later. This feature is supported for tool calling with Amazon Bedrock, OpenAI, Azure OpenAI, and Google GenAI snap packs.

image-20250408-224939.png

 

The pipeline path can accept either a string or a list as input.

image-20250408-225944.png

 

By turning on the 'Aggregate input' mode, multiple input documents can be combined into a single function definition document for output, similar to that of a gate snap.
This can be useful in scenarios like this: you use a SnapLogic list snap to enumerate all pipelines within a project, then use a filter snap to select the desired tool pipelines, and finally use the multi pipeline function generator to convert this series of pipelines into function definitions.

image-20250408-232857.png


image-20250408-232321.png

Example Pipelines

Download here.

Conclusion

In summary, the Multi Pipeline Function Generator snap streamlines the creation of function definitions for pipeline as tool in agent worker pipelines. This significantly reduces pipeline length in scenarios with numerous tools, and by associating pipeline information directly with the pipeline, it enhances overall manageability. Furthermore, its applicability extends across various providers.

1 Comment
msager
Employee
Employee

Nicely done Luna, this snap is a nice simplification.