Strategy Pattern with a Perception Layer
The strategy pattern agent system performs well, but it's not perfect in avoiding thermal runaway. One good way to address that is to add a perception layer.
are special skill agents that process and interpret sensor data before passing it to the rest of the agent system. To improve the strategy pattern's performance on temperature control, you can add a perception layer that uses machine learning to predict thermal runaway.
While skill agents can be built within Composabl's no-code studio or created externally and then imported, perceptors are always built outside of Composabl and then published to the platform to use in agents.
In this case, the perceptor is a pre-built ML model saved as a pickle file. This ML model is trained to interpret the sensor data and check for conditions that might indicate an elevated risk of thermal runaway, and then pass that information to the selector along with the rest of the sensor data.
In this tutorial, you'll use Composabl's data science workflow to to publish the perceptor to your use case so that you can add it to your agent configuration.
Think of the perception layer as an additional set of senses that helps the agent system predict when something might go wrong, like a teacher monitoring the class for early signs of trouble.

Let's get started configuring this agent system!
1. Add the Perceptor Skill Agent to Your Use Case
This agent system has a perceptor skill agent called thermal_runaway_predictor
. To publish it to your use case, you will need to open up your favorite code editor and terminal. In your terminal, navigate to the perceptors folder and use this command with the Composabl CLI.
composabl perceptor publish thermal_runaway_predictor
Return to the agent orchestration studio and refresh the page. The skill agent will appear in the skill agents menu on the left side of your page.
Explore the Code Files
All skill agents, perceptors, and selectors have a minimum of two files in them. A Python file contains the code that the agent system will use, and a config file. Perceptors have some more files to load in ML models and other python packages.
File Structure

Thermal Runaway Perceptor
pyproject.toml
thermal_runaway_predictor.py
2. Copy the Strategy Pattern Agent System, name it Strategy Pattern with Perceptor, and add the Perceptor Skill Agent to your Strategy Pattern Agent System
Drag the Perceptor thermal_runaway_predictor
that you can now see on the left-hand side of your use case onto the perception layer.

3. Run Your Training Session
We are ready to train your agent system and see the results. Select the cluster you want to use and the number of training cycles. We suggest you run 150 training cycles. You will see the skill agents training one at a time, and you assign the number of cycles you want each skill agent to use. It will automatically assign an equal number of training sessions for each skill agent, but in some agent system designs, some skill agents might require more training than others.

4. View Results
When the training has been completed, you can view your results in the training sessions tab in the UI. This will show you information on how well the agent system is learning.
The agent system training results will be a little bit different from the strategy pattern alone. That's because the thermal runaway predictor is making a difference in how the agent system performs.
Analyzing the Strategy Pattern Agent System’s Performance with Perception
Conversion rate: 92% Thermal runaway risk: Very low
We tested this fully trained agent system and plotted the results.

Adding perception improves agent system temperature control performance.
The red lines on the graph show where the perceptors helped the agent system make adjustments to avoid thermal runaway. This agent system gets the same yield as the strategy pattern agent, but the improved temperature control has reduced the thermal runaway incidents from low to 0.
Last updated