Stax.ai CX Automation SDK
Project description
Stax.ai CX Automation SDK
This project is created and maintained by Stax.ai, Inc.. This is proprietary to Stax.ai, Inc. Unauthorized use, copy, license, or modification of this project and all associated source code is strictly prohibited.
About
...coming soon...
Installation
pip install stax_cx_automation_sdk
Usage
Create a Stax.ai automation
Do this by creating a database entry manually that matches the schema for Automation
.
Write your automation app
import os
from stax_cx_automation_sdk import def_automation
# This is the `_id` of the automation from the DB and the token user for cross-internal system communication
@def_automation(os.getenv('AUTOMATION_ID'), os.getenv('INTERNAL_KEY'))
def app(team:str, task:str, project:str, config:list[dict]):
'''
Your custom automation app. Is provided the following arguments:
- team [str]: Team ID string
- task [str]: Task ID string
- project [str]: Project ID string
- config [list[dict]]: Pipeline configuration for automation
Return an optional string representing the message to log.
If there is an error, raise an exception with a nice human-readable error message to show up on the log.
'''
# Put your automation functionality here
# ...
# Raise an exception to stop the pipeline and flag the task
raise Exception("Oops, something went wrong!")
return "The required action has been completed" # Replace this with something more relevant, for example: 'Email sent to: naru@stax.ai'
Testing your automation
To test your automation, simply comment out the @def_automation
line and call the app
function with the appropriate input arguments.
Deploy your automation
- Navigate to the
Project CX
Google Cloud topic. - Create a Pub/Sub topic with the name:
auto-{NAME}
, for exampleauto-send-email
. - Create a Cloud Function with the same name as the Pub/Sub topic.
- Set the trigger type to
Cloud Pub/Sub
. - Pick the previously created Pub/Sub topic.
- Select the appropriate memory, CPU, timeout, and concurrency settings.
- Select the
App Engine default service account
. - Add the runtime environment variable:
AUTOMATION_ID
andINTERNAL_KEY
. - Ensure your entry file is called
main.py
and that you have arequirements.txt
file with your dependencies. - Load your source code as a ZIP and configure the function appropriately (make sure the entry-point is set.)
- Test your function, and deploy it!
- Set the
url
property in the automation to your Pub/Sub topic name.
Developers
Building this SDK
[For Stax.ai, Inc. developers only]
- Increment the minor/major version in
setup.py
. python3 -m pip install --upgrade build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file stax_cx_automation_sdk-0.0.2.tar.gz
.
File metadata
- Download URL: stax_cx_automation_sdk-0.0.2.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f18518b6299ad06d28f4cd72f3b61f6e9590c6aa7a6b7de9edc927fa37ccecd |
|
MD5 | c4104f2430d5d863796003f2e1a05266 |
|
BLAKE2b-256 | 326def79318f3e1cda68a19141c64ecacd8f29736a7a362d1ceab5afe6f8240d |
File details
Details for the file stax_cx_automation_sdk-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: stax_cx_automation_sdk-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54dff778d5f8f3e6b17b1ff8bc76d5d991ef3a65b6e5c4e647563e583c8523e1 |
|
MD5 | 311bd461f0cd80ed443fccd757b132da |
|
BLAKE2b-256 | 65b6e014fdb7bc66e9563cc340e7f917769898e6fdd0b7d8d771ab399645591c |