Lecca.io LogoLecca.io

AI Schema

The AI Schema is the schema that is given the an AI Agent to fill out the necessary fields to run an action as a tool.

The schema is created using Zod.

Here are a couple suggestions when creating a schema.

  1. Make sure each property has a description if the property key is not descriptive by iteself. This will help the AI know what the property is..
  2. Make sure if a property is not required, to add .nullable().optional() to the field.

Here is a requirement when creating a schema.

  • Make sure the AI Schema matches the Input Config as much as possible.

    The AI Schema types are inferred and used to type the configValue argument in the run and mockRun functions of an action and trigger.

    There are cases where the inputConfig is complex, using a lot of loadOptions, and dynamic values. In this case, the UI sometimes has extra fields to dynamically load a critical field for the action. You may omit those extra fields in the aiSchema since they're not used in the run function. But you will have to create your own type for the Input Config when defining the run function.