# Creating Jobs

Let's say you want to run a security scan automatically every time an application is deployed by your CICD process.

Jobs are used in Zirkul for setting up "recipes" or "playbooks" with the step-by-step instructions to be followed by the Agent.

There's a straightforward syntax used for building your Jobs, here's an example:

```yaml

# Let's load a target by ID
target 150

# Create a new dynamic scan (DAST)
new scan dynamic scan
    targetid: target.id
    subject: 'Dynamic Scan for {{target.name}}'
    status: 'not started'
    url: target.url
    tool name: 'Zirkul Agent'
    submit
    -

# New scan data is stored in the object: scan
# Let's move the scan to 'In progress'
scan scan.id
    status: 'in progress'
    description: 'Scanning Target {{target.id}}'
    update
    -

# Now we can run the scan with Zirkul scanner
scanner
    url scan.url
    start spider
    -

# Update the scan when the scan is completed
scan scan.id
    status: 'completed'
    response message: 'Scan completed successfully'
    update
    -

# Now let's publish all the issues found so you can track them in Zirkul
publish issues

```

You will find more information on how to write Job scripts in the section: Agent CLI

Let's add your first script:

1 - In te section "Continuous Testing \ Jobs", click on "Add Job"

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

2 - Fill out the form as follows for creating the classic "Hello world" Job:

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

3 - For executing Jobs, you need the Agent running in service mode connected to Zirkul, [download the Agent](/devsecops/getting-started.md#first-step) and run it with the following command:

```
zirkul --service true --agent cicd --server http://app.zirkul.com --apikey 'YOUR-API-KEY-HERE'
```

If everything is working as expected, you should see something like this:

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

4 - Let's run the Job from Zirkul clicking the "play" icon:

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

You can see the progress clicking the option "View executed jobs"

![](/files/L0TVI7NSdFqsV0lAhyVC)

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

You should also see the Agent running the Job in the command line:

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

Once completed, the executed Job should look like this:

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

Of course, this was just a testing exercise, and you don't want to manually execute a Job every time it's needed, in the next section we're going to see the options available for automating the process for running Jobs.


---

# 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.zirkul.com/devsecops/creating-jobs.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.
