# Transition

The `Transition` type can be one of the following:

* `string`: In this simplest case, the agent will transition to the provided target state.
* `TransitionCase`: The agent will transition to the target state only if the `condition` is evaluated as `true`.

The capability for a state to transition to any other state, including itself, hinges on being able to reference a target state, which can be done through either absolute indexing or relative indexing. Here's a bit more detail:

* **Relative Indexing:** This method allows navigation amongst states in relation to the current state:
  * `sibling` refers to another state at the same level as the current one.
  * `.child` specifies a sub-state of the current state.
  * `sibling.child.grandchild` indicates a more complex path from a state at the same level to a grandchild state.
* **Absolute Indexing:** This approach uses a unique identifier to directly reference any state, regardless of the current state:
  * `#id` directly points to a state with the specified identifier.
  * `#id.child` combines the use of an identifier with relative paths to specify a state that is a child of the identified state.

This structure provides great flexibility in the flow control within an agent, permitting intricate navigation across the states depending on the desired agent behavior or user interactions.

`TransitionCase`

<table><thead><tr><th>Field's Name</th><th width="230">Type (Required/Optional)</th><th width="260">Description</th><th>Example</th></tr></thead><tbody><tr><td>target</td><td>string (Optional)</td><td>The target state to which the agent will transition. If not specified, the agent will transition to the current (self) state. Applies to TransitionCase type only.</td><td>"next_state"</td></tr><tr><td>condition</td><td>BoolExpression (Optional)</td><td>A condition that must be evaluated as true for the agent to transition to the target state. If not specified, the condition is treated as true. Applies to TransitionCase type only.</td><td></td></tr><tr><td>target_inputs</td><td><code>Object</code> (Optional)</td><td>Specify the value for the inputs of target state. It will override the default value of the input, but not the value of the input.</td><td></td></tr></tbody></table>

`TransitionCase[]`

The agent will evaluate the conditions of each `TransitionCase` in the given array one by one. It will transition to the target state of the first `TransitionCase` whose `condition` is satisfied.


---

# 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.myshell.ai/create/pro-config-mode/api-reference/transition.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.
