Skip to main content

Create your first Skill

This guide walks you through

  • Creating a Python skill,
  • Installing your skill into your solution, and
  • Running your solution with your skill

Before attempting this guide you must:

  1. Deploy a solution
  2. Set up your development environment
  3. Connect to an Organization

Create your skill

To create a skill, first navigate to Visual Studio Code's (VS Code) Explorer view, then right-click any blank space under the list of files. Click New Skill....

Select New Skill from context menu

VS Code opens a window at the top, with several prompts.

The fields should be set as follows:

  1. When asked to enter the Intrinsic SDK repository URL, input the following:

    https://github.com/intrinsic-ai/sdk.git

    Enter SDK repository URL

  2. When asked to enter the Intrinsic SDK version, hit enter to use the latest release. If you want to use an older release, then pick a git tag from the list of released SDK tags and enter its name.

    Enter SDK version

  3. When asked for a programming language, select Python.

    Enter skill language

  4. When asked to enter a skill ID, input the following:

    com.mycompany.example_skill

    Enter skill ID

  5. When asked to enter a folder, use the default value of example_skill.

    Enter skill folder

    warning

    Don't leave the folder name empty! Leaving it empty causes the output files to be generated in the project-level directory, and that could overwrite existing files in your project.

VS Code will display a dialog listing the files it created. Close the dialog and look at the files in the VS Code Explorer view.

Files created for new project

The Intrinsic VS Code extention created two sets of files:

The Intrinsic VS Code extension creates files defining the Bazel workspace only if a workspace doesn't exist already. The files are:

The Intrinsic VS Code extension creates files defining the new skill every time you create one. They are all in the skill folder name you chose earlier.

  • example_skill/BUILD, tells bazel how to build your skill.
  • example_skill/example_skill_test.py, contains code to test your skill
  • example_skill/example_skill.manifest.textproto, describes metadata needed by Flowstate to run your skill.
  • example_skill/example_skill.proto, defines Protocol Buffers messages for your skill's parameters and return type
  • example_skill/example_skill.py, contains the code that implements your skill

Newly generated skills will log a single message when they are executed.

You can use our skill's examples repo as a guide for your developments. Subsequent guides show how to make your skill do something more useful:

Complete this guide before reading those ones.

Build your skill

Now that you have generated your skill, follow these instructions to build it.

  1. Open example_skill/BUILD in VS Code.
  2. Locate the line that says py_skill(.
  3. Click Build above that line.

Build skill rule

This begins the build of your skill. VS Code will display the output in a terminal window.

note

The initial build of the SDK and skill may take a long time depending on how powerful your machine is. It can take as little as 5 minutes, or as much as 90 minutes. This is a known issue, and it will be addressed in a subsequent release.

Once your skill builds, you are ready to install it into a solution.

Install your skill

important

You must connect to an Organization before attempting to install a skill. This includes selecting a target solution.

Selecting a target solution causes new links to appear above the py_skill( line. These are:

  • Build, builds a skill
  • Install, installs a built skill
  • Uninstall, uninstalls skill
  • Stream Logs, opens a terminal showing logs in real time from your installed skill

Click Install. Be ready, this process may take a while.

py_skill rule for the skill

A terminal window in VS Code will show the progress of installing your skill.

Stream logs

Let's make sure your skill is running correctly. Click the Stream Logs button.

Stream logs

Clicking Stream Logs opens a terminal window in VS Code. The terminal displays log messages emitted by your skill.

Stream logs

note

Users who use your skill will be able to see the logs emitted using inctl or the web UI. This can help for debugging, but you should avoid logging confidential information.

note

You can also use the text logs viewer to access your developed skill logs.

Run the solution

The skill is installed, but running your solution won't execute your skill yet. You must add your skill to the solution's behavior tree first.

  1. Open the Intrinsic VS Code extension, and click the Open solution button next to your target solution

    Cloud explorer open solution

    This opens a browser window to Flowstate.

    Taskflow user interface

  2. Click the + icon in the Process Editor.

    Add a new process node

  3. Click Skills | ExampleSkill to add your skill to the behavior tree.

    Add your skill to the behavior tree

  4. Select your skill in the Process Editor, then click the Inputs tab. Put some text in the Text input.

    Set skill parameters

  5. Click the Run process button in the Process Editor.

    Run process

The executive will then execute your skill. If you still have the terminal opened by Stream Logs, the terminal will display the log message from your skill.

Streamed logs

Use the Abseil (absl) Logging library

Abseil is an open source collection of libraries. The SDK examples use logging functions from the Abseil Logging Library, which is available in C++ and Python. The log level can be configured to control which levels are displayed on the output.

The following example demonstrates various calls to the Abseil Logging library from Python:

from absl import logging

logging.info('Interesting Stuff')
logging.info('Interesting Stuff with Arguments: %d', 42)

logging.set_verbosity(logging.INFO)
logging.log(logging.DEBUG, 'This will *not* be printed')
logging.set_verbosity(logging.DEBUG)
logging.log(logging.DEBUG, 'This will be printed')

logging.warning('Worrying Stuff')
logging.error('Alarming Stuff')
logging.fatal('AAAAHHHHH!!!!') # Process exits

The default log level in Abseil depends on whether you're using C++ or Python:

The default log level in the Abseil Python library is WARNING. This means that WARNING, ERROR, and FATAL messages will be logged by default.

You can change the default log level using the appropriate functions:

  • Use the absl.logging.set_verbosity() function to change the global log level
  • Use the absl.logging.vlog()function to log messages at specific levels

Please reference the following pages for more information on the Abseil Logging Library