Building Workflows
Guideline to build your own workflows in Shinkai
The Shinkai Playground
is a user-friendly interface where you can define, test, and iterate workflows for your AI agents.
It leverages the Shinkai DSL
, a language designed specifically for building sequences of tasks that your agents can perform.
Shinkai’s DSL
Shinkai’s Domain-Specific Language (DSL) is designed to help you easily create workflows that guide an AI agent through a series of tasks. Here’s a quick step-by-step guide on how to use it.
How to write a workflow with DSL
Defining a workflow
Every workflow starts with workflow
, followed by its name and version.
Adding Steps
Each step starts with the word step
followed by the step name.
Using Registers (Variables)
Registers (variables) store information. They start with $
.
Example:
$PROMPT
stores a string.$CONTENT
stores downloaded data.
Calling External Functions
External functions let you use pre-built commands to perform tasks, like downloading data or processing information. The function is called with call
.
Conditions
Use if
statements to run actions only when certain conditions are met.
Loops
Use for
loops to repeat actions for a list of items.
Example Workflow
Here’s a complete example of a workflow that initializes a task, downloads webpage data, and summarizes it:
In this example:
- Step 1 (
Initialize
): Sets up the task with a prompt for the AI. - Step 2 (
Download
): Downloads webpage content using an external function. - Step 3 (
Summarize
): Uses the AI to summarize the content based on the prompt.
Building Workflows with BAML
BAML is a domain-specific language designed to simplify the creation and testing of large language model (LLM) functions.
It treats prompts as functions with defined input variables and outputs, making it significantly faster than traditional Python-based testing environments. BAML supports multiple languages, ensures type safety, and provides real-time prompt previews.
You can easily create workflows in Shinkai using BAML. You can test your functions in the BAML playground for instant feedback.
By following these simple guidelines, you can easily create powerful workflows with Shinkai DSL and BAML!
Enabling/Disabling Workflows
Workflows can be enabled and disabled at convenience. To do this, simply go to Shinkai Tools
, browse the list and switch the toggle
on/off to enable/disable them.
Was this page helpful?