cortex-cli

Command line tool for CognitiveScale Cortex.

Usage no npm install needed!

<script type="module">
  import cortexCli from 'https://cdn.skypack.dev/cortex-cli';
</script>

README

Cortex CLI

A command line utility for the Cortex Platform.

Build Status

Installation:

From NPM:

npm install -g cortex-cli

From Source:

Once you have the code pulled, run this command from the cortex-cli directory:

npm install -g .

NOTE: When we have a release of this module, it will be published to npm.org for distribution.

For Developers:

You can link your local copy of cortex-cli to your globally installed version:

npm link

Changes you make to the source code will now be available immediately (locally).

Usage:

cortex <command> [sub-command] [options]

Common Options

  • -h, --help
  • -v, --version

Getting Started

cortex configure --file /personal/access/token.json --project defaultProject

or

cortex configure --project defaultProject
Cortex Personal Access Token: <paste access token>

Upon successful login, a config file will be saved in your home directory with your authentication token for future use. (NOTE: currently, you will have to re-run the configure command when your token expires).

To see a list of agents:

cortex agents list
[
  {
    "title": "Movie Recommendation Agent",
    "description": "Makes personalized movie recommendations for users.",
    "createdAt": "2017-12-22T03:07:39.863Z",
    "updatedAt": "2017-12-22T03:12:32.159Z",
    "name": "tutorial/movie_recommendation"
  },
  {
    "title": "Trading Insights Agent",
    "description": "Agent to generate personalized insights for traders.",
    "createdAt": "2017-12-22T03:07:40.109Z",
    "updatedAt": "2017-12-22T03:07:40.201Z",
    "name": "default/trading-insights-agent"
  },
  {
    "title": "Client Complaints Agent",
    "description": "Agent to intercept and classify customer complaints early in the process before it even goes to internal audit.",
    "createdAt": "2017-12-22T03:07:41.287Z",
    "updatedAt": "2017-12-22T03:07:41.360Z",
    "name": "default/client-complaints-agent"
  }
]

To use a different profile:

cortex configure --profile myprofile
...
cortex agents list --profile myprofile

Filtering Results using the --query option

Many of the commands support a --query option for filtering JSON responses. Queries use JMESPath to filter JSON documents. The specification for JMESPath can be found here: http://jmespath.org/. It is similar to the popular JQ tool and supported by Amazon AWS and some other notable services.

For example, if I want to select just the name and title from my previous output:

cortex agents list --query "[].{name: name, title: title}"
[
  {
    "name": "tutorial/movie_recommendation",
    "title": "Movie Recommendation Agent"
  },
  {
    "name": "default/trading-insights-agent",
    "title": "Trading Insights Agent"
  },
  {
    "name": "default/client-complaints-agent",
    "title": "Client Complaints Agent"
  }
]

Command List and Implementation Status:

  • configure
    • list
  • deploy
  • functions
    • list
    • describe [functionName]
    • invoke [functionName]
    • deploy [functionName]
    • delete [functionName]
  • stacks
    • list
    • describe
    • deploy
    • delete
  • agents
    • list
    • save [agentDefinition]
    • describe [agentName]
    • delete [agentName]
    • get-snapshots [agentName]
    • create-snapshots [snapshotDefinition]
    • invoke [serviceName]
    • get-service-activation [activationId]
  • types
    • list
    • save [typeDefinition]
    • describe [typeName]
    • delete [typeName]
  • skills
    • list
    • save [skillDefinition]
    • describe [skillName]
    • delete [skillName]
    • generate
  • content
    • upload
    • download
    • delete
    • list
  • jobs
    • list
    • save
    • describe
    • status
    • delete
  • tasks
    • list
    • logs
    • cancel
    • describe
  • connections
    • list
    • list-types
    • save [connectionDefinition]
    • delete [connectionName]
    • describe [connectionName]
    • test [connectionName]
    • generate
  • datasets
    • list
    • save [datasetDefinition]
    • delete [datasetName]
    • describe [datasetName]
    • get-dataframe [datasetName]
    • get-stream [datasetName]
    • generate
  • snapshots
  • container-registries
    • list
    • save [registryName]
    • delete [registryName]
  • profiles
    • save-schema
    • list-schemas
    • describe-schema
    • delete-schema
    • list
    • list-versions
    • describe
    • delete
    • rebuild
  • graph
    • find-events
    • publish
  • experiments
    • list
    • describe
    • delete
    • list-runs
    • describe-runs
    • delete-run
    • download-artifact