# Snippets

Snippets are reusable sets of logical steps within workflows that enhance both reusability and readability. They allow for more efficient workflow management by simplifying complex integrations.

<figure><img src="/files/Yc1zgV5Y0Ah19bWblvhG" alt=""><figcaption></figcaption></figure>

**Reusability**

A set of logical steps within a workflow needs to be reused in multiple instances within the same workflow.

**Readability**

For complex integrations, workflows often require a large number of steps. Adding a layer of abstraction helps structure the workflow and enhances readability.<br>

Snippets help speed up workflow development by minimizing repetitive steps. A snippet can consist of one step or a collection of steps. Once created, users can include snippets using the [Snippet Tool](/project-manager/workflows/actions/snippet.md) in the main workflow.

## Creating Snippets

Apart from inputs and outputs, a snippet must contain at least one step to use snippet in main workflow.

### Inputs and Outputs

Inputs are defined to access data inside the snippet from the main workflow. And output is required and used to return data to the main workflow.

Inputs are optional and multiple inputs can be defined.

#### Inputs

Multiple Inputs format Supported: String, Number, Boolean, JSON. Users can also specify whether an input field is mandatory using the required option (Yes/No).&#x20;

If an input field is not required, users can provide a default value. Snippet uses the default value if actual value is empty during execution.

#### Output

The output is the snippet's response. It is required and can be of any supported data types.

The output can either be a single step response or a list of responses from multiple steps, as determined by the user. Only one output will be returned from the snippet, which will then be accessible within the main workflow.&#x20;

All other local step responses within a snippet will remain inaccessible outside the snippet.

### Test Snippets

Using the Test Snippet option, users can test snippets during the workflow development process to ensure the functionality by providing sample inputs.

## Using Snippets

Snippets can be used in the main workflow using the [Snippet Tool](/project-manager/workflows/actions/snippet.md).&#x20;

## Limitations

* The scope of DataHub values are limited to the snippet.
* Users can only access the defined snippet input inside a snippet and can only access the snippet response in the main workflow.
* No Nested Snippets.Snippets can only be used at one level.
* The Stop tool is not available inside the snippet tool.
* The debugger option is currently not available for snippet steps.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dckapintegrator.com/project-manager/workflows/snippets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
