Using Trooper.AI in webpages is super simple. First you need these things:

  • Trooper Key (get one here)
  • Trooper.AI Javascript Library
  • some data structure as input/output


Use our library to simply set up your workflow. It's hosted on our ultra fast MT Space static webservice, so don't hesitate to stress it.

<script src=""></script>

Initialize the library with your Trooper Key and a unique training name.

const trooperKey2 = "sI-DuaNe-pUzwuZCE-..."
const myTrainingName = "" //DNS compatible name!

var myTrooperAiCloud = new window.TrooperAiCloud(trooperKey2, myTrainingName)

// initial load and wait for this to finish before start predictions
    console.log("training status is "+(status*100)+"%")
    // ... start your follow up code here

Adding Training data

So you have generated some training data? Great, lets add them to the training. Call addTrainingData(data) for each item. Best case you call this immideately after finishing a data item so you dont have to handle a big array by yourself.

var dataitem = {
    input: [0,0,1,1], 
    output: [0,1]


Next data ist generated, add it to Trooper.AI too:

dataitem = {
    input: [1,1,0,0], 
    output: [1,0]


Begin training

Trooper.AI will automatically start training after having enougth data to analyse . Please add a good potion of data like 30 to 1000 items. The amount of data items is important for good training quality. If you want to start now just tell it like this:

    if(success==true) {
        // training started ...

Event: Ready

This event is usefull to get notified after training is finished. After that all prediction is now trained on the newest dataset.

   console.log("new data trained with "+(status*100)+"%")


After your first training has finished, you can start predict something. Just send some input data (same structure like you send before for training) and the result will be predictive output data. How easy was that? 

var prediction = myTrooperAiCloud.predictFromThis([0,1,1,0])
// something like [0.5,0.5]

Live Example

We have build a working public example. Try this JsFiddle and see how easy it is to implement Trooper.AI in every web project.

Sichere Daten beim Upload über Speicherung bis Download


    For us, artificial intelligence means Trooper.AI: Our agency's own tool for artificial intelligence in marketing and sales. Thanks to artificial intelligence, we can achieve goals faster, better recognize the needs of users, communicate more naturally and address the right people more specifically. From chatbot to data analysis to image recognition - the full spectrum of the latest artificial intelligence combines Trooper.AI to our most exciting Trooper tool to date.