How to create a Roleplay Agent
- Layla
- 3 days ago
- 1 min read
Let's explore creating a simple Roleplay Agent in Layla.
This agent will force your character to respond in *action* dialogue format.
For example:
*waves and smiles* Hi there!
Create an Agent with the following settings:


Let's take a look at what this Agent does:
The name and description can be anything; they are there to help you easily identify your Agent
We use the Regex Trigger - we use the "." (dot) regex to match anything, so this will be triggered on every message. This is what we want, since we want to make all outputs adhere to our format
We use the Structured Output tool - this uses BNF grammar to structure the output
"root" is always needed, this starts the grammar definition
"::=" is the assignment operator, this assigns grammar to variables
"turn" is our custom defined variable, its definition is in the next line. It is composed of the literal "*" (asterisk), then "fragment" (another user defined variable), then "*", then another fragment
"fragment" is our action action/dialogue. It's simply defined as anything that is not a line-break
Putting this altogether, we have our output defined as *fragment* fragment, where fragment is any text that's not a new line, which is exactly what we want
Here's the agent file for you to download and import. You can use the Add New Agent button to import it.
Download the agent here:
.
Comments