unSkript Documentation
Free SandboxBlogGitHubSlack Community
  • What is unSkript?
  • Guides
    • Contribute to Open Source
    • Getting started
      • Sign Up/Install
      • Authentication
        • Okta configuration
          • Okta Groups Sync
      • Create a Proxy
      • Add Credentials to Connect your Resources
      • Key Terms
  • RunBooks
    • Prebuilt xRunBooks
      • xRunBooks for CloudOps
      • xRunBooks for Cost Optimization
      • xRunBooks for DevOps
      • xRunBooks for IAM
      • xRunBooks for SecOps
      • xRunBooks for SRE
      • xRunBooks for Troubleshooting
    • Creating RunBooks
      • Importing unSkript xRunBooks
      • Create a xRunBook
      • Add an Action
      • Connecting Actions
      • Create a RunBook Input Parameter
      • Create a Credential
      • Writing Notes
      • Running XRunBooks
        • Running RunBooks with Approvals
      • Schedules
      • xRunBook Executions
      • Alarms
        • Create an Alarm Webhook
          • Webhooks for onprem installations
        • Create a Grafana Alert
        • Attaching runbooks to alarms
      • Folders
      • RunBook Outputs
  • Actions
    • What is an Action?
    • Create Custom Actions
    • Create Actions with AI
    • Actions
      • Action Configuration
        • Configure Action Inputs
        • Add Action Inputs
        • Action Output
        • Action Iterator
          • Using Iterators
        • Action Poll
        • Action Start Condition
      • Anatomy of an Action
    • Prebuilt Actions
  • Healthchecks
    • What is a HealthCheck?
    • Create a HealthCheck
      • Create a HealthCheck Folder
      • Adding Checks
    • HealthCheck Parameters
    • Running HealthChecks
    • HealthCheck Remediation
  • Workflows
    • What is a Workflow?
  • Connnecting
    • Connectors
      • Airflow
        • Airflow Actions
      • AWS
        • AWS Actions
          • AWS Cloudwatch Actions
          • AWS EC2 Actions
          • AWS ECS Actions
          • AWS EKS Actions
          • AWS ELB Actions
          • AWS IAM Actions
          • AWS Postgres Actions
          • AWS RDS Actions
          • AWS RedShift Actions
          • AWS S3 Actions
          • AWS VPC Actions
      • Azure
        • Azure Actions
      • ChatGPT
        • ChatGPT Actions
      • Datadog
        • Configuring webhook in Datadog
        • Datadog Actions
          • Datadog Alert Actions
          • Datadog Metrics Actions
          • Datadog Monitor Actions
      • Elasticsearch
        • Elasticsearch Actions
      • GCP
        • GCP Actions
          • GCP Bucket Actions
          • GCP GKE Actions
          • GCP IAM Actions
          • GCP VM Actions
      • Github
        • Github Actions
      • Grafana
        • Grafana Actions
      • Hadoop
        • Hadoop Actions
      • Jenkins
        • Jenkins Actions
      • Jira
        • Jira Actions
      • Kafka
        • Kafka Actions
      • Kubernetes
        • K8s Actions
      • MongoDB
        • MongoDB Actions
      • MS SQL
        • MSSQL Actions
      • MySQL
        • MySQL Actions
      • Netbox
        • Netbox Actions
      • Nomad
        • Nomad Actions
      • OpenSearch
        • opensearch Actions
      • Pingdom
        • Pingdom Actions
      • Postgres
        • Postgres Actions
      • Prometheus
        • Prometheus Actions
      • Redis
        • Redis Actions
      • REST
        • REST Actions
      • SalesForce
        • SalesForce Actions
      • Slack
        • Slack Actions
      • Snowflake
        • Snowflake Actions
      • Splunk
        • Splunk Actions
      • SSH
        • SSH Actions
      • Stripe
        • Stripe Actions
      • Terraform
        • Terraform Actions
      • Zabbix
    • Proxies
      • Environment
        • RunBooks Across Environments: ServiceIDs
      • unSkript Proxy
      • AWS Proxy
      • GCP Proxy
    • Secret store
      • Vault
  • Tooling
    • Role Based Access Control
      • RBAC Roles
    • API reference
      • Authentication
      • Endpoints
        • Executions
        • RunBooks
        • Schedules
    • Command Line Tool
    • Notifications
  • Fundamentals
    • Jupyter Notebook 101
  • Use Cases
    • DevOps
    • SRE
  • Open source
    • Runbooks.sh
    • Contribute to Open Source
  • Lists
    • AWS Service Quota list
Powered by GitBook
On this page
  • Adding your ChatGPT API Key
  • Creating an Action with ChatGPT
  • Creating an Action
  • Modifying your Action
  • Testing your Action
  • ChatGPT Tips

Was this helpful?

  1. Actions

Create Actions with AI

Use ChatGPT's generative AI to quickly build Actions

PreviousCreate Custom ActionsNextActions

Last updated 1 year ago

Was this helpful?

If you require an acton that is not yet included in unSkript, you can create your own. The quickest way to go from Zero to Action is to use ChatGPT's generative AI to create an Action.

Adding your ChatGPT API Key

Adding your API key:

Your API Key and your organization are entered as parameters when starting your Docker image:

docker run -it -p 8888:8888 \
 -v $HOME/Awesome-CloudOps-Automation/custom:/data \
 -v $HOME/.unskript:/unskript \
 -e ACA_AWESOME_MODE=1 \
 -e OPENAI_ORGANIZATION_ID=<your openAI org> \
 -e OPENAI_API_KEY=<your API key> \
 -e OPENAI_MODEL=GPT-4 \
 --user root \
 docker.io/unskript/awesome-runbooks:1221

If you do not include the OPENAI_ORGANIZATION_ID or OPENAI_API_KEY, unSkript will run with all the features and tools, except the ChatGPT GenAI tool.

In the online version of unSkript, choose More->Settings from the top navigation.

Under Integrations, add your organization and API key.

Creating an Action with ChatGPT

In an open RunBook, Click the + Add GenAI Action. This will add a new Action in your RunBook.

In addition to the Configurations and Run Action buttons, there is a new Chat GenAI button. When this button is clicked, a new interface opens in thr right column of the dashboard:

At the top of this Navigation are two selections:

  • Action Type: This specifies the Connector to be used in your Action

  • HealthCheck Action: When checked, the Action will be built as a HealthCheck Action. The output will be a Tuple, first value is Boolean (pass/fail) and the 2nd value is the result.

At the bottom of the Navigation is the chat box where we described the Action that is being built.

Creating an Action

Once you have selected the type of action, we can begin generating code.

  • Type a complete sentence or two of what you would like your Action to do.

  • Describe any input parameters, whether or not they are required or not, and their initial values.

Example: For an AWS Action, you could say "list all the S3 buckets that are in region, where region is a required parameter." Chat GPT will take this input and generate the Python code to complete this action.

When the code has been created, open the Configurations tab, and add the configurations needed. In this example, we need to add an AWS credential, and a region. Upon execution, the Action will return a list of Buckets in the region:

Modifying your Action

If you generated Action is not exactly what you need, continue the chat to modify your Action. You may wish to add another input parameter, or slightly change the output of the Action. For example, we could make two modifications to the Action above with the following prompt:

"Return each bucket as a dict with the bucket name and the created date. Add a filter input that returns buckets with that string in the name."

This returns an Action with 2 inputs - Region and Filter. On running this Action we can get all Buckets with 'unskript' in the name:

Testing your Action

ChatGPT is not perfect, and yur Action may not do exactly what you expected. This is why testing your Action is very important.

Common errors:

  • AWS: ChatGPT often misses that a query requires a region_name parameter. If you know that your AWS query is region specific, include region details in your prompt.

  • Syntax errors: These can often be resolved by feeding the error into the chat.

  • F Strings: ChatGPT can try some elegant things, but sometimes generates code that reuse the same quote, breaking the f statement:

print(f' - {dashboard['title']}')

If your generated Action throws an error, often youc an just paste in the error message, and the next version will resolve the issue.

ChatGPT Tips

In order to interact with ChatGPT's API, you will need an from OpenAI.

The default model is GPT-4. You can find the latest models at .

API key
OpenAI
Resolving Common issues
A new GenAI Action
Results from a generated Action
Modified Action