Integrating Human-in-the-loop components to your tools
A tutorial for setting up Shinkai Tools with human-controlled steps.
This tutorial will walk you through the process of adding Human-in-the-loop steps to your Shinkai Tools, allowing you to gain greater control and modularity over your AI workflows.
As a concrete example, this tutorial will teach you how to enhance the Smart Search Engine tool with human feedback steps to create a more modular searching tool that :
- generates sub-questions
- allows you to edit them
- lets you confirm before processing.
Step 1 : Install the required Shinkai Tools
First, ensure you have installed in your Shinkai Desktop App the following tools, all available on Shinkai AI Store :
- Smart Search Engine
- Confirmation Dialog Human-in-the-loop
- Clarification Dialog Human-in-the-loop
- Options Selection Human-in-the-loop
Step 2 : Configure each tool
Head over to Shinkai Tools, and configure each of the above tools to your liking. Note that it’s not required to fill out each configuration as some have defaults built into the tools.
For the Smart Search Engine, you can for example configure :
- the maximum number of sources to return
- the search engine to use
For Human-in-the-loop tools, you can for example configure :
- the size of the dialog windows to adapt to your screen
- default title, text, and buttons labels of the dialog window
Step 3 : Set up the Shinkai AI assisted tool builder
Head over to the Shinkai Tools tab. Select the AI ‘shinkai_free_trial’, or any high-performing LLM for coding (e.g. gpt_4_1). Select a programming language for the tool. Here, we will use Python. Activate the following tools :
- Smart Search Engine
- Confirmation Dialog Human-in-the-loop
- Clarification Dialog Human-in-the-loop
- Options Selection Human-in-the-loop
- Shinkai LLM Prompt Processor
Step 4 : Prompt the AI with detailed instructions
In the prompt window, type a detailed step by step prompt to give clear instructions to the AI about the functionality of the tool to create. Clearly explain :
- the overall goal of the tool
- the steps
- how to integrate the Human-in-the-loop components
Below is an example of a well-crafted prompt that should allow the AI to create a functioning tool :
Here is an example functioning tool code you might get with the prompt above from the 1st try, using gpt_4_1 :
Note that in the above code, the AI decided not to use the Options Selection tool, instead making good use of the Clarification and Confirmation tools.
Step 5 : Test the tool
Check in the preview if the input and config fields make sense. Enter a question. Click ‘Run’.
You should then interact with a multi-step flow featuring Human-in-the-loop interactions, enabling you to fine-tune the searches to be performed.
Step 6 : Troubleshooting
When testing the tool, if your feedback or selections through the Human-in-the-loop components are not being applied, verify that the code correctly uses the output of the relevant Human-in-the-loop component. Because this is a common issue when the AI confuses output names, the prompt provided earlier in this tutorial includes a reminder of the output names for each Human-in-the-loop component.
Step 7 : Fine-tuning your enhanced tools
Now that you have a working prototype of your new tool with Human-in-the-loop controls, fine-tune it to your liking. You can :
- add further useful Human-in-the-loop steps
- add steps using the Options Selection tool
- edit the content of the dialogs (title, text, buttons labels)
- edit the prompts that process the feedbacks from the user
- implement typical tool improvements (e.g., better names for inputs, crafting precise outputs, adding informative error handling, editing the metadata)
You can now take inspiration from this tutorial to build different tools with human-controlled steps.
Options Selection trick
To create a tool flow with predefined options while allowing users to add their own, combine the Options Selection and Clarification tools as follows. In your prompt, instruct the AI to :
- use the Options Selection tool to propose the options but to also include a ‘Custom’ option button.
- make this ‘Custom’ option trigger the Clarification tool to allow the user to describe the option they want to use.
Considerations : 1 tool with Human-in-the-loop components VS. AI agent with several tools
An AI agent with several tools can replicate Human-in-the-loop interactions by asking users questions before triggering its available tools.
It is a design choice to implement an AI workflow as a tool with built-in Human-in-the-loop components or as an AI agent with several tools.
Here are the potential benefits of using a tool with built-in Human-in-the-loop components :
- Precise & Predictable Workflow : Coded steps ensure granular control and consistent execution, unlike dynamic agent decisions.
- Streamlined User Flow : Guides users through a clear, predefined sequence with focused dialogs, setting clear expectations.
- Simpler Development & Debugging : Encapsulated logic within one tool simplifies coding, troubleshooting, and adding features or error handling.
- Deep Interaction Customization : Easily tailor dialog text, prompts, and button labels for each specific human input point within the code.
- Enhanced Reusability & Sharing : Self-contained tools are easy to manage, share (e.g., via Shinkai Store), and use as a single unit without complex setup.
- Potentially Faster Execution : Direct, coded logic can avoid the overhead of agent analysis and tool selection steps.
Support and sharing your tools
For additional support, please contact Shinkai Tools support team or join us and the community on our Discord server. Engage with others to share your tools and ideas.