Agentica 소개
최근 LLM(대형 언어 모델) 기반 애플리케이션이 빠르게 발전하고 있으며, 다양한 방식으로 AI를 활용하는 방법이 연구되고 있습니다. 하지만 많은 AI 개발자들이 복잡한 에이전트 기반 시스템을 구축하는 데 어려움을 겪고 있습니다. Agentica는 이런 문제를 해결하기 위해 탄생한 라이브러리로, 복잡한 워크플로우 없이도 Swagger/OpenAPI 문서 또는 TypeScript 클래스 타입을 기반으로 자동으로 LLM Function Calling을 수행할 수 있도록 설계되었습니다.
Agentica의 주요 기능은 다음과 같습니다:
-
Swagger/OpenAPI 기반 LLM Function Calling
-
TypeScript 클래스 기반 API 정의 및 호출
-
다중 에이전트 오케스트레이션 지원
-
RAG(Retrieval-Augmented Generation) 최적화 기능 예정
-
PostgreSQL 및 OpenAI Vector Store 연동 예정
Agentica의 주요 기능
간단한 에이전트 구성
Agentica의 설정 과정은 매우 간단합니다. Swagger 문서를 가져오거나 TypeScript 클래스를 정의하는 것만으로도 LLM이 자동으로 API를 호출할 수 있습니다:
import { Agentica } from "@agentica/core";
import typia from "typia";
const agent = new Agentica({
providers: [
await fetch(
"https://shopping-be.wrtn.ai/editor/swagger.json",
).then(r => r.json()),
typia.llm.application<ShoppingCounselor>(),
typia.llm.application<ShoppingPolicy>(),
typia.llm.application<ShoppingSearchRag>(),
],
});
await agent.conversate("I wanna buy MacBook Pro");
다중 에이전트 오케스트레이션
Agentica는 여러 개의 에이전트를 함께 조합하여 사용할 수 있습니다. 이를 통해 사용자 질문을 다양한 API와 연결하여 더 정교한 응답을 생성할 수 있습니다:
import { Agentica } from "@agentica/core";
import typia from "typia";
import OpenAI from "openai";
class OpenAIVectorStoreAgent {
/**
* RAG(Vector Retrieval) 기반 검색을 수행합니다.
*
* @param props 검색 키워드
*/
public async query(props: {
keywords: string;
}): Promise<IVectorStoreQueryResult> {
// 특정 벡터 DB에서 검색 수행
}
}
class ShoppingRecommendationAgent {
/**
* 쇼핑 관련 추천을 수행합니다.
*
* @param props 사용자 질문
*/
public async recommend(props: {
query: string;
}): Promise<string> {
// 추천 상품 검색 로직
}
}
const main = async (): Promise<void> => {
const api = new OpenAI({ apiKey: "YOUR_OPENAI_API_KEY" });
const agent = new Agentica({
model: "gpt-4o-mini",
context: { api },
controllers: [
{
protocol: "class",
name: "vectorStore",
application: typia.llm.applicationOfValidate<
OpenAIVectorStoreAgent,
"chatgpt"
>(),
execute: new OpenAIVectorStoreAgent(),
},
{
protocol: "class",
name: "shoppingRecommendation",
application: typia.llm.applicationOfValidate<
ShoppingRecommendationAgent,
"chatgpt"
>(),
execute: new ShoppingRecommendationAgent(),
},
],
});
await agent.conversate("가장 인기 있는 최신 맥북을 추천해줘.");
};
main().catch(console.error);
WebSocket 기반 RPC 지원
기존 HTTP 기반 API 호출 외에도 WebSocket을 활용한 RPC(Remote Procedure Call) 방식을 지원하여 실시간 상호작용이 가능합니다. 이 기능을 활용하면 AI 챗봇, 실시간 추천 시스템, 동적 데이터 처리와 같은 서비스에서 더 빠르고 효율적인 인터페이스를 구축할 수 있습니다:
import { Agentica } from "@agentica/core";
import typia from "typia";
import WebSocket from "ws";
class ChatSession {
private ws: WebSocket;
constructor(url: string) {
this.ws = new WebSocket(url);
this.ws.on("message", (data) => {
console.log("Received:", data.toString());
});
}
sendMessage(message: string) {
this.ws.send(JSON.stringify({ message }));
}
}
const main = async (): Promise<void> => {
const chatSession = new ChatSession("wss://your-websocket-server.com");
const agent = new Agentica({
model: "gpt-4o-mini",
controllers: [
{
protocol: "ws",
name: "realTimeChat",
application: typia.llm.applicationOfValidate<ChatSession, "chatgpt">(),
execute: chatSession,
},
],
});
await agent.conversate("실시간으로 채팅을 시작해볼까?");
};
main().catch(console.error);
라이선스
Agentica 프로젝트는 MIT License로 공개 및 배포되고 있습니다.
Agentica GitHub 저장소
Agentica API 문서
더 읽어보기
-
Pocket Flow: RAG, (Multi-)Agents 등을 위한, 100줄로 구성된 오픈소스 경량 LLM 프레임워크
-
GenAIScript, Microsoft가 공개한 AI 기반 스크립트 작성 및 자동화를 위한 Javascript 통합 프레임워크
이 글은 GPT 모델로 정리한 글을 바탕으로 한 것으로, 원문의 내용 또는 의도와 다르게 정리된 내용이 있을 수 있습니다. 관심있는 내용이시라면 원문도 함께 참고해주세요! 읽으시면서 어색하거나 잘못된 내용을 발견하시면 덧글로 알려주시기를 부탁드립니다.
파이토치 한국 사용자 모임
이 정리한 이 글이 유용하셨나요? 회원으로 가입하시면 주요 글들을 이메일
로 보내드립니다! (기본은 Weekly지만 Daily로 변경도 가능합니다.)
아래
쪽에 좋아요
를 눌러주시면 새로운 소식들을 정리하고 공유하는데 힘이 됩니다~