> For the complete documentation index, see [llms.txt](https://docs.kasko.io/kasko-frontend-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kasko.io/kasko-frontend-documentation/getting-started/manifest-flow-dynamic-path.md).

# Defining dynamic paths

There are cases where there may be need for multiple similar screens where only thing that changes is some index value and the rest of the screen is the same. We can use dynamic path for this.

## Usage

In flow part of manifest, inside screen object, we can define `path` value that feels similar to router path by seperating route sections with `/` and naming dynamic variables starting with `$`.

Example:

```js
{
  "flow": [
    {
      "path": "agent/$index",
      "components": [...]
    }
  ]
}
```

In this case we will be able to navigate user to `agent/1`, `agent/2`, ... `agent/other_value` and user will land on this screen we defined with `agent/$index`.

This will also expose this route variable to jsonlogic and contents as `route.params.index` (`index` being the name of the path variable `$index`).

Example:

```js
{
  "flow": [
    {
      "path": "agent/$index",
      "components": [...]
      "next": {
        "type": "jsonlogic",
        "schema": {
          "if": [
            {
              "<": [{"var": "route.params.index"}, 1]
            },
            {
              "cat": ["agent/", {"+": [{"var": "route.params.index"}, 1]}]
            },
            "summary"
          ]
        }
      }
    }
  ]
}
```

And in contents we can access this value like so:

```csv
"flow.agent.title","Fill out details for agent nr.{route.params.index}"
```

In this case we would also want to adjust field names for input components on this screen (also dynamically). For this we can use [dynamic config](/kasko-frontend-documentation/getting-started/manifest-flow.md#dynamic-config).

Full example:

```js
{
  "flow": [
  {
    "path": "agent/$index",
    "components": [
      {
        "type": "form",
        "config": {
          "components": [
            {
              "type": "form-input",
              "config": {
                "field_name": {
                  "type": "jsonlogic",
                  "schema": {
                    "cat": ["data.agents.", {"var": "route.params.index"}, ".name"]
                  }
                },
                "content_key": {
                  "label": "form.agent.label",
                  "placeholder": "form.agent.placeholder"
                }
              }
            }
          ],
          "footer_components": [
            {
              "type": "form-button-next",
              "config": {
                "content_key": "flow.next"
              }
            }
          ]
        }
      }
    ],
    "next": {
      "type": "jsonlogic",
      "schema": {
        "if": [
          {
            "<": [{"var": "route.params.index"}, 1]
          },
          {
            "cat": ["agent/", {"+": [{"var": "route.params.index"}, 1]}]
          },
          "summary"
        ]
      }
    }
  }
  ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.kasko.io/kasko-frontend-documentation/getting-started/manifest-flow-dynamic-path.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
