DEV Community

Cover image for [Agentica] Every TypeScript Developer is an AI Developer
Jeongho Nam
Jeongho Nam

Posted on • Edited on

99 13 13 12 13

[Agentica] Every TypeScript Developer is an AI Developer

1. Preface

Create TypeScript classes, and transform them into AI chatbots.

From now on, every TypeScript developer can become an AI developer.

TypeScript developers, let us become AI developers with @agentica.

Agentica

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

const agent = new Agentica({
  vendor: {
    model: "gpt-4o-mini",
    api: new OpenAI({ apiKey: "********" }),
  },
  controllers: [
    {
      protocol: "class",
      application: typia.llm.application<BbsArticleService, "chatgpt">(),
      execute: new BbsArticleService(),
    },
  ],
});
await agent.conversate("I want to write an article.");
Enter fullscreen mode Exit fullscreen mode

2. Agentica Framework

@agentica is a framework specialized in LLM function calling.

You can provide functions through TypeScript class types. If you create the FileSystem class below and integrate it with @agentica, it becomes a filesystem chatbot. You can manage your filesystem through conversational text in the chatbot.

If you simultaneously provide multiple TypeScript classes such as GoogleScholarService, NaverNewsService, and NotionService, your AI agent can write a Notion document 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 write them in Notion, the AI agent will execute these tasks.

Simply define your TypeScript classes, and you can create any AI agent you desire.

import fs from "fs";

export class FileSystem {
  public __dirname(): string {
    return __dirname;
  }

  public readdir(input: {
    path: string;
    options?:
      | {
          encoding: "utf-8";
          withFileTypes?: false | undefined;
          recursive?: boolean | undefined;
        }
      | "utf-8"
      | null;
  }): Promise<string[]> {
    return fs.promises.readdir(input.path, input.options);
  }

  public readFile(input: { path: string }): Promise<string> {
    return fs.promises.readFile(input.path, "utf8");
  }

  public writeFileSync(input: { 
    file: string; 
    data: string;
  }): Promise<void> {
    return fs.promises.writeFile(input.file, input.data);
  }
}
Enter fullscreen mode Exit fullscreen mode

3. Enterprise Demonstration

Some may wonder: Don't the BbsArticleService or FileSystem classes have only a few functions? Is this merely a toy project that functions well in limited scenarios? Is it possible to create an enterprise-level chatbot with @agentica?

The answer is yes, it is indeed possible to create enterprise-grade chatbots.

Here is an enterprise-level shopping mall chatbot comprising 289 API functions. It supports most features of standard e-commerce platforms, and as demonstrated, it operates without issues.

For reference, @agentica can also acquire functions from Swagger/OpenAPI documentation. The demonstration below originates from a @samchon/shopping-backend.

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

const agent = new Agentica({
  model: "chatgpt",
  vendor: {
    api: new OpenAI({ apiKey: "*****" }),
    model: "gpt-4o-mini",
  },
  controllers: [
    {
      protocol: "http",
      name: "shopping",
      application: HttpLlm.application({
        model: "chatgpt",
        document: await fetch(
          "https://shopping-be.wrtn.ai/editor/swagger.json",
        ).then((r) => r.json()),
      }),
      connection: {
        host: "https://shopping-be.wrtn.ai",
        headers: {
          Authorization: "Bearer *****",
        },
      },
    },
    {
      protocol: "class",
      name: "counselor",
      application: typia.llm.application<ShoppingCounselor, "chatgpt">(),
      execute: new ShoppingCounselor(),
    },
    {
      protocol: "class",
      name: "policy",
      application: typia.llm.application<ShoppingPolicy, "chatgpt">(),
      execute: new ShoppingPolicy(),
    },
    {
      protocol: "class",
      name: "rag",
      application: typia.llm.application<ShoppingSearchRag, "chatgpt">(),
      execute: new ShoppingSearchRag(),
    },
  ],
});
await agent.conversate("I want to buy a MacBook Pro");
Enter fullscreen mode Exit fullscreen mode

4. Principles

If you are not familiar with AI, you may wonder how @agentica can accomplish everything through functions.

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

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

5. Next Article

https://dev.to/samchon/every-backend-developer-is-a-great-ai-developer-338m

Every backend developer is also 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.

Let's take swagger.json file to the @agentica, so that make an AI chatbot executing the API functions during the conversation.

Quadratic AI

Quadratic AI – The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo 📊✨

Top comments (4)

Collapse
 
samchon profile image
Jeongho Nam • Edited

Traffic is growing so much, and many people are bookmarking, but no one is commenting, so it's boring.

Do you have any articles you'd like to read at the next time?

  1. Every backend developer is also an AI developer.
  2. I succeeded to make a shopping mall AI agent with 289 API functions that no one could do.
  3. New AI paradigms: Compiler Driven Development and Document Driven Development
  4. Just about @agentica framework
Collapse
 
ritzdev profile image
mohammad shareef • Edited

This article is good, we can also use transformers (hugging face) and use any pretrained models(eg: BERT, GPT) based on the use case.

Collapse
 
samchon profile image
Jeongho Nam

You may like our roadmap - wrtnlabs.io/agentica/docs/roadmap/...

Collapse
 
hans_joo_109bc627faa7b0dc profile image
HANS JOO

우와 신기합니다. 항상 좋은글 감사합니다!

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup 🚀

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, cherished by the supportive DEV Community. Coders of every background are encouraged to bring their perspectives and bolster our collective wisdom.

A sincere “thank you” often brightens someone’s day—share yours in the comments below!

On DEV, the act of sharing knowledge eases our journey and forges stronger community ties. Found value in this? A quick thank-you to the author can make a world of difference.

Okay