MyShell
  • About MyShell
    • What is MyShell
    • MyShell in a Nutshell
    • Quickstart
  • Explore AI Agents
    • Image Generation
    • Video Generation
    • Meme Generation
    • Role-Playing Game
    • Character
    • Utility
  • Create AI Agents
    • Classic Mode
      • Enhanced Prompt
      • Knowledge Base
      • Telegram Integration
    • Pro Config Mode
      • Core Concepts
      • Tutorial
        • Tutorial Structure
        • Hello World with Pro Config
        • Building Workflow
        • Transitions
        • Expressions and Variables
        • Integration with Any Widget
        • An Advanced Example
      • Basic
        • Common
        • Atomic State
        • Transition
        • Automata
        • Modules
      • Advanced
        • Cron Pusher
        • Neutral Language To SD Prompt
        • Advanced Input Validation
        • Advanced Memory Manager in Prompt Widget
      • Tools
        • AutoConfig Agent
        • Cache Mode
        • Knowledge Base Agent
        • Crawler Widget
      • Example
        • Homeless With You
        • Random Routing
        • Function Calling
      • API Reference
        • Atomic State
        • Transition
        • Automata
        • Context
        • Module
          • AnyWidget Module
            • Prompt Widget
            • LLM Widget
            • TTS Widget
            • Code Runner Widget
            • Melo TTS
            • Age Transformation
            • ChatImg
            • GIF Generation
            • Music Generation
          • LLM Module
          • LLM Function Module
          • TTS Module
          • Google Search Module
        • Widgets
          • Bark TTS
          • Champ
          • CoinGecko
          • ControlNet with Civitai
          • Crawler
          • Crypto News
          • Data Visualizer
          • Email Sender
          • Google Flight Search
          • Google Hotel Search
          • Google Image Search
          • Google Map Search
          • Google News Search
          • Google Scholar Search
          • Google Search
          • GroundedSAM
          • Image Text Fuser
          • Information Extractor - OpenAI Schema Generator
          • Information Extractor
          • Instagram Search
          • JSON to Table
          • LinkedIn
          • MS Word to Markdown
          • Markdown to MS Word
          • Markdown to PDF
          • Mindmap Generator
          • Notion Database
          • OCR
          • Pdf to Markdown
          • RMBG
          • Stabel-Video-Diffusion
          • Stable Diffusion Inpaint
          • Stable Diffusion Recommend
          • Stable Diffusion Transform
          • Stable Diffusion Upscale
          • Stable Diffusion with 6 fixed category
          • Stable Diffusion with Civitai
          • Storydiffusion
          • Suno Lyrics Generator
          • Suno Music Generator
          • Table to Markdown
          • TripAdvisor
          • Twitter Search
          • UDOP: Document Question Answering
          • Weather forecasting
          • Whisper large-v3
          • Wikipedia
          • Wolfram Alpha Search
          • Yelp Search
          • YouTube Downloader
          • YouTube Transcriber
          • Youtube Search
      • FAQs
      • Changelog
    • ShellAgent Mode
      • Download and Installation
      • App Builder
      • Workflow
      • Build Custom Widget
      • Publish to MyShell
      • Customized Pricing For Your Agent
      • Example
        • Child Book X Agent w/ DeepSeek
        • Kids Book NFT AI Agent w/ BNB Chain
        • DeFAI Agent w/ BNB Chain
  • Shell Launchpad
    • How to Launch a Token
    • Trade Agent Tokens
  • Tokenomics
    • $SHELL Basics
    • $SHELL Token Utility
    • How to Obtain $SHELL
    • Roadmap
  • Open-source AI Framework/SDK
    • ShellAgent
    • OpenVoice
    • MeloTTS
    • JetMoE
    • AIlice
  • Links
Powered by GitBook
On this page
  • A Simple Agent Example
  • Configuration of Each Module
  • Render and Transitions
  1. Create AI Agents
  2. Pro Config Mode
  3. Tutorial

Building Workflow

Key Concepts In This Chapter: - Module and its Configuration

A Simple Agent Example

In Pro Config, a workflow is a cascade of multiple Modules that can perform a series of tasks. In this chapter, we will build a simple agent that involves the cascade of two Modules.

{
  "type": "automata",
  "id": "chat_demo",
  "initial": "chat_page_state",
  "inputs": {},
  "outputs": {},
  "transitions": {},
  "states": {
    "chat_page_state": {
      "inputs": {
        "user_message": {
          "type": "IM",
          "user_input": true
        }
      },
      "tasks": [
        {
          "name": "generate_reply",
          "module_type": "AnyWidgetModule",
          "module_config": {
            "widget_id": "1744214024104448000",
            "system_prompt": "You are a teacher teaching Pro Config.",
            "user_prompt": "{{user_message}}",
            "output_name": "reply"
          }
        },
        {
          "name": "generate_voice",
          "module_type": "AnyWidgetModule",
          "module_config": {
            "content": "{{reply}}",
            "widget_id": "1743159010695057408",
            "output_name": "reply_voice"
          }
        }
      ],
      "render": {
        "text": "{{reply}}",
        "audio": "{{reply_voice}}"
      },
      "transitions": {
        "CHAT": "chat_page_state"
      }
    }
  }
}

In the agent above, we define the variable user_message of type IM (Instant Messaging). This allows the agent to take input in the form of messages sent to the agent. In the above example, we have set a transition on event CHAT to point to chat_page_state. So, whenever a user sends a message in the chat, the state is reloaded and the message is taken as in IM input.

This user_message is then passed into the tasks.

Configuration of Each Module

Tasks contain multiple modules that execute sequentially. For each module, we need to specify the module_type and module_config. Rather, name is optional (for readability). In the example above, we include a GPT-3.5 LLM widget and a TTS widget provided on MyShell.

Specifically, after clicking the "workshop" button on the left menu bar, you will see this widget center. On the very top selection bar, select "TTS". Then pick your favorite voice model, use the "more" button to copy the widget ID, and paste into the config file.

If you would like to add more modules or widgets, please refer to Integration with Any Widget and Modules

Render and Transitions

After the execution of the tasks, two variables called reply and reply_voice are obtained and ready to be rendered in a message that would appear in the User Interface. We have also handled a special event called CHAT in the transitions, which means when a user sends a message, the automata will jump into chat_page_state and execute that state. In the next section, we will describe how to handle and use different types of transitions.

PreviousHello World with Pro ConfigNextTransitions

Last updated 4 months ago

In the above config, we have created an agent that generates a reply to the user's input. Please note that this is a very simple agent without any memory (we will implement an agent with memory in ). Now let's delve into the details of the above example:

For demonstration purposes, we only used a simple system prompt "You are a teacher teaching Pro Config." In real-world applications, it is required to put some effort into prompt engineering and optimizing this system prompt for better performance. As for the TTS Widgets, you can choose any of your favorite voices from and paste the widget ID into the config.

Expressions and Variables
https://app.myshell.ai/robot-workshop