top of page

How to create a Roleplay Agent

  • Writer: Layla
    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:

Edit Agent screen showing name and description fields for role-playing action dialogue. Contains regex triggers and options to cancel or save.
UI screen titled "Edit Agent" with "Structure Output" text box, a toggle switch, and buttons labeled "Add Tool," "Cancel," and "Save."

Let's take a look at what this Agent does:

  1. The name and description can be anything; they are there to help you easily identify your Agent

  2. 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

  3. We use the Structured Output tool - this uses BNF grammar to structure the output

    1. "root" is always needed, this starts the grammar definition

    2. "::=" is the assignment operator, this assigns grammar to variables

    3. "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

    4. "fragment" is our action action/dialogue. It's simply defined as anything that is not a line-break

  4. 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

Rated 0 out of 5 stars.
No ratings yet

Add a rating

Email

Location

Gold Coast, Australia

SUBSCRIBE

Sign up to receive news and updates from Layla

Thanks for submitting!

© 2024 by Layla Network

  • Discord
  • Facebook
  • X
  • Youtube
  • Instagram
bottom of page