SDK

Bash
Bash

The Bash version of CTO.ai SDK works in conjunction with our Docker base images. The SDK allows the development of automations with rich user interfaces, that run in both the local terminal and remotly on the CTO.ai Platform.

Supported methods

The following SDK methods are supported by the Bash SDK:

  • Secret
  • Config
  • Track

sdk.start

Starts a remote command/pipeline/service that belongs to the same team as the pipelines, service, or command that executes the method.

sdk.start(workflowName: string): void

Example:

Secret

Access the current team’s secret store.

Subcommands:

Get:

USAGE:

OPTIONS:

ARGS:

Set:

USAGE:

OPTIONS:

Example:

Output:

Config

Access the current team’s configuration store.

Subcommands:

Get:

USAGE:

or

ARGS:

Set:

USAGE:

OPTIONS:

Delete:

USAGE:

ARGS:

Example:

Output:

Track

The track function allows you to send Events and retrieve custom analytic data.

USAGE:

OPTIONS:

ARGS:

Example:

Result:

Sends an analytics event to The Ops Platform with event deploy and metadata {image: jifejfdkdkdi3930}.

Using Track to Create Events for Insights

Tracking Workflow Metrics using CTO.ai can give deep insight into your team’s activity. To use track to send a Workflow Metric event, place your event data in the <PARAM> field like so:

The "" argument (the first argument) is a metadata field that isn’t used by the metrics dashboard, but is required by the sdk.track function, so it has been left blank in this example.

NOTE: currenlty the supported values forevent_action are succeeded or failure.

More information about Insights and Wokflow Agents can be found on the Insights Overview page.

Events

Retrieve events that were sent with sdk.track.

USAGE:

Timestamps can be given in ISO format.

Example:

Result:

Retrieves a list of events from CTO.ai that were stored for the active team that occurred between the two given times.

🚀 What’s next?

  • To learn more about the UX options available for you, please go to Bash UX page.
  • To see which prompts we offer for this SDK, you can go to Bash Prompts page.