How AI Can Help Scale API Ecosystems

The API ecosystem is facing a serious scalability issue. While current responsibilities associated with designing, coding, and maintaining APIs are still very manageable, we’re likely to see a huge increase in the number of APIs — public and private — over the coming years. Worst of all, almost all of these tasks are performed by humans and seem far too complex to automate. Orlando Kalossakas, Co-Founder at LF.gg, thinks Artificial Intelligence (AI) could be the answer to this problem.

This article is based on Orlando Kalossakas at the 2019 Austin API Summit:

APIs Today

APIs have come a long way since their SOAP roots more than 20 years ago. Nowadays, architectural styles like REST and specification formats like OpenAPI make it easier than ever to build, maintain, and use APIs.

Nevertheless, APIs are very much designed for human usability. Although machines are ultimately the ones executing code and sending or receiving responses, it’s up to humans to provide the instructions necessary for them to do so. As such, it’s no surprise that API owners dedicate so much time to making their APIs intuitive, creating guides and walkthroughs, and improving the Developer Experience (DX) in other such ways.

But what if machines could do more of the work for us? Orlando says this is what makes the OpenAPI specification a “winner”: the fact that it can aid us in design, security, and implementation while automating the creation of documentation, libraries, mock servers, and SDKs thanks to its machine-readable nature.

The Challenges

Although OpenAPI and other specifications already offer considerable automation benefits, we have a long way to go. Humans still steal the spotlight during a large amount of the API development process, and we continue to invest heavily in Developer Experience activities.

One issue with the current approach to automated API resource generation is that it simply doesn’t cut it sometimes. Orlando recalls a quote from Microsoft developer Darrel Miller: “Code generation can make building code really easy, but it can also make it really easy to build poorly architected code.”

A bigger, more significant challenge lies in the fact we still largely rely on humans for the development and usage of APIs. While this is still manageable in an ecosystem of 20 to 30 thousand public APIs, what will happen when this number scales to 500 thousand or more? “Will everyone become an API worker?” Orlando asks.

Most likely not, but perhaps Artificial Intelligence can help us tackle these challenges into the future…

How Can AI Enhance the API Ecosystem?

In theory, there are quite a few verticals in the API space where AI could prove useful. In particular, Orlando highlights four spaces:

  • Design
  • Implementation
  • Reporting and Security
  • Developer Experience

For example, in the design vertical, Orlando sees the potential for feeding a machine learning algorithm with thousands upon thousands of specification documents. With time, an algorithm like this might be able to generate its own specification based on a given command. AI technology will likely prove useful in replicating a whole variety of straightforward, human-based tasks that appear in the design process.

In addition, Orlando believes AI might be able to tackle issues such as API discovery (within applications), use case identification, and even code generation.

In terms of Developer Experience, Orlando points out the possibility of AI-powered chatbots. While many of us hate the primitive chatbots available nowadays, this is largely due to the fact that they simply can’t understand our issues. However, with more advanced AI-based decision-making algorithms, chatbots might genuinely help solve issues related to onboarding or Developer Experience.

The Status Quo of AI and APIs

Orlando says we have taken the first steps to adopt AI in the API world with data standardization efforts such as Hydra and Supermodel. With this, we are slowly moving towards data infrastructures that are increasingly machine-readable — which is the first step in introducing AI.

Additionally, there are several projects hoping to improve the coding of APIs with AI. These include Rice University’s Bayou, which uses a neural network to evaluate your Java code and optimize it with best practices. A similar is Kite.com, which offers Python code completion “on steroids” with the help of AI.

Another service Orlando makes note of is PullRequest, a marketplace for reviewing code. While it doesn’t yet use AI, the vast amounts of code optimization data they are able to collect might one day be repurposed to this end.

Final Thoughts

All in all, we are still a far way from “Alexa, build us an API.” However, there are definite use cases for Artificial Intelligence within the API ecosystem, especially in areas such as design, coding, security, and DX. Orlando believes these AI-based solutions will become increasingly important as we create thousands upon thousands of new APIs, and continue to push existing automation tools to their limits.