Execute
A Skill performs its intended function when it is executed, and execution may entail interacting with the real world. When executed, the Skill is provided an initial world state and a parameter set. The parameter set is a set of named and typed values passed into the Skill from the Process in which it exists. The names and types of the parameter set must match those specified by the Skill developer.
Prerequisites
Before attempting this guide, you should:
- Deploy a Solution
- Set up your development environment
- Connect to an Organization
- Know how to create Skills
- Understand the Skill interface
Purpose
The primary purpose of Skill.execute() is to define the actions a Skill
performs, which may include:
- Using the given world state and parameter set as input to actions related to the Skill.
- Using Services to facilitate the actions.
- Generating output data that reflect the outcome of the Skill's execution.
By implementing this method, you define the "what" and "how" of your Skill's behavior.
Args
The execute method takes two arguments:
ExecuteRequest: input toSkill.execute(), containing the parameter set.ExecuteContext: additional conext needed to access the world state, as well as other Services that the Skill may use.
Return value
The execute() method should return either a result proto message, which is
specified by the Skill developer, or None if the Skill does not provide a
result. If you look inside
skill_interface.py,
you can see that the return type of the execute() method is TResultType
(where
TResultType = TypeVar('TResultType', bound=Union[message.Message, None])),
allowing for either the user defined type or None.