@agentica/core 0.12.2-dev.20250314 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +461 -461
  3. package/package.json +1 -1
  4. package/prompts/cancel.md +4 -4
  5. package/prompts/common.md +2 -2
  6. package/prompts/describe.md +6 -6
  7. package/prompts/execute.md +6 -6
  8. package/prompts/initialize.md +2 -2
  9. package/prompts/select.md +6 -6
  10. package/src/Agentica.ts +359 -359
  11. package/src/chatgpt/ChatGptAgent.ts +76 -76
  12. package/src/chatgpt/ChatGptCallFunctionAgent.ts +466 -466
  13. package/src/chatgpt/ChatGptCancelFunctionAgent.ts +280 -280
  14. package/src/chatgpt/ChatGptCompletionMessageUtil.ts +166 -166
  15. package/src/chatgpt/ChatGptDescribeFunctionAgent.ts +122 -122
  16. package/src/chatgpt/ChatGptHistoryDecoder.ts +88 -88
  17. package/src/chatgpt/ChatGptInitializeFunctionAgent.ts +96 -96
  18. package/src/chatgpt/ChatGptSelectFunctionAgent.ts +311 -311
  19. package/src/chatgpt/ChatGptUsageAggregator.ts +62 -62
  20. package/src/context/AgenticaCancelPrompt.ts +32 -32
  21. package/src/context/AgenticaClassOperation.ts +23 -23
  22. package/src/context/AgenticaContext.ts +130 -130
  23. package/src/context/AgenticaHttpOperation.ts +27 -27
  24. package/src/context/AgenticaOperation.ts +66 -66
  25. package/src/context/AgenticaOperationBase.ts +57 -57
  26. package/src/context/AgenticaOperationCollection.ts +52 -52
  27. package/src/context/AgenticaOperationSelection.ts +27 -27
  28. package/src/context/AgenticaTokenUsage.ts +170 -170
  29. package/src/context/internal/AgenticaTokenUsageAggregator.ts +66 -66
  30. package/src/context/internal/__IChatCancelFunctionsApplication.ts +23 -23
  31. package/src/context/internal/__IChatFunctionReference.ts +21 -21
  32. package/src/context/internal/__IChatInitialApplication.ts +15 -15
  33. package/src/context/internal/__IChatSelectFunctionsApplication.ts +24 -24
  34. package/src/events/AgenticaCallEvent.ts +36 -36
  35. package/src/events/AgenticaCancelEvent.ts +28 -28
  36. package/src/events/AgenticaDescribeEvent.ts +66 -66
  37. package/src/events/AgenticaEvent.ts +36 -36
  38. package/src/events/AgenticaEventBase.ts +7 -7
  39. package/src/events/AgenticaEventSource.ts +6 -6
  40. package/src/events/AgenticaExecuteEvent.ts +50 -50
  41. package/src/events/AgenticaInitializeEvent.ts +14 -14
  42. package/src/events/AgenticaRequestEvent.ts +45 -45
  43. package/src/events/AgenticaResponseEvent.ts +48 -48
  44. package/src/events/AgenticaSelectEvent.ts +37 -37
  45. package/src/events/AgenticaTextEvent.ts +62 -62
  46. package/src/functional/assertHttpLlmApplication.ts +55 -55
  47. package/src/functional/validateHttpLlmApplication.ts +66 -66
  48. package/src/index.ts +44 -44
  49. package/src/internal/AgenticaConstant.ts +4 -4
  50. package/src/internal/AgenticaDefaultPrompt.ts +43 -43
  51. package/src/internal/AgenticaOperationComposer.ts +96 -96
  52. package/src/internal/ByteArrayUtil.ts +5 -5
  53. package/src/internal/MPSCUtil.ts +111 -111
  54. package/src/internal/MathUtil.ts +3 -3
  55. package/src/internal/Singleton.ts +22 -22
  56. package/src/internal/StreamUtil.ts +64 -64
  57. package/src/internal/__map_take.ts +15 -15
  58. package/src/json/IAgenticaEventJson.ts +178 -178
  59. package/src/json/IAgenticaOperationJson.ts +36 -36
  60. package/src/json/IAgenticaOperationSelectionJson.ts +19 -19
  61. package/src/json/IAgenticaPromptJson.ts +130 -130
  62. package/src/json/IAgenticaTokenUsageJson.ts +107 -107
  63. package/src/prompts/AgenticaCancelPrompt.ts +32 -32
  64. package/src/prompts/AgenticaDescribePrompt.ts +41 -41
  65. package/src/prompts/AgenticaExecutePrompt.ts +52 -52
  66. package/src/prompts/AgenticaPrompt.ts +14 -14
  67. package/src/prompts/AgenticaPromptBase.ts +27 -27
  68. package/src/prompts/AgenticaSelectPrompt.ts +32 -32
  69. package/src/prompts/AgenticaTextPrompt.ts +31 -31
  70. package/src/structures/IAgenticaConfig.ts +123 -123
  71. package/src/structures/IAgenticaController.ts +133 -133
  72. package/src/structures/IAgenticaExecutor.ts +157 -157
  73. package/src/structures/IAgenticaProps.ts +69 -69
  74. package/src/structures/IAgenticaSystemPrompt.ts +125 -125
  75. package/src/structures/IAgenticaVendor.ts +39 -39
  76. package/src/transformers/AgenticaEventTransformer.ts +165 -165
  77. package/src/transformers/AgenticaPromptTransformer.ts +134 -134
@@ -1,133 +1,133 @@
1
- import {
2
- IHttpConnection,
3
- IHttpLlmApplication,
4
- IHttpLlmFunction,
5
- IHttpResponse,
6
- ILlmApplication,
7
- ILlmFunction,
8
- ILlmSchema,
9
- } from "@samchon/openapi";
10
-
11
- /**
12
- * Controller of the Nestia Agent.
13
- *
14
- * `IAgenticaController` is a type represents a controller of the
15
- * {@link Agentica}, which serves a set of functions to be called
16
- * by A.I. chatbot from LLM function calling.
17
- *
18
- * Also, `IAgenticaController` is an union type which can specify
19
- * a subtype by checking the {@link protocol} property.
20
- *
21
- * - HTTP server: {@link IAgenticaController..IHttp}
22
- * - TypeScript class: {@link IAgenticaController.IClass}
23
- *
24
- * @author Samchon
25
- */
26
- export type IAgenticaController<Model extends ILlmSchema.Model> =
27
- | IAgenticaController.IHttp<Model>
28
- | IAgenticaController.IClass<Model>;
29
- export namespace IAgenticaController {
30
- /**
31
- * HTTP controller.
32
- *
33
- * You can make it by {@link validateHttpLlmApplication} function with
34
- * the Swagger or OpenAPI document.
35
- */
36
- export interface IHttp<Model extends ILlmSchema.Model>
37
- extends IBase<"http", IHttpLlmApplication<Model>> {
38
- /**
39
- * Connection to the server.
40
- *
41
- * Connection to the API server including the URL and headers.
42
- */
43
- connection: IHttpConnection;
44
-
45
- /**
46
- * Executor of the API function.
47
- *
48
- * @param props Properties of the API function call
49
- * @returns HTTP response of the API function call
50
- */
51
- execute?: (props: {
52
- /**
53
- * Connection to the server.
54
- */
55
- connection: IHttpConnection;
56
-
57
- /**
58
- * Application schema.
59
- */
60
- application: IHttpLlmApplication<Model>;
61
-
62
- /**
63
- * Function schema.
64
- */
65
- function: IHttpLlmFunction<Model>;
66
-
67
- /**
68
- * Arguments of the function calling.
69
- *
70
- * It is an object of key-value pairs of the API function's parameters.
71
- * The property keys are composed by below rules:
72
- *
73
- * - parameter names
74
- * - query parameter as an object type if exists
75
- * - body parameter if exists
76
- */
77
- arguments: object;
78
- }) => Promise<IHttpResponse>;
79
- }
80
-
81
- /**
82
- * TypeScript class controller.
83
- *
84
- * You can make it by `typia.llm.application<App, Model>()` function.
85
- *
86
- * - https://typia.io/docs/llm/application
87
- */
88
- export interface IClass<Model extends ILlmSchema.Model>
89
- extends IBase<"class", ILlmApplication<Model>> {
90
- /**
91
- * Executor of the class function.
92
- *
93
- * Executor of the class function, by target class instance
94
- * or callback function with given schema and arguments
95
- * information.
96
- */
97
- execute:
98
- | object
99
- | ((props: {
100
- /**
101
- * Target application schema.
102
- */
103
- application: ILlmApplication<Model>;
104
-
105
- /**
106
- * Target function schema.
107
- */
108
- function: ILlmFunction<Model>;
109
-
110
- /**
111
- * Arguments of the function calling.
112
- */
113
- arguments: object;
114
- }) => Promise<unknown>);
115
- }
116
-
117
- interface IBase<Protocol, Application> {
118
- /**
119
- * Protocol discrminator.
120
- */
121
- protocol: Protocol;
122
-
123
- /**
124
- * Name of the controller.
125
- */
126
- name: string;
127
-
128
- /**
129
- * Application schema of function calling.
130
- */
131
- application: Application;
132
- }
133
- }
1
+ import {
2
+ IHttpConnection,
3
+ IHttpLlmApplication,
4
+ IHttpLlmFunction,
5
+ IHttpResponse,
6
+ ILlmApplication,
7
+ ILlmFunction,
8
+ ILlmSchema,
9
+ } from "@samchon/openapi";
10
+
11
+ /**
12
+ * Controller of the Nestia Agent.
13
+ *
14
+ * `IAgenticaController` is a type represents a controller of the
15
+ * {@link Agentica}, which serves a set of functions to be called
16
+ * by A.I. chatbot from LLM function calling.
17
+ *
18
+ * Also, `IAgenticaController` is an union type which can specify
19
+ * a subtype by checking the {@link protocol} property.
20
+ *
21
+ * - HTTP server: {@link IAgenticaController..IHttp}
22
+ * - TypeScript class: {@link IAgenticaController.IClass}
23
+ *
24
+ * @author Samchon
25
+ */
26
+ export type IAgenticaController<Model extends ILlmSchema.Model> =
27
+ | IAgenticaController.IHttp<Model>
28
+ | IAgenticaController.IClass<Model>;
29
+ export namespace IAgenticaController {
30
+ /**
31
+ * HTTP controller.
32
+ *
33
+ * You can make it by {@link validateHttpLlmApplication} function with
34
+ * the Swagger or OpenAPI document.
35
+ */
36
+ export interface IHttp<Model extends ILlmSchema.Model>
37
+ extends IBase<"http", IHttpLlmApplication<Model>> {
38
+ /**
39
+ * Connection to the server.
40
+ *
41
+ * Connection to the API server including the URL and headers.
42
+ */
43
+ connection: IHttpConnection;
44
+
45
+ /**
46
+ * Executor of the API function.
47
+ *
48
+ * @param props Properties of the API function call
49
+ * @returns HTTP response of the API function call
50
+ */
51
+ execute?: (props: {
52
+ /**
53
+ * Connection to the server.
54
+ */
55
+ connection: IHttpConnection;
56
+
57
+ /**
58
+ * Application schema.
59
+ */
60
+ application: IHttpLlmApplication<Model>;
61
+
62
+ /**
63
+ * Function schema.
64
+ */
65
+ function: IHttpLlmFunction<Model>;
66
+
67
+ /**
68
+ * Arguments of the function calling.
69
+ *
70
+ * It is an object of key-value pairs of the API function's parameters.
71
+ * The property keys are composed by below rules:
72
+ *
73
+ * - parameter names
74
+ * - query parameter as an object type if exists
75
+ * - body parameter if exists
76
+ */
77
+ arguments: object;
78
+ }) => Promise<IHttpResponse>;
79
+ }
80
+
81
+ /**
82
+ * TypeScript class controller.
83
+ *
84
+ * You can make it by `typia.llm.application<App, Model>()` function.
85
+ *
86
+ * - https://typia.io/docs/llm/application
87
+ */
88
+ export interface IClass<Model extends ILlmSchema.Model>
89
+ extends IBase<"class", ILlmApplication<Model>> {
90
+ /**
91
+ * Executor of the class function.
92
+ *
93
+ * Executor of the class function, by target class instance
94
+ * or callback function with given schema and arguments
95
+ * information.
96
+ */
97
+ execute:
98
+ | object
99
+ | ((props: {
100
+ /**
101
+ * Target application schema.
102
+ */
103
+ application: ILlmApplication<Model>;
104
+
105
+ /**
106
+ * Target function schema.
107
+ */
108
+ function: ILlmFunction<Model>;
109
+
110
+ /**
111
+ * Arguments of the function calling.
112
+ */
113
+ arguments: object;
114
+ }) => Promise<unknown>);
115
+ }
116
+
117
+ interface IBase<Protocol, Application> {
118
+ /**
119
+ * Protocol discrminator.
120
+ */
121
+ protocol: Protocol;
122
+
123
+ /**
124
+ * Name of the controller.
125
+ */
126
+ name: string;
127
+
128
+ /**
129
+ * Application schema of function calling.
130
+ */
131
+ application: Application;
132
+ }
133
+ }
@@ -1,157 +1,157 @@
1
- import { ILlmSchema } from "@samchon/openapi";
2
-
3
- import { AgenticaContext } from "../context/AgenticaContext";
4
- import { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
5
- import { AgenticaPrompt } from "../prompts/AgenticaPrompt";
6
-
7
- /**
8
- * Executor of the Agentic AI.
9
- *
10
- * `IAgenticaExecutor` represents an executor of the {@link Agentica},
11
- * composing its internal agents to accomplish the Agentic AI through
12
- * the LLM (Large Language Model) function calling.
13
- *
14
- * You can customize one of these internal agents by configuring
15
- * properties of the `IAgenticaExecutor` type, and assigning it to the
16
- * {@link IAgenticaConfig.executor} property. If you set the
17
- * {@link initialize} as `null` value, the {@link Agentica} will skip
18
- * the initialize process and directly go to the {@link select} process.
19
- *
20
- * By the way, when customizing the executor member, it would better to
21
- * reference the guide documents of `@agentica/core`, and internal
22
- * agents' implementation code. It's because if you take some mistake on
23
- * the executor logic, it can entirely break the {@link Agentica}'s
24
- * operation.
25
- *
26
- * @reference https://github.com/wrtnlabs/agentica?tab=readme-ov-file#principles
27
- * @reference https://github.com/wrtnlabs/agentica/blob/main/packages/agent/src/chatgpt/ChatGptAgent.ts
28
- * @author Samchon
29
- */
30
- export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
31
- /**
32
- * Initializer agent listing up functions.
33
- *
34
- * `initialize` agent is the first agent that {@link Agentica}
35
- * would meet which judges whether the user's conversation implies
36
- * to call some function or not.
37
- *
38
- * And if the `initialize` agent judges the user's conversation
39
- * implies to call some function, the `initialize` agent will
40
- * call the {@link AgenticaContext.initialize} function, and
41
- * inform every functions enrolled in the {@link IAgenticaController}
42
- * to the AI agent. And then, the `initialize` agent will not never
43
- * be called again, and let {@link Agentica} to go to the next
44
- * {@link select} agent.
45
- *
46
- * Otherwise the user's conversation does not imply the request of
47
- * function calling, it would just work like plain chatbot, and just
48
- * conversate with the user.
49
- *
50
- * By the way, if you wanna skip the `initialize` agent, you can
51
- * do it by configuring the {@link IAgenticaConfig.executor} as
52
- * `null` value. In that case, the `initialize` agent will never be
53
- * called, and {@link Agentica} just starts from the {@link select}
54
- * agent.
55
- *
56
- * @param ctx Context of the agent
57
- * @returns List of prompts generated by the initializer
58
- */
59
- initialize:
60
- | null
61
- | ((ctx: AgenticaContext<Model>) => Promise<AgenticaPrompt<Model>[]>);
62
-
63
- /**
64
- * Function selector agent.
65
- *
66
- * `Select` agent finds candidate functions to call from the
67
- * conversation context with the user. And the candidate functions
68
- * would be enrolled to the {@link AgenticaContext.stack}, and the
69
- * next {@link call} agent will perform the LLM (Large Language Model)
70
- * function calling.
71
- *
72
- * Note that, the `select` agent does not perform the LLM function
73
- * calling. It ends with just finding the candidate functions to call.
74
- *
75
- * By the way, if the `select` agent can't specify a certain function
76
- * to call due to lack of conversation context or homogeneity between
77
- * heterogeneous functions, how `select` agent works? In that case,
78
- * `select` agent it will just enroll every candidate functions to
79
- * the stack, and let the next {@link call} agent to determine the
80
- * proper function to call. And then let {@link cancel} agent to erase
81
- * the other candidate functions from the stack.
82
- *
83
- * Additionally, if `select` agent could not find any candidate
84
- * function from the conversation context with user, it would just
85
- * act like plain chatbot conversating with the user.
86
- *
87
- * @param ctx Context of the agent
88
- * @returns List of prompts generated by the selector
89
- */
90
- select: (ctx: AgenticaContext<Model>) => Promise<AgenticaPrompt<Model>[]>;
91
-
92
- /**
93
- * Function caller agent.
94
- *
95
- * `Call` agent performs the LLM (Large Language Model) function
96
- * calling from the candidate functions enrolled in the
97
- * {@link AgenticaContext.stack}. And the scope of function calling
98
- * is, not only just arguments filling, but also actual executing
99
- * the function and returning the result.
100
- *
101
- * By the way, conversation context with user can be not enough to
102
- * filling the arguments of the candidate functions. In that case,
103
- * the `call` agent will ask the user to fill the missing arguments.
104
- *
105
- * Otherwise the cpnversation context is enough, so that succeeded
106
- * to call some candidate functions, the `call` agent will step to
107
- * the {@link describe} agent to explain the result of the function
108
- * calling to the user as markdown content.
109
- *
110
- * @param ctx Context of the agent
111
- * @returns List of prompts generated by the caller
112
- * @warning Recommend not to customize, due to its validation
113
- * feedback strategy is working very well, and the `call`
114
- * agent is the most general topic which can be universally
115
- * applied to all domain fields.
116
- */
117
- call: (ctx: AgenticaContext<Model>) => Promise<AgenticaPrompt<Model>[]>;
118
-
119
- /**
120
- * Describer agent of the function calling result.
121
- *
122
- * `Describe` agent explains the results of the function callings
123
- * to the user as markdown content.
124
- *
125
- * @param ctx Context of the agent
126
- * @param executes List of function calling results
127
- * @returns List of prompts generated by the describer
128
- */
129
- describe: (
130
- ctx: AgenticaContext<Model>,
131
- executes: AgenticaExecutePrompt<Model>[],
132
- ) => Promise<AgenticaPrompt<Model>[]>;
133
-
134
- /**
135
- * Function canceler agent.
136
- *
137
- * `Cancel` agent erases the candidate functions from the
138
- * {@link AgenticaContext.stack} by analyzing the conversation
139
- * context with the user.
140
- *
141
- * For reference, the first reason of the cancelation is explicit
142
- * order from user to the previous requested function. For example,
143
- * user had requested to send an email to the agent, but suddenly
144
- * user says to cancel the email sending.
145
- *
146
- * The seconod reason n of the cancelation is the multiple candidate
147
- * functions had been selected at once by the {@link select} agent
148
- * due to lack of conversation context or homogeneity between the
149
- * heterogeneous functions. And in the multiple candidate functions,
150
- * one thing is clearly determined by the {@link call} agent, so that
151
- * drop the other candidate functions.
152
- *
153
- * @param ctx Context of the agent
154
- * @returns List of prompts generated by the canceler
155
- */
156
- cancel: (ctx: AgenticaContext<Model>) => Promise<AgenticaPrompt<Model>[]>;
157
- }
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+
3
+ import { AgenticaContext } from "../context/AgenticaContext";
4
+ import { AgenticaExecutePrompt } from "../prompts/AgenticaExecutePrompt";
5
+ import { AgenticaPrompt } from "../prompts/AgenticaPrompt";
6
+
7
+ /**
8
+ * Executor of the Agentic AI.
9
+ *
10
+ * `IAgenticaExecutor` represents an executor of the {@link Agentica},
11
+ * composing its internal agents to accomplish the Agentic AI through
12
+ * the LLM (Large Language Model) function calling.
13
+ *
14
+ * You can customize one of these internal agents by configuring
15
+ * properties of the `IAgenticaExecutor` type, and assigning it to the
16
+ * {@link IAgenticaConfig.executor} property. If you set the
17
+ * {@link initialize} as `null` value, the {@link Agentica} will skip
18
+ * the initialize process and directly go to the {@link select} process.
19
+ *
20
+ * By the way, when customizing the executor member, it would better to
21
+ * reference the guide documents of `@agentica/core`, and internal
22
+ * agents' implementation code. It's because if you take some mistake on
23
+ * the executor logic, it can entirely break the {@link Agentica}'s
24
+ * operation.
25
+ *
26
+ * @reference https://github.com/wrtnlabs/agentica?tab=readme-ov-file#principles
27
+ * @reference https://github.com/wrtnlabs/agentica/blob/main/packages/agent/src/chatgpt/ChatGptAgent.ts
28
+ * @author Samchon
29
+ */
30
+ export interface IAgenticaExecutor<Model extends ILlmSchema.Model> {
31
+ /**
32
+ * Initializer agent listing up functions.
33
+ *
34
+ * `initialize` agent is the first agent that {@link Agentica}
35
+ * would meet which judges whether the user's conversation implies
36
+ * to call some function or not.
37
+ *
38
+ * And if the `initialize` agent judges the user's conversation
39
+ * implies to call some function, the `initialize` agent will
40
+ * call the {@link AgenticaContext.initialize} function, and
41
+ * inform every functions enrolled in the {@link IAgenticaController}
42
+ * to the AI agent. And then, the `initialize` agent will not never
43
+ * be called again, and let {@link Agentica} to go to the next
44
+ * {@link select} agent.
45
+ *
46
+ * Otherwise the user's conversation does not imply the request of
47
+ * function calling, it would just work like plain chatbot, and just
48
+ * conversate with the user.
49
+ *
50
+ * By the way, if you wanna skip the `initialize` agent, you can
51
+ * do it by configuring the {@link IAgenticaConfig.executor} as
52
+ * `null` value. In that case, the `initialize` agent will never be
53
+ * called, and {@link Agentica} just starts from the {@link select}
54
+ * agent.
55
+ *
56
+ * @param ctx Context of the agent
57
+ * @returns List of prompts generated by the initializer
58
+ */
59
+ initialize:
60
+ | null
61
+ | ((ctx: AgenticaContext<Model>) => Promise<AgenticaPrompt<Model>[]>);
62
+
63
+ /**
64
+ * Function selector agent.
65
+ *
66
+ * `Select` agent finds candidate functions to call from the
67
+ * conversation context with the user. And the candidate functions
68
+ * would be enrolled to the {@link AgenticaContext.stack}, and the
69
+ * next {@link call} agent will perform the LLM (Large Language Model)
70
+ * function calling.
71
+ *
72
+ * Note that, the `select` agent does not perform the LLM function
73
+ * calling. It ends with just finding the candidate functions to call.
74
+ *
75
+ * By the way, if the `select` agent can't specify a certain function
76
+ * to call due to lack of conversation context or homogeneity between
77
+ * heterogeneous functions, how `select` agent works? In that case,
78
+ * `select` agent it will just enroll every candidate functions to
79
+ * the stack, and let the next {@link call} agent to determine the
80
+ * proper function to call. And then let {@link cancel} agent to erase
81
+ * the other candidate functions from the stack.
82
+ *
83
+ * Additionally, if `select` agent could not find any candidate
84
+ * function from the conversation context with user, it would just
85
+ * act like plain chatbot conversating with the user.
86
+ *
87
+ * @param ctx Context of the agent
88
+ * @returns List of prompts generated by the selector
89
+ */
90
+ select: (ctx: AgenticaContext<Model>) => Promise<AgenticaPrompt<Model>[]>;
91
+
92
+ /**
93
+ * Function caller agent.
94
+ *
95
+ * `Call` agent performs the LLM (Large Language Model) function
96
+ * calling from the candidate functions enrolled in the
97
+ * {@link AgenticaContext.stack}. And the scope of function calling
98
+ * is, not only just arguments filling, but also actual executing
99
+ * the function and returning the result.
100
+ *
101
+ * By the way, conversation context with user can be not enough to
102
+ * filling the arguments of the candidate functions. In that case,
103
+ * the `call` agent will ask the user to fill the missing arguments.
104
+ *
105
+ * Otherwise the cpnversation context is enough, so that succeeded
106
+ * to call some candidate functions, the `call` agent will step to
107
+ * the {@link describe} agent to explain the result of the function
108
+ * calling to the user as markdown content.
109
+ *
110
+ * @param ctx Context of the agent
111
+ * @returns List of prompts generated by the caller
112
+ * @warning Recommend not to customize, due to its validation
113
+ * feedback strategy is working very well, and the `call`
114
+ * agent is the most general topic which can be universally
115
+ * applied to all domain fields.
116
+ */
117
+ call: (ctx: AgenticaContext<Model>) => Promise<AgenticaPrompt<Model>[]>;
118
+
119
+ /**
120
+ * Describer agent of the function calling result.
121
+ *
122
+ * `Describe` agent explains the results of the function callings
123
+ * to the user as markdown content.
124
+ *
125
+ * @param ctx Context of the agent
126
+ * @param executes List of function calling results
127
+ * @returns List of prompts generated by the describer
128
+ */
129
+ describe: (
130
+ ctx: AgenticaContext<Model>,
131
+ executes: AgenticaExecutePrompt<Model>[],
132
+ ) => Promise<AgenticaPrompt<Model>[]>;
133
+
134
+ /**
135
+ * Function canceler agent.
136
+ *
137
+ * `Cancel` agent erases the candidate functions from the
138
+ * {@link AgenticaContext.stack} by analyzing the conversation
139
+ * context with the user.
140
+ *
141
+ * For reference, the first reason of the cancelation is explicit
142
+ * order from user to the previous requested function. For example,
143
+ * user had requested to send an email to the agent, but suddenly
144
+ * user says to cancel the email sending.
145
+ *
146
+ * The seconod reason n of the cancelation is the multiple candidate
147
+ * functions had been selected at once by the {@link select} agent
148
+ * due to lack of conversation context or homogeneity between the
149
+ * heterogeneous functions. And in the multiple candidate functions,
150
+ * one thing is clearly determined by the {@link call} agent, so that
151
+ * drop the other candidate functions.
152
+ *
153
+ * @param ctx Context of the agent
154
+ * @returns List of prompts generated by the canceler
155
+ */
156
+ cancel: (ctx: AgenticaContext<Model>) => Promise<AgenticaPrompt<Model>[]>;
157
+ }