Skip to Content

Configuration

undefined

src/main.ts
import { Agentica, IAgenticaProps, IAgenticaConfig } from "@agentica/core"; import { AgenticaPgVectorSelector } from "@agentica/pg-vector-selector"; import OpenAI from "openai"; const agent = new Agentica({ vendor: { api: new OpenAI({ apiKey: "********" }), model: "gpt-4o", }, controllers: [...], config: { executor: { initialize: null, select: AgenticaPgVectorSelector.boot( "https://your-connector-hive-server.com", ), }, systemPrompt: { common: () => [ "You are a counselor of the shopping mall.", "", "Be kind and polite to the customer.", ].join("\n"), }, locale: "ko-KR", timezone: "Asia/Seoul", retry: 3, }, }); await agent.conversate("Hello, I want to refund my shoes.");

When creating an Agentica instance, you can configure the agent following the IAgenticaConfig type.

If you configure IAgenticaConfig.executor property, you can customize internal agents’ orchestration, so that affects to the agent’s behavior. For example, if you change the IAgenticaExecutor.select property to another function like PG Vector Selector, PG Vector Selector will determine the candidate functions to call, and you can save the LLM token costs a lot.

When you set the IAgenticaConfig.systemPrompt property, you can change the default system prompt messages of the internal agents. In the customizable system prompts, there’s a common system prompt which can be used in every internal agents, and you can also configure the system prompt for each internal agent.

The IAgenticaConfig.retry property is the retry count of the #Validation Feedback. If you set the retry property to 3, the agent will retry the function calling 3 times when the function calling composed invalid typed arguments.

Orchestration Executor

src/main.ts
import { Agentica, IAgenticaProps, IAgenticaConfig } from "@agentica/core"; import { AgenticaPgVectorSelector } from "@agentica/pg-vector-selector"; import OpenAI from "openai"; const agent = new Agentica({ vendor: { api: new OpenAI({ apiKey: "********" }), model: "gpt-4o", }, controllers: [...], config: { executor: { initialize: null, select: AgenticaPgVectorSelector.boot( "https://your-connector-hive-server.com", ), }, }, }); await agent.conversate("Hello, I want to refund my shoes.");

When you call Agentica.conversate() function, the agent will start the #Multi Agent Orchestration to the internal sub agents including function calling and executions, and returns the list of newly created prompts in the orchestration process.

And you can change some of internal agent’s behavior by configuring the IAgenticaExecutor property. For example, if you assign null value to the IAgenticaExecutor.initialize, the agent will skip the initialize process and directly go to the select process.

Otherwise you configure IAgenticaExecutor.select to another function like PG Vector Selector, the agent will select the functions to call by the PG Vector Selector’s strategy. And this way is recommend when your number of controller functions are too many. If you don’t do that with a lot of controller functions, your agent will consume a lot of LLM token costs.

System Prompts

src/main.ts
import { Agentica, IAgenticaProps, IAgenticaConfig } from "@agentica/core"; import OpenAI from "openai"; const agent = new Agentica({ vendor: { api: new OpenAI({ apiKey: "********" }), model: "gpt-4o", }, controllers: [...], config: { systemPrompt: { common: () => [ "You are a counselor of the shopping mall.", "", "Be kind and polite to the customer.", ].join("\n"), }, }, }); await agent.conversate("Hello, I want to refund my shoes.");

System prompts for each internal agents.

If you configure IAgenticaSystemPrompt properties, you can change the system prompt contents.

Here is the list of default system prompts, and it would be changed to what you’ve configured. Reading the IAgenticaSystemPrompt type carefully and referencing below snippet, configure the system prompts for guiding the agent to the right way.

Also, the common property configure will affect to the every internal agents. If you are developing a chatbot of counseling, you can guide the agent to use the polite and gentle tone by configuring the common property. When your agent needs to follow a specific policy, the common property is the best place to configure too.

Retry Count

src/main.ts
import { Agentica } from "@agentica/core"; import OpenAI from "openai"; const agent = new Agentica({ vendor: { api: new OpenAI({ apiKey: "********" }), model: "gpt-4o", }, controllers: [...], config: { retry: 3, }, }); await agent.conversate("Hello, I want to refund my shoes.");

Retry count of #Validation Feedback.

When LLM (Large Language Model) performs function calling, it tends to composes invalid typed arguments at the first trial when complicate type comes. In the case of Shopping AI Chatbot you’ve seen at the intro page as demonstration, success rate of the first trial is about 30%.

In that case, @agentica is designed to retry the function calling with validation feedback strategy. @agentica lists up every type errors and let the agent to correct it at the next trial. If you set the retry property to 3, the agent will retry the function calling 3 times when the function calling composed invalid typed arguments.

By the way, if you configure the retry property as 0, the agent will never retry the function calling with validation feedback strategy. This is not recommended due to the low success rate of the first trial makes the agent to be useless. The recommended value is 2 or 3.

Locale and Timezone

src/main.ts
import { Agentica } from "@agentica/core"; import OpenAI from "openai"; const agent = new Agentica({ vendor: { api: new OpenAI({ apiKey: "********" }), model: "gpt-4o", }, controllers: [...], config: { locale: "ko-KR", timezone: "Asia/Seoul", }, }); await agent.conversate("Hello, I want to refund my shoes.");

You can configure locale and timezone properties.

This properties are delivered to the AI agent, so that the AI agent considers the user’s locale and timezone. If you configure ko-KR to the locale property, the AI agent will conversate with the Korean language.

Otherwise you configure Asia/Seoul to the timezone property, the AI agent considers the location and timezone, so that sometimes affect to the LLM function calling’s arguments composition. For example, if you ask the AI agent to β€œrecommend me a local food”, the AI agent will recommend the local food in Seoul, Korea.

Last updated on