DEV Community

Cover image for Every Backend Developer is a Great AI Developer
Jeongho Nam
Jeongho Nam

Posted on • Edited on

51 10 12 12 10

Every Backend Developer is a Great AI Developer

1. Preface

Bring your Swagger/OpenAPI document, and it transforms into an AI chatbot.

From now on, every backend developer can be an AI developer.

Considering the nature of work that backend developers do, they are actually better positioned for AI agent development than traditional AI/ML engineers.

Backend developers, let's become AI developers with @agentica

import { Agentica } from "@agentica/core";
import { HttpLlm } from "@samchon/openapi";
import OpenAI from "openai";
import typia from "typia";

const agent = new Agentica({
  vendor: {
    model: "gpt-4o-mini",
    api: new OpenAI({ apiKey: "********" }),
  },
  controllers: [
    {
      protocol: "http",
      application: HttpLlm.application({
        model: "chatgpt",
        document: await fetch(
          "https://shopping-be.wrtn.ai/editor/swagger.json",
        ),
      }),
      connection: {
        host: "https://shopping-be.wrtn.ai",
        headers: {
          Authorization: "Bearer ********",
        },
      },
    },
  ],
});
await agent.conversate("I want to write an article.");
Enter fullscreen mode Exit fullscreen mode

2. Agentica Framework

Image description

Recently, my boss showed me Sierra.ai, a $4.5 billion corporation founded by an OpenAI board member. He asked me why we couldn't do something similar and challenged me to prove why he should continue paying my salary.

Looking at Sierra.ai's homepage, they appear to focus on AI agent development for e-commerce and counseling. So I took a swagger.json file from a shopping backend server consisting of 289 API functions and demonstrated shopping AI chatbot to him.

In the demonstration, everything worked perfectly: searching and purchasing products, order and delivery management, customer support with refund features, discount coupons, and account deposits. After the demonstration, my boss said:

Hey, we should open source this.

Let's make our technology world-famous.

import { Agentica } from "@agentica/core";
import { HttpLlm } from "@samchon/openapi";
import typia from "typia";

const agent = new Agentica({
  controllers: [
    HttpLlm.application({
      model: "chatgpt",
      document: await fetch(
        "https://shopping-be.wrtn.ai/editor/swagger.json",
      ).then(r => r.json()),
    }),
    typia.llm.application<MobileCamera, "chatgpt">(),
    typia.llm.application<MobileFileSystem, "chatgpt">(),
    typia.llm.application<MobilePhoneCall, "chatgpt">(),
  ],
});
await agent.conversate("I wanna buy MacBook Pro");
Enter fullscreen mode Exit fullscreen mode

@agentica is a framework specialized in LLM function calling. We developed this technology in 2023, and now we've released it as open source.

Using the @agentica framework, you can provide functions through TypeScript class types and Swagger/OpenAPI documents. By bringing your backend server's OpenAPI document, you can enable conversational interaction with your backend server, executing API functions through natural dialogue.

With a shopping mall backend server, users can search for and purchase products using conversational text. With a GitHub server, you can create an agent that learns from your code and performs live coding. By combining TypeScript classes, you can develop agents that interact with both your mobile device and backend server.

Additionally, if you simultaneously provide multiple OpenAPI documents such as arxiv, newspaper, and notion, your AI agent can write Notion documents by analyzing scholarly papers and news articles. When you ask the agent to analyze recent Korean economic trends, comment on them, organize related papers, and document everything in Notion, the AI agent will execute all these tasks seamlessly.

It's also possible to provide functions from TypeScript classes

3. Backend developers are prepared AI developers

Documentations

Given their typical work, backend developers are actually better positioned to develop AI agents than anyone else, even traditional AI/ML developers.

Consider the shopping mall example. Backend developers design APIs and DTOs while studying and implementing core domain concepts such as SKU (Stock Keeping Unit). For each API and DTO, they write detailed explanations to guide client developers.

These clear definitions and detailed descriptions of API functions and DTO schemas, which backend developers routinely create, serve as ideal AI prompts. In fact, I successfully built a shopping chatbot in just one day by adding descriptions that explained the relationships between API functions.

Backend developers, you're already equipped to become AI developers. Let's develop AI agents using our API design skills. Simply take your swagger.json file, and it can directly transform into an enterprise-grade AI agent.

export class ShoppingSaleController {
  /**
   * List up every summarized sales.
   *
   * List up every {@link IShoppingSale.ISummary summarized sales}.
   *
   * As you can see, returned sales are summarized, not detailed. It does not
   * contain the SKU (Stock Keeping Unit) information represented by the
   * {@link IShoppingSaleUnitOption} and {@link IShoppingSaleUnitStock} types.
   * If you want to get such detailed information of a sale, use
   * `GET /shoppings/customers/sales/{id}` operation for each sale.
   *
   * > If you're an A.I. chatbot, and the user wants to buy or compose
   * > {@link IShoppingCartCommodity shopping cart} from a sale, please
   * > call the `GET /shoppings/customers/sales/{id}` operation at least once
   * > to the target sale to get detailed SKU information about the sale.
   * > It needs to be run at least once for the next steps.
   *
   * @param input Request info of pagination, searching and sorting
   * @returns Paginated sales with summarized information
   * @tag Sale
   *
   * @author Samchon
   */
  @TypedRoute.Patch()
  public async index(
    @AuthGuard() actor: Actor,
    @TypedBody() input: IShoppingSale.IRequest,
  ): Promise<IPage<IShoppingSale.ISummary>>;
}
Enter fullscreen mode Exit fullscreen mode

4. Principles

If you're new to AI, you might wonder how @agentica accomplishes everything through functions.

Conversely, if you're an expert in AI agent development, you might have a different question. Traditional agent development centers around agent workflow graphs, so how does @agentica leverage LLM function calling to achieve similar capabilities?

Visit our framework homepage or read my previous article to understand the key principles of @agentica. These resources will introduce you to new AI development paradigms: "Compiler-Driven Development" and "Document-Driven Development."

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (1)

Collapse
 
driftgeek profile image
driftgeek

This is awesome!

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay