# Writing workflows

New `secator` workflows should be easy to write to promote contributions from the community.&#x20;

Eventually we aim for our workflow library to become a reference in cyber-security much like Nuclei templates have become a reference for vulnerability searching.

***

## Basic YAML definition

`secator` workflows are defined through YAML configs:

{% code title="secator/configs/workflows/url\_finder.yaml" %}

```yaml
type: workflow
name: url_finder
alias: ufind
description: URL finder and tagger
tags: [http]
input_types:
  - url
tasks:
  katana:
    description: Find URLs
    rate_limit: 100
    timeout: 1
  gf:
    description: Tag URLs
    pattern: xss
```

{% endcode %}

***

## Dynamic targets

You can specify dynamic targets for tasks from current run results, by using the `targets_` key in your template like:

```yaml
...
tasks:
  ...
  gf:
    description: Tag URLs found by the previous task
    targets_:  # use previously found URLs
    - type: url
      field: url
      condition: item.status_code == 200
```

{% hint style="info" %}
The dynamic format keys are:

* `type` is the output type, lower-case (see [Broken mention](broken://pages/qP8jXQz9GLFqQAaBiJHX) for the whole list)
* `field` is the JSON field to use as target
* `condition` is the filtering condition.
  {% endhint %}

***

## Concurrent tasks

You can specify tasks that run in parallel using the `_group` key:

```yaml
...
tasks:
  ...
  katana:
  _group:
    gf:
      ...
    another_task:
      description: Runs concurrently with the `gf` task
```

In this configuration, the `katana`task will begin the run, followed by a grouped execution of `gf` and `another_task`.

{% hint style="info" %}
Concurrent tasks require`secator` to be setup in worker mode (see [Distributed runs with Celery](/in-depth/distributed-runs-with-celery.md)).
{% endhint %}

***

## Result filtering

You can customize which results you want to keep for workflows and scans by adding the `results` key to the respective runner YAML configuration:

<pre class="language-yaml"><code class="lang-yaml"><strong>...
</strong><strong>results:
</strong>- type: ip
  condition: item.alive
- type: url
  condition: item.status_code == 200
</code></pre>

{% hint style="warning" %}
Filters apply to final run results sent to [Exporters](/in-depth/concepts/exporters.md), but do not apply to real-time results sent to [Drivers](/in-depth/concepts/drivers.md).
{% endhint %}

***


---

# 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.freelabz.com/for-developers/writing-workflows.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.
