I built a Virtual Assistant on an iPad — here’s how I did it.

Duncan Anderson
Barnacle Labs
Published in
6 min readNov 30, 2020

--

Building Virtual Assistants is tough. The work frequently includes some form of AI environment, bespoke servers for custom logic, caching servers and databases that provide dynamic content to your VA, etc. That leads, often, to a development environment that’s quite complex — not something for an iPad, you would think.

But it turns out, that with the help of some very cool apps, an iPad can be a surprisingly effective machine. I’d like to share with you how this seemingly impossible task can be achieved…

As the basis of our VA we can use Rasa, an open source conversational system. Rasa’s training data can be specified entirely in plain text files, which makes it especially malleable to being trained from an iPad (can you see where I’m going with this?)

Complex Virtual Assistants need careful change control and version management — they are big, complex pieces of software, after all. For this reason, at Humanise.AI we’re fond of plain text training data and dialog definitions that can be committed to, and managed within, Git. Graphical builders are nice, but are all too difficult to manage at scale. We’ve found that a Git-centric workflow is best when things get complex and big.

To support our use of Rasa, we’ll also be using four very special iPad apps. None of these apps is free, but they’re all top class and worth every penny. Make a purchase and you’ll be supporting indie app businesses, with your money going directly to those whose livelihoods depend on custom such as ours. I can personally testify for the quality of each of these apps — top class stuff!

The apps are:

  • Working Copy — a git client for iOS
  • Textastic — a text editor for iOS
  • Blink — an SSH and Mosh terminal for iOS
  • Secure ShellFish — integrates the file system of remote servers into your local iOS file system

I highly recommend a keyboard/trackpad case — Apple’s Magic Keyboard, or Logitech’s Combo Touch. Using the trackpad transforms the iPad — you can control everything from the keyboard.

🤖 Rasa

To get started, we first need to create a Rasa development environment on a computer (not our iPad). You might use your laptop for this, or you might choose to commission a server from one of the cloud providers like Amazon, Google, IBM, Digital Ocean, etc. As your Rasa model gets larger, training time can lengthen quite a bit on a simple laptop, so a cloud server is a good idea. You can even add GPUs to it, to further speed up training time, if you wish.

The Rasa installation guide will get you up and running.

We’re not going to be using the computer you install Rasa onto directly, rather we’ll be logging in to it remotely from our iPad. You can, of course, add miscellaneous additional servers as your needs dictate — a Redis cache, a database, etc. The sky’s the limit, as they say.

👨‍💻 Enabling remote login

Normally we’d log in remotely to a computer using SSH, but because we’re planning to do everything on an iPad, we’ll be using Mosh instead. SSH is great, but requires a stable network connection. Mobile devices have a habit of dropping network connections and iOS also has a habit of killing backgrounded apps (and thus the connetion). Mosh solves these problems and provides a rock-solid login that persists across network changes and our session being killed by iOS.

So, follow the instructions on the Mosh website to install that and activate remote log in on your computer. You’ll also need to open UDP ports 60000–61000 to allow the Mosh traffic through your firewall.

Once you’ve got Mosh setup and running, you can load the Blink app on your iPad. Enter the command config and you should be presented with a screen like this

From here you can setup your server by adding its IP address and login details. Blink can generate a public/private key pair and even load your public key onto your remote computer for you. This means that only the device holding your private key (in this case, your iPad) will be able to connect to your computer. Using a key is more secure than simple userId’s, as it avoids the risk of someone brute force guessing your password.

Once your public key is uploaded, exit the config dialog and enter mosh my-computer, where my-computer is the name you just setup in the blink config. If everything is working, you should be presented with a very exciting screen looking something like this, which means you’ve successfully logged in to your computer from your iPad 🙌

Now that we’re logged in to our computer from our iPad, we can issue the command rasa train to train our AI and then rasa shell to test it - all from an iPad!

Now that’s a good first step, but we also need to be able to edit our training data. For this, there are two slightly different workflows.

👋 Git-centric workflow

The git-centric workflow uses a git server (eg GitHub or GitLab) as the intermediary between your iPad and your computer.

In this workflow you clone your repository onto both your computer and iPad. Changes made on the iPad are pushed to git and then pulled to your computer.

This is made possible with Working Copy, a really excellent Git app for iOS. Using this you can clone your Rasa project, commit changes and push them back to your git server.

Even better, Working Copy is a file provider to the iOS Files app, meaning you can see your Git repository natively through the Files app and also apps like the excellent Textastic text editor.

Textastic is a rather special text editor, as it supports in-place editing. This means you can simply open a file from Working Copy in the app and it’s saved straight back to Working Copy when you make changes. Just choose ’Add External Folder’ and choose your Working Copy project.

I’ve found that a Git-centric workflow works really well.

🤝 Direct-editing workflow

The direct-edit workflow is a little different, and arguably easier, in that we don’t need an intermediary git server to move files between our computer and our iPad. Instead, we can edit files on our remote computer directly from our iPad. This is enabled through the Secure ShellFish app. Committing to git should very much still be part of our workflow — it’s just that we don’t need to use git to mediate between computer and iPad.

Secure ShellFish includes what I can only describe as black magic, in that it integrates files on a remote server into the local iOS file system.

Once we’ve setup our server in Secure ShellFish (it, too, can do the public/private key stuff for us), we can open files on our computer directly in Textastic on our iPad. When we make changes, those changes are saved to the original file on our remote computer.

The direct-editing workflow is also really very effective and a little simpler — so is currently my preferred approach.

📺 Summary

What’s remarkable about the apps I’ve mentioned is that they transform an iPad into a surprisingly effective device for development — even for building a sophisticated Virtual Assistant.

I don’t want to do everything on my iPad, but the freedom it provides is amazing. I don’t need a big screen and a noisy, hot computer on my lap all of the time. The ability to get things done with much less stuff is liberating — when travelling or on holiday (hopefully we’ll be able to do such exotic things again next year), for example.

When I think back to my university days, where I cut my programming chops on 80x24 green-screen character terminals, even the small screen size of an iPad can be considered a luxury!

--

--

Duncan Anderson
Barnacle Labs

Eclectic tastes, amateur at most things. Learning how to build a new startup. Former CTO for IBM Watson Europe.