Skip to content

cdraper-CS/cortex-cli

 
 

Repository files navigation

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
Cortex URL [https://api.cortex.insights.ai]:
Account []: <your_tenantId>
Username []: <your_username>
Password: **********

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
  • processors
    • save-runtime [runtimeDefinition]
    • list-runtime-types
    • list-runtimes
    • describe [runtimeName]
    • delete [runtimeName]
    • invoke [runtimeName] [actionId]
    • list-actions [runtimeName]
  • 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
  • environments
    • list
    • save [environmentDefinition]
    • delete [environmentDefinition]
    • describe [environmentName]
  • container-registries
    • list
    • save [registryName]
    • delete [registryName]

About

CognitiveScale Cortex CLI Tool

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 97.9%
  • Shell 2.1%