Per popular developer request, Amazon has been working on building an officially-supported Python SDK for ASK. The Alexa tools development team released a beta version back in June. Now, the team has announced that the ASK SDK for Python is generally available:
As we shared when we launched the beta version of the SDK, our goal is to reduce the amount of code you need to write to process Alexa requests and responses and to handle other common skill tasks. You can use the following key features:
- Request Handling. Request handling in the SDK makes it easy for you to invoke the right code when Alexa sends you a request. You can write a single handler for multiple Alexa intents, or invoke different handlers based on nearly any request attribute. The ASK SDK for Python also introduces flexible handler registration, allowing you to use either decorators or traditional class-based implementations of handler features.
- Response Building. You can deliver responses to your customers that include text-to-speech, audio and video streams, and cards and other visual elements. Customers will receive one or more of these elements depending on what device they are using. Using the SDK, you can build responses that include all of these elements.
- Attribute Management. You can store and retrieve information at different scopes using attributes in the SDK. Attributes allow you to keep track of what happened so far, and to use this information to determine what happens next. You can define attributes that persist for a single request, for a single customer session, or for the lifetime of your skill.
- Alexa API Calls. You can call nearly any Alexa API from within your skill logic using service clients in the SDK. The service clients automatically inject relevant endpoint and authentication-token information on your behalf.
ASK SDKs are also available for Node.js and Java.