craft ai HTTP REST API

craft ai AI-as-a-service enables developers to create Apps and Things that adapt to each user. To go beyond useless dashboards and spammy notifications, craft ai learns how users behave to automate recurring tasks, make personalized recommendations, or detect anomalies.

Get Started!

0 - Signup

If you’re reading this you are probably already registered with craft ai, if not, head to https://beta.craft.ai/signup.

🚧 craft ai is currently in private beta, as such we validate accounts, this step should be quick.

1 - Create a project

Once your account is setup, let’s create your first project! Go in the ‘Projects’ tab in the craft ai control center at https://beta.craft.ai/projects, and press Create a project.

Once it’s done, you can click on your newly created project to retrieve its tokens. There are two types of tokens: read and write. You’ll need the write token to create, update and delete your agent.

2 - Setup

Authenticating API calls

Every HTTP call to craft ai needs to be provided with the token in the Authorization header using the Bearer schema. Therefore the content of the header should look like the following.

Authorization: Bearer {token}

Alternatively, it can be provided as a token query parameter.

Endpoint

All API calls are done over HTTPS, through https://beta.craft.ai/api/v1.

3 - Create an agent

craft ai is based on the concept of agents. In most use cases, one agent is created per user or per device.

An agent is an independent module that stores the history of the context of its user or device’s context, and learns which decision to take based on the evolution of this context in the form of a decision tree.

In this example, we will create an agent that learns the decision model of a light bulb based on the time of the day and the number of people in the room. In practice, it means the agent’s context have 4 properties:

  • peopleCount which is a continuous property,
  • timeOfDay which is a time_of_day property,
  • timezone, a property of type timezone needed to generate proper values for timeOfDay (cf. the context properties type section for further information),
  • and finally lightbulbState which is an enum property that is also the output.
POST https://beta.craft.ai/api/v1/{owner}/{project}/agents HTTP/1.1
Content-Type: application/json
Authorization: Bearer {token}

{
  "id": "my_first_agent",
  "configuration": {
    "context": {
      "peopleCount": {
        "type": "continuous"
      },
      "timeOfDay": {
        "type": "time_of_day"
      },
      "timezone": {
        "type": "timezone"
      },
      "lightbulbState": {
        "type": "enum"
      }
    },
    "output": ["lightbulbState"]
  }
}

Pretty straightforward to test! Open https://beta.craft.ai/inspector, select you project and your agent is now listed.

Now, if you run that a second time, you’ll get an error: the agent 'my_first_agent' is already existing. Let’s see how we can delete it before recreating it.

DELETE https://beta.craft.ai/api/v1/{owner}/{project}/agents/my_first_agent HTTP/1.1
Authorization: Bearer {token}

For further information, check the ‘create agent’ reference documentation.

4 - Add context operations

We have now created our first agent but it is not able to do much, yet. To learn a decision model it needs to be provided with data, in craft ai these are called context operations.

In the following we add 8 operations:

  1. The initial one sets the initial state of the agent, on July 25 2016 at 5:30, in Paris, nobody is there and the light is off;
  2. At 7:02, someone enters the room the light is turned on;
  3. At 7:15, someone else enters the room;
  4. At 7:31, the light is turned off;
  5. At 8:12, everyone leaves the room;
  6. At 19:23, 2 persons enter the room;
  7. At 22:35, the light is turned on;
  8. At 23:06, everyone leaves the room and the light is turned off.
POST https://beta.craft.ai/api/v1/{owner}/{project}/agents/my_first_agent/context HTTP/1.1
Content-Type: application/json
Authorization: Bearer {token}

[
   {
    "timestamp": 1469410200,
    "context": {
      "timezone": "+02:00",
      "peopleCount": 0,
      "lightbulbState": "OFF"
    }
  },
  {
    "timestamp": 1469415720,
    "context": {
      "peopleCount": 1,
      "lightbulbState": "ON"
    }
  },
  {
    "timestamp": 1469416500,
    "context": {
      "peopleCount": 2
    }
  },
  {
    "timestamp": 1469417460,
    "context": {
      "lightbulbState": "OFF"
    }
  },
  {
    "timestamp": 1469419920,
    "context": {
      "peopleCount": 0
    }
  },
  {
    "timestamp": 1469460180,
    "context": {
      "peopleCount": 2
    }
  },
  {
    "timestamp": 1469471700,
    "context": {
      "lightbulbState": "ON"
    }
  },
  {
    "timestamp": 1469473560,
    "context": {
      "peopleCount": 0
    }
  }
]

In real-world applications, you’ll probably do the same kind of things when the agent is created and then, regularly throughout the lifetime of the agent with newer data.

For further information, check the ‘add context operations’ reference documentation.

5 - Compute the decision tree

The agent has acquired a context history, we can now compute a decision tree from it! A decision tree models the output, allowing us to estimate what the output would be in a given context.

The decision tree is computed at a given timestamp, which means it will consider the context history from the creation of this agent up to this moment. Let’s first try to compute the decision tree at midnight on July 26, 2016.

GET https://beta.craft.ai/api/v1/{owner}/{project}/agents/my_first_agent/decision/tree?t=1469476800 HTTP/1.1
Authorization: Bearer {token}

Try to retrieve the tree at different timestamps to see how it gradually learns from the new operations. To visualize the trees, use the inspector!

For further information, check the ‘compute decision tree’ reference documentation.

6 - Take a decision

Once the decision tree is computed it can be used to take a decision. In our case it is basically answering this type of question: “What is the anticipated state of the lightbulb at 7:15 if there are 2 persons in the room ?”.

It is possible, albeit not very efficient to take a decision directly through the API.

POST https://beta.craft.ai/api/v1/{owner}/{project}/agents/my_first_agent/decision?t=1469476800 HTTP/1.1
Content-Type: application/json
Authorization: Bearer {token}

{
  "timezone": "+02:00",
  "timeOfDay": 7.25,
  "peopleCount": 2
}

The best way being first to retrieve the tree then locally interpret it using an official or custom interpreter.

For further information, check the ‘take decision’ reference documentation.

API

Project

craft ai agents belong to projects. In the current version, each identified users defines a owner and can create projects for themselves, in the future we will introduce shared projects.

Configuration

Each agent has a configuration defining:

  • the context schema, i.e. the list of property keys and their type (as defined in the following section),
  • the output properties, i.e. the list of property keys on which the agent takes decisions,

⚠️ In the current version, only one output property can be provided.

  • the time_quantum is the minimum amount of time, in seconds, that is meaningful for an agent; context updates occurring faster than this quantum won’t be taken into account. As a rule of thumb, you should always choose the largest value that seems right and reduce it, if necessary, after some tests.
  • the learning_period is the maximum amount of time, in seconds, that matters for an agent; the agent’s decision model can ignore context that is older than this duration. You should generally choose the smallest value that fits this description.

⚠️ if no time_quantum is specified, the default value is 600.

⚠️ if no learning_period is specified, the default value is 15000 time quantums.

Context properties types 

Base types: enum and continuous

enum and continuous are the two base craft ai types:

  • enum properties can take any string value;
  • continuous properties can take any real number value.
Time types: timezone, time_of_day, day_of_week, day_of_month and month_of_year

craft ai defines 3 types related to time:

  • time_of_day properties can take any real number belonging to [0.0; 24.0[ representing the number of hours in the day since midnight (e.g. 13.5 means 13:30),
  • day_of_week properties can take any integer belonging to [0, 6], each value represents a day of the week starting from Monday (0 is Monday, 6 is Sunday).
  • day_of_month properties can take any integer belonging to [1, 31], each value represents a day of the month.
  • month_of_year properties can take any integer belonging to [1, 12], each value represents a month of the year.
  • timezone properties can take string values representing the timezone as an offset from UTC, the expected format is ±[hh]:[mm] where hh represent the hour and mm the minutes from UTC (eg. +01:30)), between -12:00 and +14:00.

ℹ️ By default, the values of the time_of_day and day_of_week properties are generated from the timestamp of an agent’s state and the agent’s current timezone. Therefore, whenever you use generated time_of_day and/or day_of_week in your configuration, you must provide a timezone value in the context. There can only be one timezone property.

If you wish to provide their values manually, add is_generated: false to the time types properties in your configuration. In this case, since you provide the values, the timezone property is not required, and you must update the context whenever one of these time values changes in a way that is significant for your system.

Examples

Let’s take a look at the following configuration. It is designed to model the color of a lightbulb (the lightbulbColor property, defined as an output) depending on the outside light intensity (the lightIntensity property), the time of the day (the time property) and the day of the week (the day property).

day and time values will be generated automatically, hence the need for timezone, the current Time Zone, to compute their value from given timestamps.

The time_quantum is set to 100 seconds, which means that if the lightbulb color is changed from red to blue then from blue to purple in less that 1 minutes and 40 seconds, only the change from red to purple will be taken into account.

The learning_period is set to 108 000 seconds (one month) , which means that the state of the lightbulb from more than a month ago can be ignored when learning the decision model.

{
  "context": {
      "lightIntensity":  {
        "type": "continuous"
      },
      "time": {
        "type": "time_of_day"
      },
      "day": {
        "type": "day_of_week"
      },
      "timezone": {
        "type": "timezone"
      },
      "lightbulbColor": {
          "type": "enum"
      }
  },
  "output": ["lightbulbColor"],
  "time_quantum": 100,
  "learning_period": 108000
}

In this second example, the time property is not generated, no property of type timezone is therefore needed. However values of time must be manually provided continuously.

{
  "context": {
    "time": {
      "type": "time_of_day",
      "is_generated": false
    },
    "lightIntensity":  {
        "type": "continuous"
    },
    "lightbulbColor": {
        "type": "enum"
    }
  },
  "output": ["lightbulbColor"],
  "time_quantum": 100,
  "learning_period": 108000
}

Timestamp

craft ai API heavily relies on timestamps. A timestamp is an instant represented as a Unix time, that is to say the amount of seconds elapsed since Thursday, 1 January 1970 at midnight UTC. In most programming languages this representation is easy to retrieve, you can refer to this page to find out how.

Agent

Create 

Create a new agent, and create its configuration.

URI

POST /{owner}/{project}/agents

  • owner string (required - example: gisele)

    The identifier of the user to whom the project belongs

  • project string (required - example: smarthome)

    The identifier of the project to which the agent belongs

Body

The body should be a valid JSON object with the following keys:

  • id string (optional)

    The identifier that will be used as a reference to the agent. If unspecified, craft ai will generate it.

  • configuration object (required)

    The configuration of the agent allowing craft ai to build decision trees for this agent. See configuration section for more details.

Example
  • Request

    POST /{owner}/{project}/agents HTTP/1.1
    Content-Type: application/json
    Authorization: Bearer {token}
    
    {
      "id": "impervious_kraken",
      "configuration": {
        "context": {
          "peopleCount": {
            "type": "continuous"
          },
          "timeOfDay": {
            "type": "time_of_day"
          },
          "timezone": {
            "type": "timezone"
          },
          "lightbulbState": {
            "type": "enum"
          }
        },
        "output": ["lightbulbState"]
      }
    }
    
  • Response 201

    Content-Type: application/json
    
    {
      "_version": "1.0.0",
      "id": "impervious_kraken",
      "configuration": {
        "context": {
          "peopleCount": {
            "type": "continuous"
          },
          "timeOfDay": {
            "type": "time_of_day"
          },
          "timezone": {
            "type": "timezone"
          },
          "lightbulbState": {
            "type": "enum"
          }
        },
        "output": ["lightbulbState"]
      }
    }
    
  • Response 400

    • The time_quantum or learning_period parameter has an invalid value.
    • The configuration key is not defined in the request body.
    • configuration is defined with a context but no output.
    • configuration is defined with a context that contained unknown types.

Delete 

URI

DELETE /{owner}/{project}/agents/{agent}

  • owner string (required - example: “gisele”)

    The identifier of the user to whom the project belongs

  • project string (required - example: smarthome)

    The identifier of the project to which the agent belongs

  • agent string (required - example: “impervious_kraken”)

    The agent identifier

Example
  • Request

    DELETE /{owner}/{project}/agents/{agent} HTTP/1.1
    Authorization: Bearer {token}
  • Response 200

    Content-Type: application/json
    
    {
      "_version": "1.0.0",
      "id": "impervious_kraken",
      "configuration": {
        "context": {
          "peopleCount": {
            "type": "continuous"
          },
          "timeOfDay": {
            "type": "time_of_day"
          },
          "timezone": {
            "type": "timezone"
          },
          "lightbulbState": {
            "type": "enum"
          }
        },
        "output": ["lightbulbState"]
      }
    }
    
  • Response 200

    The given agent doesn’t (or no longer) exists.

    Content-Type: application/json
    
    {
      "message": "The given agent \"impervious_kraken\" doesn't (or no longer) exists."
    }
    

Retrieve 

URI

GET /{owner}/{project}/agents/{agent}

  • owner string (required - example: “gisele”)

    The identifier of the user to whom the project belongs

  • project string (required - example: smarthome)

    The identifier of the project to which the agent belongs

  • agent string (required - example: “impervious_kraken”)

    The agent identifier

Example
  • Request

    GET /{owner}/{project}/agents/{agent} HTTP/1.1
    Authorization: Bearer {token}
  • Response 200

    Content-Type: application/json
    
    {
      "_version": "1.0.0",
      "configuration": {
        "context": {
          "peopleCount": {
            "type": "continuous"
          },
          "timeOfDay": {
            "type": "time_of_day",
            "is_generated": true
          },
          "timezone": {
            "type": "timezone"
          },
          "lightbulbState": {
            "type": "enum"
          }
        },
        "output": [
          "lightbulbState"
        ],
        "time_quantum": 600,
        "learning_period": 108000
      },
      "firstTimestamp": 1469410200,
      "lastTimestamp": 1469473560
    }
    

    The body response is a JSON object containing the configuration given initially upon the agent’s creation. The two other fields "firstTimestamp" and "lastTimestamp" represent the timestamp of the first and last context operation. They are present only if context operations were added to the agent.

  • Response 404

    • owner is unknown
    • project associated to the owner is unknown
    • agent is unknown to the given project

List 

URI

GET /{owner}/{project}/agents

  • owner string (required - example: “gisele”)

    The identifier of the user to whom the project belongs

  • project string (required - example: smarthome)

    The identifier of the project to which the agent belongs

Example
  • Request

    GET /{owner}/{project}/agents HTTP/1.1
    Authorization: Bearer {token}
  • Response 200

    Content-Type: application/json
    
    {
      "agentsList": [
        "my_first_agent",
        "impervious_kraken"
      ]
    }
    

    The response is a JSON object containing an array of all the project’s agents.

  • Response 404

    • owner is unknown
    • project associated to the owner is unknown

Context

Add operations 

URI

POST /{owner}/{project}/agents/{agent}/context

  • owner string (required - example: “gisele”)

    The identifier of the user to whom the project belongs

  • project string (required - example: smarthome)

    The identifier of the project to which the agent belongs

  • agent string (required - example: “impervious_kraken”)

    The agent identifier

Body

The body should be an array of context operations in JSON format, each having:

  • timestamp number (required)

    The timestamp at which the operation occurs in Unix time format.

  • diff object (required)

    A context object containing configuration keys for which a change should be registered at the specified time.

    ⚠️ The very first diff added to an agent needs to include all the configuration keys.

Example
  • Request

    POST /{owner}/{project}/agents/{agent}/context HTTP/1.1
    Content-Type: application/json
    Authorization: Bearer {token}
    
    [
      {
        "timestamp": 1469410200,
        "context": {
          "timezone": "+02:00",
          "peopleCount": 0,
          "lightbulbState": "OFF"
        }
      },
      {
        "timestamp": 1469415720,
        "context": {
          "peopleCount": 1,
          "lightbulbState": "ON"
        }
      },
      {
        "timestamp": 1469416500,
        "context": {
          "peopleCount": 2
        }
      },
      {
        "timestamp": 1469417460,
        "context": {
          "lightbulbState": "OFF"
        }
      },
      {
        "timestamp": 1469419920,
        "context": {
          "peopleCount": 0
        }
      },
      {
        "timestamp": 1469460180,
        "context": {
          "peopleCount": 2
        }
      },
      {
        "timestamp": 1469471700,
        "context": {
          "lightbulbState": "ON"
        }
      },
      {
        "timestamp": 1469473560,
        "context": {
          "peopleCount": 0
        }
      }
    ]
    
  • Response 201

    Content-Type: application/json
    
    {
      "message": "Successfully added {n} operations to the agent {agent} context."
    }
    
  • Response 400

    • No context’s operations are given in the request.
    • If one context’s operation is invalid.
    • First context’s operation is incomplete.
    • A value was given to a generated property of type day_of_week or time_of_day.
  • Response 404

    • owner is unknown
    • project is unknown for the given owner
    • agent is unknown to the given project

List operations 

URI

GET /{owner}/{project}/agents/{agent}/context

  • owner string (required - example: “gisele”)

    The identifier of the user to whom the project belongs

  • project string (required - example: smarthome)

    The identifier of the project to which the agent belongs

  • agent string (required - example: “impervious_kraken”)

    The agent identifier

Example
  • Request

    GET /{owner}/{project}/agents/{agent}/context HTTP/1.1
    Authorization: Bearer {token}
  • Response 200

    Content-Type: application/json
    
    [
      {
        "timestamp": 1469410200,
        "context": {
          "timezone": "+02:00",
          "peopleCount": 0,
          "lightbulbState": "OFF"
        }
      },
      {
        "timestamp": 1469415720,
        "context": {
          "peopleCount": 1,
          "lightbulbState": "ON"
        }
      },
      {
        "timestamp": 1469416500,
        "context": {
          "peopleCount": 2
        }
      },
      {
        "timestamp": 1469417460,
        "context": {
          "lightbulbState": "OFF"
        }
      },
      {
        "timestamp": 1469419920,
        "context": {
          "peopleCount": 0
        }
      },
      {
        "timestamp": 1469460180,
        "context": {
          "peopleCount": 2
        }
      },
      {
        "timestamp": 1469471700,
        "context": {
          "lightbulbState": "ON"
        }
      },
      {
        "timestamp": 1469473560,
        "context": {
          "peopleCount": 0
        }
      }
    ]
    

    The body response is a JSON array of all previously added context operations in the same format as the way they were sent.

  • Response 404

    • owner is unknown
    • project is unknown for the owner
    • agent is unknown to the given project

Retrieve state 

URI

GET /{owner}/{project}/agents/{agent}/context/state?t={timestamp}

  • owner string (required - example: “gisele”)

    The identifier of the user to whom the project belongs

  • project string (required - example: smarthome)

    The identifier of the project to which the agent belongs

  • agent string (required - example: “impervious_kraken”)

    The agent identifier

  • timestamp number (example: 1458741232)

    The timestamp at which to retrieve the given agent’s context, if provided. Otherwise, returns the latest context operation.

Example
  • Request

    GET /{owner}/{project}/agents/{agent}/context/state?t={timestamp} HTTP/1.1
    Authorization: Bearer {token}
  • Response 200

    Content-Type: application/json
    
    {
      "context": {
        "timezone": "+02:00",
        "peopleCount": 0,
        "lightbulbState": "ON",
        "timeOfDay": 21.1
      },
      "timestamp": 1469473560
    }
    
  • Response 404

    • owner is unknown
    • project is unknown for the owner
    • agent is unknown to the given project

Decision tree

Decision trees are computed at specific timestamps, directly by craft ai which learns from the context operations added throughout time.

When you compute a decision tree, craft ai returns an object containing:

  • the API version

  • the agent’s configuration as specified during the agent’s creation

  • the tree itself as a JSON object:

    • Internal nodes are represented by a "decision_rule" object and a "children" array. The first one, contains the "property, and the "property"'s value, to decide which child matches a context.
    • Leaves have a "predicted_value", "confidence" and "decision_rule" object for this value, instead of a "children" array. "predicted_value" is an estimation of the output in the contexts matching the node. "confidence" is a number between 0 and 1 that indicates how confident craft ai is that the output is a reliable prediction. When the output is a numerical type, leaves also have a "standard_deviation" that indicates a margin of error around the "predicted_value".
    • The root only contains a "children" array.

Compute 

URI

GET /{owner}/{project}/agents/{agent}/decision/tree?t={timestamp}

  • owner string (required - example: “gisele”)

    The identifier of the user to whom the project belongs

  • project string (required - example: smarthome)

    The identifier of the project to which the agent belongs

  • agent string (required - example: “impervious_kraken”)

    The agent identifier

  • timestamp number (default: “latest” - example: 1469473560)

    The timestamp up to which the agent context history is considered to generate the decision tree

Example
  • Request

    GET /{owner}/{project}/agents/{agent}/decision/tree?t={timestamp} HTTP/1.1
    Authorization: Bearer {token}
  • Response 201

    Content-Type: application/json
    
    {
      "_version": "1.0.0",
      "configuration": {
        "context": {
          "peopleCount": {
            "type": "continuous"
          },
          "timeOfDay": {
            "type": "time_of_day",
            "is_generated": true
          },
          "timezone": {
            "type": "timezone"
          },
          "lightbulbState": {
            "type": "enum"
          }
        },
        "output": [
          "lightbulbState"
        ],
        "learning_period": 108000,
        "time_quantum": 600
      },
      "trees": {
        "lightbulbState": {
          "children": [
            {
              "children": [
                {
                  "children": [
                    {
                      "confidence": 0.9545537233352661,
                      "decision_rule": {
                        "operator": "<",
                        "operand": 1,
                        "property": "peopleCount"
                      },
                      "predicted_value": "OFF"
                    },
                    {
                      "confidence": 0.8630361557006836,
                      "decision_rule": {
                        "operator": ">=",
                        "operand": 1,
                        "property": "peopleCount"
                      },
                      "predicted_value": "ON"
                    }
                  ],
                  "decision_rule": {
                    "operator": "[in[",
                    "operand": [3.5, 5.6666665],
                    "property": "timeOfDay"
                  }
                },
                {
                  "confidence": 0.9947378635406494,
                  "decision_rule": {
                    "operator": "[in[",
                    "operand": [5.6666665, 20.666666],
                    "property": "timeOfDay"
                  },
                  "predicted_value": "OFF"
                }
              ],
              "decision_rule": {
                "operator": "[in[",
                "operand": [3.5, 20.666666],
                "property": "timeOfDay"
              }
            },
            {
              "confidence": 0.8630361557006836,
              "decision_rule": {
                "operator": "[in[",
                "operand": [20.666666, 3.5],
                "property": "timeOfDay"
              },
              "predicted_value": "ON"
            }
          ]
        }
      }
    }
    

    The response body is a JSON array containing the tree information, as described at the top of the Decision tree section.

  • Response 404

    • owner is unknown
    • project is unknown for the owner
    • agent is unknown to the given project

Take Decision 

URI

POST /{owner}/{project}/agents/{agent}/decision?t={timestamp}

  • owner string (required - example: “gisele”)

    The identifier of the user to whom the project belongs

  • project string (required - example: smarthome)

    The identifier of the project to which the agent belongs

  • agent string (required - example: “impervious_kraken”)

    The agent identifier

  • timestamp number (example: 1469473600)

    The timestamp up to which the agent context history is considered to generate the decision tree. This route is like getting the decision tree at this timestamp t, and then using it to take a decision in the context provided in the body. Thus, the timestamp and the given context are independant, the time types in the context don’t have to be consistent with the timestamp.

Body

The body should be a JSON object containing information about the context in which to make the decision. There should be no missing keys compared to the original agent’s configuration (except for the output) or craft ai may return an error.

Example
  • Request

    POST /{owner}/{project}/agents/{agent}/decision?t={timestamp} HTTP/1.1
    Content-Type: application/json
    Authorization: Bearer {token}
    
    {
      "timezone": "+02:00",
      "timeOfDay": 7.5,
      "peopleCount": 2
    }
    
  • Response 200

    Content-Type: application/json
    
    {
      "_version": "1.0.0",
      "context": {
        "timeOfDay": 7.5,
        "peopleCount": 2,
        "timezone": "+02:00"
      },
      "output": {
        "lightbulbState": {
          "predicted_value": OFF",
          "confidence": 0.9947378635406494,
          "decision_rules": [
            {
              "operand": [
                3.5,
                20.666666
              ],
              "operator": "[in[",
              "property": "timeOfDay"
            },
            {
              "operand": [
                5.6666665,
                20.666666
              ],
              "operator": "[in[",
              "property": "timeOfDay"
            }
          ]
        }
      }
    }
    

    The response body upon success is a JSON object containing the timestamp at which the decision is made, the given context and the decision itself with the associated confidence index.

  • Response 200

    If the output is a numerical type, the decision also contains a standard_deviation field.

    Content-Type: application/json
    
    {
      "_version": "1.0.0",
      "context": {
        "timeOfDay": 7.5,
        "peopleCount": 2,
        "timezone": "+02:00"
      },
      "output": {
        "lightBulbIntensity": {
          "pedicted_value": 10.5,
          "confidence": 0,
          "standard_deviation": 1.25,
          "decision_rules": [ ... ]
        }
      }
    }
    
  • Response 200

    If the agent doesn’t have any knowledge on the given context, it returns a null decision and a confidence of 0.

    Content-Type: application/json
    
    {
      "_version": "1.0.0",
      "context": {
        "timeOfDay": 7.5,
        "peopleCount": 2,
        "timezone": "+02:00"
      },
      "output": {
        "lightbulbState": {
          "predicted_value": null,
          "decision_rules": [ ... ],
          "confidence": 0
        }
      }
    }
    
  • Response 400

    • Query parameter t is not defined.
    • Given timestamp is before all the saved context operations.
    • The given body is an incomplete context.
    • The body is containing invalid value.
  • Response 404

    • owner is unknown
    • project is unknown to the owner
    • agent is unknown to the given project