### Install and Start YouTube Search Agent CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/youtube-search.mdx Use this command to launch the Agentica Setup Wizard for creating a YouTube Search Agent. The wizard will guide you through package installation, project setup, controller selection, and API key entry. ```bash npx agentica start youtube-search-agent ``` -------------------------------- ### Install and Start Google Search Agent CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/google-search.mdx Use this command to initiate the Agentica Setup Wizard for creating a Google Search Agent. The wizard will guide you through package installation, project setup, controller selection, and API key entry. ```bash npx agentica start google-search-agent ``` -------------------------------- ### Start Notion Agent Setup with Agentica CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/notion.mdx Use this command to initiate the Agentica Setup Wizard for creating a Notion agent. The wizard will guide you through package installation, project setup, controller selection, and API key entry. ```bash npx agentica start notion-agent ``` -------------------------------- ### Agentica Setup Wizard Interactive Prompt Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/cli.mdx This is an example of the interactive setup wizard that appears when running the 'npx agentica start' command. It prompts for package manager, project type, and embedded controllers. ```bash $ npx agentica start my-project-directory ---------------------------------------- Agentica Setup Wizard ---------------------------------------- ? Package Manager (use arrow keys) > npm pnpm yarn (berry is not supported) ? Project Type NodeJS Agent Server > NestJS Agent Server React Client Application Standalone Application React-Native Application ? Embedded Controllers (multi-selectable) (none) Google Calendar Google News > Github Reddit Slack ... ``` -------------------------------- ### Install Google Image Agent with Agentica CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/google-image.mdx Use this command to start the Agentica Setup Wizard for creating a Google Image Agent. The wizard guides through package installation, project setup, controller selection, and API key entry. ```bash npx agentica start google-image-agent ``` -------------------------------- ### Launch Agentica Slack Agent Setup Wizard Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/slack.mdx Use this command to start the Agentica setup wizard for a Slack agent. The wizard will guide you through package installation, project setup, controller selection, and API key entry. ```bash npx agentica start slack-agent ``` -------------------------------- ### Install and Start Gmail Agent CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/gmail.mdx Use this command to launch the Agentica Setup Wizard for creating a Gmail agent. The wizard guides through package installation, project type selection, Gmail controller setup, and API key entry. ```bash npx agentica start gmail-agent ``` -------------------------------- ### Install Node.js Types Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/coding/file-system.mdx Before running the file system agent example, ensure you have the necessary Node.js types installed. ```bash npm install @types/node ``` -------------------------------- ### Start Google Scholar Agent Setup CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/google-scholar.mdx Use this command to initiate the Agentica Setup Wizard for creating a Google Scholar Agent. The wizard guides through package installation, project setup, controller selection, and API key entry. ```bash npx agentica start google-scholar-agent ``` -------------------------------- ### Build and Run React Project Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/index.mdx Navigate to the client directory, install dependencies, and then build and start the React application. ```bash # move to react project folder cd client # install dependencies npm install # build & run npm run build && npm run start ``` -------------------------------- ### Install Github Agent with Agentica CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/coding/github.mdx Use this command to launch the Agentica Setup Wizard for creating a Github Agent. The wizard handles package installation, project setup, controller selection, and API key configuration. ```bash npx agentica start github-agent ``` -------------------------------- ### Start Google Docs Agent with Agentica CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/google-docs.mdx Use this command to launch the Agentica Setup Wizard for creating a Google Docs Agent. The wizard will guide you through package installation, project setup, controller selection, and API key configuration. ```bash npx agentica start google-docs-agent ``` -------------------------------- ### Start Agentica Crawler Agent CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/crawler.mdx Use this command to launch the Agentica Setup Wizard for creating a crawler agent. The wizard will guide you through package installation, project setup, controller selection, and API key entry. ```bash npx agentica start crawler-agent ``` -------------------------------- ### Build and Run NestJS Project Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/index.mdx Navigate to the server directory, install dependencies, and then build and start the NestJS application. ```bash # move to nestjs project folder cd server # install dependencies npm install # build & run npm run build && npm run start ``` -------------------------------- ### Initialize Typia and Install Dependencies Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/react-native.mdx Use the Typia CLI to set up Typia and then install project dependencies. ```bash npx typia setup npm install ``` -------------------------------- ### Agentica Setup Wizard CLI Source: https://github.com/wrtnlabs/agentica/blob/main/README.md Command to initiate the Agentica setup wizard for creating a new project. The wizard guides through package manager selection, project type, and embedded controllers. ```bash $ npx agentica start ---------------------------------------- Agentica Setup Wizard ---------------------------------------- ? Package Manager (use arrow keys) > npm pnpm yarn (berry is not supported) ? Project Type NodeJS Agent Server > NestJS Agent Server React Client Application Standalone Application ? Embedded Controllers (multi-selectable) (none) Google Calendar Google News > Github Reddit Slack ... ``` -------------------------------- ### Install Agentica Google Calendar Agent via CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/google-calendar.mdx Use this command to start the Agentica Setup Wizard for a Google Calendar agent. The wizard will guide you through installation, package manager selection, controller choice, and API key entry. ```bash npx agentica start google-calendar-agent ``` -------------------------------- ### Start Development Server Source: https://github.com/wrtnlabs/agentica/blob/main/CONTRIBUTING.md Execute this command to start the development server, which includes compilation and type checking. ```bash pnpm dev ``` -------------------------------- ### Install Arxiv Search Agent with Agentica CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/arxiv.mdx Use this command to launch the Agentica Setup Wizard for creating an Arxiv Search Agent. The wizard handles package installation, model selection, and API key configuration. ```bash npx agentica start arxiv-search-agent ``` -------------------------------- ### Agentica Setup CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/index.mdx Use the Agentica CLI to start a new project. It prompts for package manager, project type (NodeJS/NestJS server, React client, standalone), and optional embedded controllers like Github or Reddit. ```bash npx agentica start ``` ```bash ---------------------------------------- Agentica Setup Wizard ---------------------------------------- ? Package Manager (use arrow keys) > npm pnpm yarn (berry is not supported) ? Project Type NodeJS Agent Server > NestJS Agent Server React Client Application Standalone Application ? Embedded Controllers (multi-selectable) (none) Google Calendar Google News > Github Reddit Slack ... ``` -------------------------------- ### CLI - npx agentica start Source: https://context7.com/wrtnlabs/agentica/llms.txt The `npx agentica start` command initiates an interactive project scaffolding wizard. This wizard guides users through generating a fully configured Agentica project, allowing them to choose their preferred package manager, project type, embedded connector packages, and environment variables. ```APIDOC ## CLI — `npx agentica start` Interactive project scaffolding wizard that generates a fully configured Agentica project with your choice of package manager, project type, embedded connector packages, and environment variables. ```bash npx agentica start my-agent # Interactive prompts: # ───────────────────────────────────────── # Agentica Setup Wizard # ───────────────────────────────────────── # ? Package Manager # > npm | pnpm | yarn | bun # # ? Project Type # > standalone – single-process agent # nodejs – Node.js WebSocket server # nestjs – NestJS WebSocket server # react – React chat client # react-native – React Native mobile app # nestjs+react – Full-stack (server + client) ``` ``` -------------------------------- ### Install Agentica Core with pnpm Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/manual.mdx Installs the core Agentica library, OpenAPI tools, and Typia using pnpm. Includes the necessary Typia setup command. ```bash pnpm install @agentica/core @samchon/openapi typia pnpm typia setup ``` -------------------------------- ### Detailed AgenticaSelectBenchmark Setup and Execution Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/plugins/benchmark.mdx A comprehensive example of setting up `AgenticaSelectBenchmark`, including agent configuration with external API integration, defining complex scenarios with expected operations, and processing benchmark reports by saving them to disk. This is useful for advanced benchmarking against specific services. ```typescript import { AgenticaSelectBenchmark, IAgenticaSelectBenchmarkScenario } from "@agentica/benchmark"; import { Agentica, IAgenticaOperation } from "@agentica/core"; import { HttpLlm, IHttpConnection, OpenApi } from "@samchon/openapi"; import fs from "fs"; import OpenAI from "openai"; import path from "path"; const mkdir = async (str: string) => { try { await fs.promises.mkdir(str, { recursive: true, }); } catch {} }; const rmdir = async (str: string) => { try { await fs.promises.rm(str, { recursive: true, }); } catch {} }; const main = async (): Promise => { // CREATE AI AGENT const agent: Agentica = new Agentica({ vendor: { api: new OpenAI({ apiKey: "********" }), model: "gpt-4o-mini", }, controllers: [ { protocol: "http", name: "shopping", application: HttpLlm.application({ document: await fetch( "https://shopping-be.wrtn.ai/editor/swagger.json", ).then((res) => res.json()), }), connection: { host: "https://shopping-be.wrtn.ai", headers: { Authorization: "Bearer *****", }, }, }, ], }); // DO BENCHMARK const find = (method: OpenApi.Method, path: string): IAgenticaOperation => { const found = agent .getOperations() .find( (op) => op.protocol === "http" && op.function.method === method && op.function.path === path, ); if (!found) throw new Error(`Operation not found: ${method} ${path}`); return found; }; const benchmark: AgenticaSelectBenchmark = new AgenticaSelectBenchmark({ agent, config: { repeat: 4, simultaneous: 100, }, scenarios: [ { name: "order", text: [ "I wanna see every sales in the shopping mall", "", "And then show me the detailed information about the Macbook.", "", "After that, select the most expensive stock", "from the Macbook, and put it into my shopping cart.", "And take the shopping cart to the order.", "", "At last, I'll publish it by cash payment, and my address is", "", " - country: South Korea", " - city/province: Seoul", " - department: Wrtn Apartment", " - Possession: 101-1411", ].join("\n"), expected: { type: "array", items: [ { type: "standalone", operation: find("patch", "/shoppings/customers/sales"), }, { type: "standalone", operation: find("get", "/shoppings/customers/sales/{id}"), }, { type: "anyOf", anyOf: [ { type: "standalone", operation: find("post", "/shoppings/customers/orders"), }, { type: "standalone", operation: find("post", "/shoppings/customers/orders/direct"), }, ], }, { type: "standalone", operation: find( "post", "/shoppings/customers/orders/{orderId}/publish", ), }, ], }, }, ] satisfies IAgenticaSelectBenchmarkScenario[], }); await benchmark.execute(); // REPORT const docs: Record = benchmark.report(); const root: string = `docs/benchmarks/call`; await rmdir(root); for (const [key, value] of Object.entries(docs)) { await mkdir(path.join(root, key.split("/").slice(0, -1).join("/"))); await fs.promises.writeFile(path.join(root, key), value, "utf8"); } }; main().catch(console.error); ``` -------------------------------- ### Server-side WebSocket RPC Setup Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/websocket/index.mdx Example of a server application setting up a WebSocket server, authorizing clients, and providing an RPC service. ```APIDOC ## Server Application Setup ### Description This code illustrates how a server application initializes a WebSocket server, handles client authorization, and exposes an RPC service (`AgenticaRpcService`) to connected clients. ### Method ```typescript import { Agentica } from "@agentica/core"; import { AgenticaRpcService, IAgenticaRpcListener, IAgenticaRpcService } from "@agentica/rpc"; import { Driver, WebSocketServer } from "tgrid"; import { authorizeToken } from "./internal/authorizeToken"; const server: WebSocketServer< IAuthorizationHeader, IAgenticaRpcService, IAgenticaRpcListener > = new WebSocketServer(); await server.open(3_001, async (acceptor) => { try { await authorizeToken(acceptor.header); } catch (error) { await acceptor.reject(1008, (error as Error).message); return; } const agent: Agentica = new Agentica({ ... }); const listener: Driver = acceptor.getDriver(); const service: AgenticaRpcService = new AgenticaRpcService({ agent, listener, }); await acceptor.accept(service); }); interface IAuthorizationHeader { Authorization: string; } ``` ### Endpoint `ws://localhost:3001` ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication. ### Request Body N/A (RPC calls are method-based, not request body-based) ### Response #### Success Response (101) WebSocket connection established. #### Error Response (1008) Connection rejected due to authorization failure. #### Response Example N/A (Success is a connection upgrade; errors are specific codes) ``` -------------------------------- ### Install Agentica Reddit Agent CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/reddit.mdx Use this command to launch the Agentica Setup Wizard for creating a Reddit agent. ```bash npx agentica start reddit-agent ``` -------------------------------- ### Install Agentica Core with npm Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/manual.mdx Installs the core Agentica library, OpenAPI tools, and Typia using npm. Includes the necessary Typia setup command. ```bash npm install @agentica/core @samchon/openapi typia npx typia setup ``` -------------------------------- ### Install Dependencies for Standalone App Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/manual.mdx Install the necessary packages for a standalone frontend application. This includes core Agentica packages, an OpenAPI specification library, and Typia for type composition. Run `npx typia setup` to configure Typia and install `@typia/unplugin` for compatibility with frontend build tools. ```bash npm install @agentica/core @samchon/openapi typia npx typia setup npm install -D @typia/unplugin ``` -------------------------------- ### Project Setup with Agentica CLI Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/react-native/battery.mdx Use the Agentica CLI to start a new React Native project. Ensure you have Node.js and a React Native development environment set up. ```bash npx agentica@latest start ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/wrtnlabs/agentica/blob/main/CONTRIBUTING.md Run this command after forking the repository to install all necessary project dependencies. ```bash pnpm install ``` -------------------------------- ### Client-side WebSocket RPC Setup Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/websocket/index.mdx Example of a client application connecting to a WebSocket server and invoking a remote method using the `Driver`. ```APIDOC ## Client Application Setup ### Description This code demonstrates how a client application establishes a WebSocket connection and uses a `Driver` to call a remote function (`conversate`) on the server. ### Method ```typescript import { IAgenticaRpcListener, IAgenticaRpcService } from "@agentica/rpc"; import { Driver, WebSocketConnector } from "tgrid"; interface IAuthorizationHeader { Authorization: string; } const connector: WebSocketConnector< IAuthorizationHeader, IAgenticaRpcListener, IAgenticaRpcService > = new WebSocketConnector( { Authorization: "Bearer ********", }, { text: async (evt) => { console.log(evt.role, evt.text); }, describe: async (evt) => { console.log("describer", evt.text); }, }, ); await connector.connect("ws://localhost:3001"); const driver: Driver = connector.getDriver(); await driver.conversate("Hello, what you can do?"); ``` ### Endpoint N/A (This is an SDK usage example, not a direct HTTP endpoint) ### Parameters N/A (Parameters are handled within the SDK methods) ### Request Example ```json { "method": "conversate", "params": ["Hello, what you can do?"] } ``` ### Response #### Success Response Returns the result of the `conversate` function call. #### Response Example ```json { "result": "..." } ``` ``` -------------------------------- ### Install Agentica Core with yarn Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/manual.mdx Installs the core Agentica library, OpenAPI tools, and Typia using yarn. Note: Yarn Berry is not supported. Includes the necessary Typia setup command. ```bash # YARN BERRY IS NOT SUPPORTED yarn add @agentica/core @samchon/openapi typia yarn typia setup ``` -------------------------------- ### Install Google Shopping Connector Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/productivity/google-shopping.mdx Install the necessary package for Google Shopping integration using npm. ```bash npm install @wrtnlabs/connector-google-shopping ``` -------------------------------- ### Install Agentica Package Prompt Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/index.mdx When prompted, confirm the installation of the agentica package to use the CLI. ```bash Need to install the following packages: agentica@version Ok to proceed? (y) ``` -------------------------------- ### Start Agentica Project with pnpm Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/cli.mdx Initiate a new Agentica project using pnpm. The CLI will guide you through selecting project details and embedded controllers. ```bash npx agentica start --manager pnpm ``` -------------------------------- ### Basic Vector Selector Setup Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/plugins/vector-selector.mdx Initialize the vector selector with minimal configuration for basic usage. This is the simplest way to get started with the plugin. ```typescript const selectorExecute = AgenticaVectorSelector.boot({ // Basic configuration options }); ``` -------------------------------- ### Install Agentica Core Dependencies Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/core/index.mdx Installs the necessary packages for @agentica/core, including @samchon/openapi and typia. Remember to run `typia setup` after installation. ```bash npm install @agentica/core @samchon/openapi typia npx typia setup ``` ```bash pnpm install @agentica/core @samchon/openapi typia pnpm typia setup ``` ```bash # YARN BERRY IS NOT SUPPORTED yarn add @agentica/core @samchon/openapi typia yarn typia setup ``` -------------------------------- ### Install Agentica Core with WebSocket (NodeJS) using pnpm Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/manual.mdx Installs Agentica core, OpenAPI, Typia, and additional packages for WebSocket support in NodeJS using pnpm. Includes Typia setup. ```bash pnpm install @agentica/core @samchon/openapi typia pnpm install @agentica/rpc tgrid pnpm typia setup ``` -------------------------------- ### Install Agentica Core with WebSocket (NodeJS) using npm Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/manual.mdx Installs Agentica core, OpenAPI, Typia, and additional packages for WebSocket support in NodeJS using npm. Includes Typia setup. ```bash npm install @agentica/core @samchon/openapi typia npm install @agentica/rpc tgrid npx typia setup ``` -------------------------------- ### Actual Agentica Setup with Pre-Authentication Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/enterprise/shopping.mdx Demonstrates the actual code for setting up Agentica with the shopping backend, including the crucial pre-authentication step. This ensures the user is authenticated before the agent is constructed and used for API calls. ```typescript import { Agentica, assertHttpController } from "@agentica/core"; import ShoppingApi from "@samchon/shopping-api"; import OpenAI from "openai"; // Authentication to the shopping backend server const connection: ShoppingApi.IConnection = { host: "https://shopping-be.wrtn.ai", }; await ShoppingApi.functional.shoppings.customers.authenticate.create( connection, { channel_code: "samchon", external_user: null, href: window.location.href, referrer: window.document.referrer, }, ); await ShoppingApi.functional.shoppings.customers.authenticate.activate( connection, { mobile: "010-1234-5678", name: "John Doe", }, ); // Bearer ******** // Nestia SDK injected the Authorization header console.log(connection.headers?.Authorization); // Agentica with authenticated connection const agent = new Agentica({ vendor: { model: "gpt-4o-mini", api: new OpenAI({ apiKey: "********" }), }, controllers: [ assertHttpController({ name: "shopping", document: await fetch( "https://shopping-be.wrtn.ai/editor/swagger.json", ).then((res) => res.json()), connection, }), ], }); await agent.convert("I wanna buy a Macbook."); ``` -------------------------------- ### Install Agentica Core with WebSocket (NestJS) using pnpm Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/manual.mdx Installs Agentica core, OpenAPI, NestJS packages, RPC, tgrid, and Nestia for WebSocket support in NestJS using pnpm. Includes Nestia setup. ```bash pnpm install @agentica/core @samchon/openapi pnpm install @nestjs/common @nestjs/core @nestjs/platform-express pnpm install @agentica/rpc tgrid pnpm install -D nestia pnpm nestia setup ``` -------------------------------- ### Install Agentica Core with WebSocket (NestJS) using npm Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/manual.mdx Installs Agentica core, OpenAPI, NestJS packages, RPC, tgrid, and Nestia for WebSocket support in NestJS using npm. Includes Nestia setup. ```bash npm install @agentica/core @samchon/openapi npm install @nestjs/common @nestjs/core @nestjs/platform-express npm install @agentica/rpc tgrid npm install -D nestia npx nestia setup ``` -------------------------------- ### Start Agentica Project with npm Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/cli.mdx Use this command to initiate a new Agentica project with npm as the package manager. The CLI will prompt for further configuration. ```bash npx agentica start ``` -------------------------------- ### Agentica Facade Controller Example Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/core/index.mdx Demonstrates the basic structure of the Agentica facade controller. This snippet shows how to import necessary types and initialize an Agentica instance. ```typescript import { Agentica, IAgenticaController, IAgenticaProps, IAgenticaVendor } from "@agentica/core"; import OpenAI from "openai"; import { BbsArticleService } from "./services/BbsArticleService"; const agent: Agentica = new Agentica({ vendor: { model: "gpt-4o-mini", api: new OpenAI({ apiKey: "********", }), } satisfies IAgenticaVendor, controllers: [ { protocol: "class", name: "bbs", application: typia.llm.application(), execute: new BbsArticleService(), } satisfies IAgenticaController, ] } satisfies IAgenticaProps); await agent.conversate("I wanna buy MacBook Pro"); ``` -------------------------------- ### Install Agentica Core with WebSocket (NodeJS) using yarn Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/manual.mdx Installs Agentica core, OpenAPI, Typia, and additional packages for WebSocket support in NodeJS using yarn. Note: Yarn Berry is not supported. Includes Typia setup. ```bash # YARN BERRY IS NOT SUPPORTED yarn add @agentica/core @samchon/openapi typia yarn add @agentica/rpc tgrid yarn typia setup ``` -------------------------------- ### Server WebSocket RPC Setup Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/websocket/index.mdx Sets up a WebSocket server to accept connections, authorize clients, and provide RPC services. Includes agent and listener setup. ```typescript import { Agentica } from "@agentica/core"; import { AgenticaRpcService, IAgenticaRpcListener, IAgenticaRpcService } from "@agentica/rpc"; import { Driver, WebSocketServer } from "tgrid"; import { authorizeToken } from "./internal/authorizeToken"; const server: WebSocketServer< IAuthorizationHeader, IAgenticaRpcService, IAgenticaRpcListener > = new WebSocketServer(); await server.open(3_001, async (acceptor) => { try { await authorizeToken(acceptor.header); } catch (error) { await acceptor.reject(1008, (error as Error).message); return; } const agent: Agentica = new Agentica({ ... }); const listener: Driver = acceptor.getDriver(); const service: AgenticaRpcService = new AgenticaRpcService({ agent, listener, }); await acceptor.accept(service); }); interface IAuthorizationHeader { Authorization: string; } ``` -------------------------------- ### Navigate to Project Directory Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/index.mdx After the project is created, change the directory to the newly created project folder. ```bash cd agentica-test ``` -------------------------------- ### Initialize Bare React Native Project Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/react-native.mdx Use this command to create a new bare React Native project. Refer to the React Native Community CLI documentation for detailed instructions. ```bash npx @react-native-community/cli@15.0.0 init ``` -------------------------------- ### Install Agentica Core with WebSocket (NestJS) using yarn Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/setup/manual.mdx Installs Agentica core, OpenAPI, NestJS packages, RPC, tgrid, and Nestia for WebSocket support in NestJS using yarn. Note: Yarn Berry is not supported. Includes Nestia setup. ```bash # YARN BERRY IS NOT SUPPORTED yarn add @agentica/core @samchon/openapi yarn add @nestjs/common @nestjs/core @nestjs/platform-express yarn add @agentica/rpc tgrid yarn add -D nestia yarn nestia setup ``` -------------------------------- ### Client WebSocket RPC Setup Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/docs/websocket/index.mdx Sets up a WebSocket client to connect to a server and make RPC calls. Includes authorization header and listener implementation. ```typescript import { IAgenticaRpcListener, IAgenticaRpcService } from "@agentica/rpc"; import { Driver, WebSocketConnector } from "tgrid"; interface IAuthorizationHeader { Authorization: string; } const connector: WebSocketConnector< IAuthorizationHeader, IAgenticaRpcListener, IAgenticaRpcService > = new WebSocketConnector( { Authorization: "Bearer ********", }, { text: async (evt) => { console.log(evt.role, evt.text); }, describe: async (evt) => { console.log("describer", evt.text); }, }, ); await connector.connect("ws://localhost:3001"); const driver: Driver = connector.getDriver(); await driver.conversate("Hello, what you can do?"); ``` -------------------------------- ### Conceptual Agentica Setup for Shopping Backend Source: https://github.com/wrtnlabs/agentica/blob/main/website/content/tutorial/enterprise/shopping.mdx Illustrates the conceptual setup of Agentica with an HTTP controller configured for the shopping backend. This version focuses on the agent construction and initial conversion without explicit pre-authentication code. ```typescript import { Agentica, assertHttpController } from "@agentica/core"; import OpenAI from "openai"; const agent = new Agentica({ vendor: { model: "gpt-4o-mini", api: new OpenAI({ apiKey: "********" }), }, controllers: [ assertHttpController({ name: "shopping", document: await fetch( "https://shopping-be.wrtn.ai/editor/swagger.json", ).then((res) => res.json()), connection: { host: "https://shopping-be.wrtn.ai", headers: { Authorization: "Bearer ********", }, }, }), ], }); await agent.convert("I wanna buy a Macbook."); ```