Skip to main content
An action is a function of your game that the character can decide to call: sell an item, open a gate, start a quest, get angry. It is a tool call of the voice agent, set up from the game.

In the Inspector

Without code: under Game Actions of the LokutorAgent add a LokutorAction.

In code, with arguments

  • params maps each argument to a description ({"item": "Which item"}) or to a JSON-schema dictionary with type, description, enum… Every argument is required unless its dictionary says "optional": true.
  • The handler runs on the main thread with the arguments the character chose, and returns a sentence saying what happened. The character answers with it, so write facts: what changed, what failed and why.
  • Check the arguments. They come from a language model: an item that does not exist, a price it made up. The game decides; the sentence tells the character.

Actions that take time

A handler may await. The character waits for the result, and stays in THINKING:
Keep it to a few seconds. For something longer, return at once (“On my way.”) and tell the character later with set_context.

During the game

Actions can be added and removed at any time; the character knows from its next reply.
An action that is not there cannot be called, which is a better lock than a sentence in the persona.

Reactions

An action does not have to change the world. One that only tells the game how the character feels drives its face and body:
Game characters puts this together with animation.

Test them without talking

The handler is a function: call it. To check that the agent is told what you think, run the conversation against the mock server.