How Leia AI Works
Last updated
Last updated
Leia AI is built with flexibility and modularity at its core. You can customize and extend its behavior for any on-chain game or decentralized application by defining Context, Actions, and Goals.
Context is the foundation of any agent's decision-making process. It describes the game state, rules, and available actions. In Leia AI, context is represented as a structured JSON object.
Example context for a decentralized strategy game:
This context object allows the agent to understand the current game environment, the player's resources, and the rules it must follow.
In Leia AI, actions are the tasks the agent can perform. These actions can be registered with intricate parameters and validation rules, ensuring that the agent always makes valid decisions on-chain.
For example, registering an action to build a resource structure:
In this example, we are registering an action that builds a farm in the game world. The action is validated using Joi to ensure it is well-formed and meets the game rules.
Goals represent long-term objectives for your agent, which it will attempt to accomplish autonomously. Leia AI utilizes Chain of Thought (CoT) processing, breaking down complex goals into achievable steps.
Example: A goal to gather resources and build a defensive structure:
The agent will attempt to fulfill this goal by first gathering the required resources, then building the defense. Each subgoal is treated as an individual action that the agent can perform.
Leia AI provides event-driven architecture, allowing you to subscribe to critical actions and monitor the agent's progress in real-time.
With these events, you can monitor every phase of the agent’s journey, from initial thought processing to final execution.