Building bots leveraging serverless architecture

51
Building bots with Serverless architecture Moving faster in the bot landscape and reducing operational costs Twitter: @dkcwd

Transcript of Building bots leveraging serverless architecture

Page 1: Building bots leveraging serverless architecture

Building bots with Serverless architecture Moving faster in the bot landscape and reducing operational costs

Twitter: @dkcwd

Page 2: Building bots leveraging serverless architecture

Purpose of the session On 21st August 2016 the Sydney Bots Meetup group was founded on meetup.com by Melinda Coombes, Cameron Barrie and Craig Edwards.

See: https://www.meetup.com/Sydney-Bots-Meetup

It’s an ideal time for this group to begin since conversational UI, bots and AI are in the spotlight.

Alongside those topics, interest is continuing to grow in serverless architecture and how it can be leveraged to build new, scalable functionality at speed and on budget.

This session will: provide an overview of the bot and AI ecosystem for context provide an overview of what Serverless architecture is and how it can benefit your project introduce you to some existing examples of what Serverless chat bot code looks like today

Page 3: Building bots leveraging serverless architecture

Reminder about this session The slides will be made available after the session and you are more than welcome to share them if you find them useful.

We have people attending from all manner of different backgrounds with different levels of experience and you’re welcome to ask questions and share knowledge after the session.

Let’s get started….

Page 4: Building bots leveraging serverless architecture

First a little background on the bot landscape

Page 5: Building bots leveraging serverless architecture

April 2016 – Bot hype landscape As at 26th April 2016:

LinkedIn Pulse returned 5,096 results for posts using the search term ‘bots’.

While there are other sources this one was remarkably convenient….

Some refer to a bot experiment which was started and shut down in March 2016.

Test your bot knowledge: Do you know which experiment they refer to?

Page 6: Building bots leveraging serverless architecture

@TayandYou This bot learned well from all the wrong people

Screenshot excerpt taken from source: http://www.telegraph.co.uk/technology/2016/03/24/microsofts-teen-girl-ai-turns-into-a-hitler-loving-sex-robot-wit/

Page 7: Building bots leveraging serverless architecture

June 2016 – update Bots seem to be even more popular this month.

As at 28th June 2016:

LinkedIn Pulse had 6,855 results for the search term ‘bots’.

3,759 of those articles were posted within 6 months of that date.

Page 8: Building bots leveraging serverless architecture

October 2016 – update And again more popular this month.

As at 6th October 2016:

LinkedIn Pulse had 9,395 results for the search term ‘bots’.

4,332 of those articles were posted within 6 months of that date.

Page 9: Building bots leveraging serverless architecture

October 2016 – a different search term

Ok, so bots are commonly mentioned in business/technical articles.

What if we change the search term to something like ‘artificial intelligence’?

As at 6th October 2016:

LinkedIn Pulse had 280,706 results for the search term ‘artificial intelligence’.

15,345 of those articles were posted within 1 month of that date.

Page 10: Building bots leveraging serverless architecture

Make sure you know the difference Bots and AI are not the same thing….

AI is exciting and can promote a more dynamic experience when it is leveraged to drive a conversational UI

Page 11: Building bots leveraging serverless architecture

Bots are not a new thing of course Internet Relay Chat (IRC) bots have been around since the late 1980s to handle basic administrative tasks in chat rooms

The dark side of the bot landscape is made up of botnets, spambots and other malware designed for one illicit reason or another

Page 12: Building bots leveraging serverless architecture

The good, boring and worrying bot things

Good Relevant and timely access to information and services with lower barriers for transactions

Boring Simple “canned response” bots seem dull or lack relevance next to well trained AI driven bots

Worrying Concerns for some people thinking they may be replaced at work or overloaded with new spam

Page 13: Building bots leveraging serverless architecture

Example of a “canned response”

Yes! Let’s do this….

Page 14: Building bots leveraging serverless architecture

We need a custom bot, where do we start?

Page 15: Building bots leveraging serverless architecture

Hmmmm….how likely is that question? It’s more likely that you’ll start with a question about how to solve a given problem

It may be that a solution using conversational UI seems like a good fit for solving a challenge gracefully or providing high value

There are of course those who simply wish to experiment or simply wish to try building something for the experience of doing it

Page 16: Building bots leveraging serverless architecture

Ask, “Why?” before building anything

Why would we do this?

Solving a problem

Solve the problem

Just experimenting

Use results and iterate

Page 17: Building bots leveraging serverless architecture

The, “How?” will be easier then

How will we do this?

Build it ourselves

Plan, execute and iterate

Outsource it

?

Page 18: Building bots leveraging serverless architecture

Many AI bots need a little human help

If your bot needs to appear clever, perhaps you should fake it until you actually make it?

http://www.bloomberg.com/news/articles/2016-04-18/the-humans-hiding-behind-the-chatbots

The article explains some companies have dedicated teams who fill the gaps in automation.

Duties include intercepting messages to potentially select or alter the automated response.

This can of course be a powerful way of learning more about the problems you need to solve.

For now the #botpocalypse won’t happen on it’s own….developers (and humans), it needs you!

Page 19: Building bots leveraging serverless architecture

Do we need to start building from scratch?

Page 20: Building bots leveraging serverless architecture

No, many AI platforms already exist

Example: BBX.ai has been developed by Boomworks right here in Sydney

Page 21: Building bots leveraging serverless architecture

What if we decide to do it ourselves….

Page 22: Building bots leveraging serverless architecture

How important is speed of innovation? Greater variety and availaility of 3rd party services and APIs inspire alternative ways to present information and create opportunties to interact

Product release and feedback loops can be significantly accelerated so there is greater potential to disrupt and be disrupted

Page 23: Building bots leveraging serverless architecture

Helping teams move faster If I was starting a new bot project today then I would be looking into the variety of frameworks which leverage serverless architecture

That statement may not make sense for everyone right now so let’s take a moment to talk about what that means

Page 24: Building bots leveraging serverless architecture

An introduction to serverless architecture

Page 25: Building bots leveraging serverless architecture

A quick summary of what has happened The cloud Many people were excited about “the cloud” because it meant that virtual servers could be used when desired and the number of servers could be increased or decreased on the fly.

That’s a lot easier than working with hardware which used to take a long time to build and configure.

Remember: “There is no cloud, it’s just someone else’s computer!”

Page 26: Building bots leveraging serverless architecture

A quick summary of what has happened Application containers There has been a lot of buzz around “application containers” because many aspects of virtual server administration can be simplified.

You can take just what your application needs to run and “put it in a container” which can be deployed on a server.

Remember: “Containers simplify some situations however, server administration is potentially still required”

Page 27: Building bots leveraging serverless architecture

A quick summary of what has happened Serverless architecture The word “serverless” has led to some confusion because it means different things to different people.

The next few slides will clarify the reasons for some of the confusion. Remember: “When someone says they are using a serverless approach they may mean they utilise a hosted application container designed to run a specific function on demand in a vendor cloud”

Page 28: Building bots leveraging serverless architecture

An approach not just a framework

“Serverless” application architecture provides an approach you can follow to build applications without managing servers or containers

The Serverless framework is one of many projects which make it easier for teams to get started with developing and maintaining functionality which leverages a serverless approach

Page 29: Building bots leveraging serverless architecture

No servers and configuration to manage?

When you adopt serverless programming paradigms you may not need to maintain servers or containers

Note: There is still some work to do in terms of configuration and that’s one of the reasons why frameworks like the Serverless framework exists

Page 30: Building bots leveraging serverless architecture

Why should I care? You might reduce your spend on infrastructure by avoiding charges for idle servers (including container hosts) and increase the rate at which your team can develop/deploy new features

Subject to the usage policy of a given “Function as a Service” provider, there may be significant benefits for you in terms of scalability in addition to the points mentioned above

Page 31: Building bots leveraging serverless architecture

So you’re talking about AWS Lambda?

At the AWS Summit in Sydney this year there was a lot of excitement surrounding serverless programming paradigms using AWS Lambda.

Other vendors supporting “Function as a Service” offerings are:Azure Functions,Google Cloud Functions IBM Open Whisk

Page 32: Building bots leveraging serverless architecture

Concerns about development effort

The examples shown at the AWS Summit were interesting however there was something about having to leverage the AWS interface through your browser which felt a little backwards and off-putting

Serverless framework interested me because I could write code in my favourite IDE, deploy changes and manage orchestration of resources via a simple command line tool

Page 33: Building bots leveraging serverless architecture

Concerns about “vendor lock-in”?

The use cases were compelling at the AWS Summit and there was plenty of buzz around how to get started

There were also plenty of attendees concerned about the potential for issues related to “vendor lock-in”

That is another reason why the Serverless framework interested me

Page 34: Building bots leveraging serverless architecture

Introducing Serverless framework

Page 35: Building bots leveraging serverless architecture

Introducing Serverless framework

The project exists at: https://github.com/serverless/serverless The first commits to the project were made on April 21st, 2015 Working toward supporting major vendors reducing lock-in fear

Page 36: Building bots leveraging serverless architecture

Are there example projects?

Yes! You can find out more here https://github.com/serverless

In particular check out: serverless-graphql-blog

Note: Elliot Spira created an excellent tutorial on creating a HipChat Connector

Check it out here: https://bitbucket.org/gorillastack/serverless-hipchat-connect

Page 37: Building bots leveraging serverless architecture

Can you show me a reference diagram?

Yes! I’ll show you one for a single page JS application on the next slide.

The “serverless backend” is based on serverless-graphql

See: https://github.com/serverless/serverless-graphql

Page 38: Building bots leveraging serverless architecture
Page 39: Building bots leveraging serverless architecture

Do I have to build and deploy a frontend?

No! Some of the starter projects have a frontend component which you can deploy if you wish.

You may choose to use the framework just to focus on backend functionality.

Page 40: Building bots leveraging serverless architecture

What is the workflow like? Vendor configuration before anything else Initial project setup via CLI Development Local testing Deployment of endpoints and functions via CLI Rinse & Repeat

Page 41: Building bots leveraging serverless architecture

Vendor configuration Assuming you start out with AWS….

Make sure you have a AWS account and create an IAM user for working with your serverless projects via the Serverless framework

You need your Access Key ID and Secret Access Key for the IAM user

Page 42: Building bots leveraging serverless architecture

Hmmm I haven’t done that before….um

Don’t worry, here is an awesome tutorial to help you get started with all aspects of working with the Serverless framework.

Get in there and have a go. Before you know it you’ll be working your way around the command line interface deploying endpoints like a pro!

Check out: http://justserverless.com/blog/your-first-serverless-application/

Page 43: Building bots leveraging serverless architecture

A tip once you’re up and running If you don’t already, consider using a tool like Postman to create some tests for your API end points.

Postman makes it easy to create request collections and capture example responses for use during development. If used effectively it can be a leveraged as part of a lean integration test suite.

Page 44: Building bots leveraging serverless architecture

Create request collections with Postman

See: https://www.getpostman.com

Page 45: Building bots leveraging serverless architecture

Ok so back to bots, how does that work?

Page 46: Building bots leveraging serverless architecture

Here’s some additional good news

There are loads of examples already available which you can learn from and potentially use as a way to get started

From AWS: https://github.com/awslabs/aws-serverless-chatbot-sample

Page 47: Building bots leveraging serverless architecture

Here’s some additional good news

There are loads of examples already available which you can learn from and potentially use as a way to get started

From Elliott Spira again: http://blog.gorillastack.com/serverless-framework-local-development-environments

Page 48: Building bots leveraging serverless architecture

From here Remember Serverless framework is just one of many projects that are evolving

With Serverless framework you can run applications locally without using AWS if you want to experiment a little more before deploying

See the plugins section on the Serverless framework README.md https://github.com/serverless/serverless#plugins

Page 49: Building bots leveraging serverless architecture

From here Check out the Sydney Serverless Meetup Group:

http://www.meetup.com/Sydney-Serverless-Meetup-Group

Page 50: Building bots leveraging serverless architecture

From here Be part of the community, come join us on the Slack channel at:

https://letsgoserverless.stamplayapp.com

Page 51: Building bots leveraging serverless architecture

Enjoy and share what you do….

I’m on Twitter: @dkcwdLinkedIn: https://au.linkedin.com/in/daveclarkprofile