• First Steps
  • Basic Data Operations
  • Creating Action Handlers using Action API
  • Developing a Connector
  • Incident handling via the Domain Object Api
  • Working with Automation Tasks

First incident connector

The Domain Object Api expects messages in sdf format. The sdf format is defined in views, e.g. the sdf for an incident is defined.

Creating the model

Before we can start sending incidents to HIRO we need to have a model or representation of the environment which we want to automate in the system. The smallest possible model is a single Node. Such a default node can be created by the Domain Object Api with

curl -kH 'Content-type:application/json' -X PUT 'https://doapi.arago.co/views/default/objects/defaultMachineId' -d '{"$type":"configMachine","name":"defaultMachine","systemType":"Virtual"}'

The SDF message in the call to define the default node looks like:

{
  "$type": "configMachine",
  "name": "defaultMachine",
  "systemType":"Virtual"
}

In the following calls the defaultMachineId can be used to define the starting point in the model for newly created Automation Issues. An Automation Issue represent any kind of automation task. In the following we will take incident as an example.

Creating an Incident

To create an Automation Issue which represents an incident the following call can be made to the Domain Object Api:

curl -kH 'Content-type:application/json' -X PUT 'https://doapi.arago.co/views/default/objects/inc-0001' -d' {"$type":"incident","subject":"My first incident","originNode":"defaultMachineId","summary":"This is the first incident created by me","priority":"important","description":"The incident was created for testing.","urgency":"high","sourceStatus":"open"}'

The SDF message in this call is

{
  "$type": "incident",
  "subject": "My first incident",
  "originNode": "defaultMachineId",
  "summary": "This is the first incident created by me",
  "priority": "important",
  "description": "The incident was created for testing.",
  "urgency": "high",
  "sourceStatus": "open"
}

In HIRO the following AutomationIssue will be created:

{
  "/ProcessIssue": "process me",
  "/actual_type": "IncidentType",
  "/description": "The incident was created for testing.",
  "/priority": "important",
  "/sourceStatus": "open",
  "/summary": "This is the first incident created by me",
  "/urgency": "high",
  "ogit/Automation/originNode": "defaultMachineId",
  "ogit/_graphtype": "vertex",
  "ogit/_id": "cjqzbn759dxq27f58egrs3ped",
  "ogit/_type": "ogit/Automation/AutomationIssue",
  "ogit/_xid": "prefix:inc-0001",
  "ogit/status": "PROCESSING",
  "ogit/subject": "My first incident"
}

The issue will be processed by HIRO. Different knowledge Items kis will be applied to solve the task at hand.

If the incident sdf does not contain required attributes, either new attributes can be requested on OGIT, or free attribute (starting with /) can be sent to the Domain Object Api.

{
  "$type": "incident",
  "subject": "My first incident",
  "originNode": "defaultMachineId",
  "summary": "This is the first incident created by me",
  "description": "The incident was created for testing.",
  "/test": "this is a free test variable"
}

Check message was successful

The Domain Object Api has non-blocking calls. So the execution of a call to create or update an incident (and any other type of sdf) will return a message with a transaction link.

{
  "link": "/views/default/transactions/0c6fc0cd-d6c9-4ad0-a965-859e6a3771bd",
  "object": "/views/default/objects/inc-0001",
  "status": "waiting",
  "requestedAt": 1616745367187,
  "updatedAt": 1616745367187,
  "startedAt": -1,
  "errors": []
}

The transactions can be checked by the link or by

curl https://doapi.arago.co/views/default/transactions
  {
    "link": "/views/default/transactions/0c6fc0cd-d6c9-4ad0-a965-859e6a3771bd",
    "object": "/views/default/objects/inc-0001",
    "status": "done-success",
    "requestedAt": 1616745367187,
    "updatedAt": 1616745369450,
    "startedAt": 1616745369335,
    "errors": []
  }

If the transactions was done successfully the status of the transaction will show done-success. More details can be found in transactions documentation.

It is also possible to subscribe to the transactions via websocket with transaction.done-success and transaction.done-failure respectively.

Getting updates

Once HIRO starts working on the Automation Issue, every step will be documented. Every step will be exposed as an update message by the Domain Object Api.

To check the updates, following call can be done with offset or iterator as a parameter.

curl https://doapi.arago.co/views/default/updates?offset=0

The updates have the following format:

[
  {
    "link": "/views/default/updates/0",
    "offset": 0,
    "object": {
      "summary": "The summary has been updated by HIRO",
      "hiroStatus": "PROCESSING",
      "$delta": [
        "summary"
      ],
      "comments": {
        "inc-0001-COMMENT": {
          "$delta": [],
          "comments": []
        }
      },
      "$type": "incident",
      "$id": "inc-0001"
    }
  }
]

In $id the id of the incident for which the update is sent is shown. In $delta the fields are shown which have changed by HIRO. The comments section shows the steps done by HIRO.

It is also possible to subscribe to the updates via websocket with update.received.

Interactive communicating with HIRO

Comment or work notes can be sent to the Domain Object API, on creation or while the incident is being processed by HIRO. If an incident is created like described in Creating an Incident an additional comment can be added. For example a comment can be sent to stop processing:

curl -kH 'Content-type:application/json' -X PUT 'https://doapi.arago.co/views/default/objects/inc-0001' -d '{ "$type": "incident", "comments": { "inc-0001-COMMENT": { "comments": [{ "timestamp": 1584632631000, "value": "[HIRO] Please eject" }] } } }'

The SDF message in this call is:

{
  "$type": "incident",
  "comments": {
    "inc-0001-COMMENT": {
      "comments": [
        {
          "timestamp": 1584632631000,
          "value": "[HIRO] Please eject"
        }
      ]
    }
  }
}

Now this is added to the /comments attribute in the Automation Issue. Additionally, it is stored in a timeseries vertex with the name UserComment. A ki can react on this comment. HIRO will eject the Automation Issue, if the following ki is deployed:

ki
  title: "Eject issue on request"
  description: "Eject issue on request"
on
  ogit/_id
when
  comments =~ "[HIRO].*eject"
  ProcessIssue
do
  eject_issue("Issue has been ejected on request")

This will result in a changed processing status of the Automation Issue. This is reflected in an update exposed on the Domain Object Api’s update endpoint:

 {
    "link": "/views/default/updates/1",
    "offset": 1,
    "object": {
      "summary": "The summary has been updated by HIRO",
      "hiroStatus": "TERMINATED",
      "$delta": [
        "hiroStatus"
      ],

      "$type": "incident",
      "$id": "inc-0001"
    }
  }

Depending on the kis available in HIRO different reactions can follow a comment in the incident.