@agentica/core 0.44.0-dev.20260313-2 → 0.44.1
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.
- package/LICENSE +21 -21
- package/README.md +218 -218
- package/lib/context/internal/__IChatInitialApplication.d.ts +1 -2
- package/lib/errors/AgenticaJsonParseError.js +6 -6
- package/lib/index.mjs +47 -7
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/call.js +16 -16
- package/lib/orchestrate/cancel.js +1 -1
- package/lib/orchestrate/cancel.js.map +1 -1
- package/lib/orchestrate/initialize.js +44 -2
- package/lib/orchestrate/initialize.js.map +1 -1
- package/lib/orchestrate/select.js +1 -1
- package/lib/orchestrate/select.js.map +1 -1
- package/lib/structures/IAgenticaController.d.ts +143 -143
- package/lib/utils/ChatGptCompletionMessageUtil.js +6 -6
- package/package.json +6 -6
- package/prompts/cancel.md +5 -5
- package/prompts/common.md +3 -3
- package/prompts/describe.md +7 -7
- package/prompts/execute.md +122 -122
- package/prompts/initialize.md +3 -3
- package/prompts/json_parse_error.md +35 -35
- package/prompts/select.md +7 -7
- package/prompts/validate.md +123 -123
- package/prompts/validate_repeated.md +31 -31
- package/src/Agentica.ts +367 -367
- package/src/MicroAgentica.ts +357 -357
- package/src/constants/AgenticaConstant.ts +4 -4
- package/src/constants/AgenticaDefaultPrompt.ts +44 -44
- package/src/constants/index.ts +2 -2
- package/src/context/AgenticaContext.ts +136 -136
- package/src/context/AgenticaContextRequestResult.ts +14 -14
- package/src/context/AgenticaOperation.ts +73 -73
- package/src/context/AgenticaOperationCollection.ts +49 -49
- package/src/context/AgenticaOperationSelection.ts +9 -9
- package/src/context/AgenticaTokenUsage.ts +186 -186
- package/src/context/MicroAgenticaContext.ts +99 -99
- package/src/context/index.ts +5 -5
- package/src/context/internal/AgenticaOperationComposer.ts +177 -177
- package/src/context/internal/AgenticaTokenUsageAggregator.ts +66 -66
- package/src/context/internal/__IChatCancelFunctionsApplication.ts +23 -23
- package/src/context/internal/__IChatFunctionReference.ts +21 -21
- package/src/context/internal/__IChatInitialApplication.ts +13 -15
- package/src/context/internal/__IChatSelectFunctionsApplication.ts +24 -24
- package/src/context/internal/isAgenticaContext.ts +11 -11
- package/src/errors/AgenticaJsonParseError.ts +52 -52
- package/src/errors/AgenticaValidationError.ts +49 -49
- package/src/errors/index.ts +2 -2
- package/src/events/AgenticaAssistantMessageEvent.ts +12 -12
- package/src/events/AgenticaCallEvent.ts +27 -27
- package/src/events/AgenticaCancelEvent.ts +9 -9
- package/src/events/AgenticaDescribeEvent.ts +14 -14
- package/src/events/AgenticaEvent.ts +59 -59
- package/src/events/AgenticaEvent.type.ts +19 -19
- package/src/events/AgenticaEventBase.ts +18 -18
- package/src/events/AgenticaEventSource.ts +6 -6
- package/src/events/AgenticaExecuteEvent.ts +45 -45
- package/src/events/AgenticaInitializeEvent.ts +7 -7
- package/src/events/AgenticaJsonParseErrorEvent.ts +16 -16
- package/src/events/AgenticaRequestEvent.ts +27 -27
- package/src/events/AgenticaResponseEvent.ts +32 -32
- package/src/events/AgenticaSelectEvent.ts +11 -11
- package/src/events/AgenticaUserMessageEvent.ts +12 -12
- package/src/events/AgenticaValidateEvent.ts +32 -32
- package/src/events/MicroAgenticaEvent.ts +45 -45
- package/src/events/index.ts +15 -15
- package/src/factory/events.ts +357 -357
- package/src/factory/histories.ts +348 -348
- package/src/factory/index.ts +3 -3
- package/src/factory/operations.ts +16 -16
- package/src/functional/assertHttpController.ts +106 -106
- package/src/functional/assertHttpLlmApplication.ts +52 -52
- package/src/functional/assertMcpController.ts +47 -47
- package/src/functional/createMcpLlmApplication.ts +72 -72
- package/src/functional/index.ts +7 -7
- package/src/functional/validateHttpController.ts +113 -113
- package/src/functional/validateHttpLlmApplication.ts +65 -65
- package/src/functional/validateMcpController.ts +53 -53
- package/src/histories/AgenticaAssistantMessageHistory.ts +10 -10
- package/src/histories/AgenticaCancelHistory.ts +8 -8
- package/src/histories/AgenticaDescribeHistory.ts +18 -18
- package/src/histories/AgenticaExecuteHistory.ts +64 -64
- package/src/histories/AgenticaHistory.ts +28 -28
- package/src/histories/AgenticaHistoryBase.ts +35 -35
- package/src/histories/AgenticaSelectHistory.ts +8 -8
- package/src/histories/AgenticaSystemMessageHistory.ts +10 -10
- package/src/histories/AgenticaUserMessageHistory.ts +11 -11
- package/src/histories/MicroAgenticaHistory.ts +19 -19
- package/src/histories/contents/AgenticaUserMessageAudioContent.ts +21 -21
- package/src/histories/contents/AgenticaUserMessageContent.ts +19 -19
- package/src/histories/contents/AgenticaUserMessageContentBase.ts +6 -6
- package/src/histories/contents/AgenticaUserMessageFileContent.ts +25 -25
- package/src/histories/contents/AgenticaUserMessageImageContent.ts +33 -33
- package/src/histories/contents/AgenticaUserMessageTextContent.ts +15 -15
- package/src/histories/contents/index.ts +5 -5
- package/src/histories/index.ts +10 -10
- package/src/index.ts +15 -15
- package/src/json/IAgenticaEventJson.ts +265 -265
- package/src/json/IAgenticaEventJson.type.ts +19 -19
- package/src/json/IAgenticaHistoryJson.ts +165 -165
- package/src/json/IAgenticaHistoryJson.type.ts +19 -19
- package/src/json/IAgenticaOperationJson.ts +36 -36
- package/src/json/IAgenticaOperationSelectionJson.ts +26 -26
- package/src/json/IAgenticaTokenUsageJson.ts +107 -107
- package/src/json/IMicroAgenticaEventJson.ts +22 -22
- package/src/json/IMicroAgenticaHistoryJson.ts +25 -25
- package/src/json/index.ts +7 -7
- package/src/orchestrate/call.ts +542 -542
- package/src/orchestrate/cancel.ts +265 -265
- package/src/orchestrate/describe.ts +66 -66
- package/src/orchestrate/execute.ts +61 -61
- package/src/orchestrate/index.ts +6 -6
- package/src/orchestrate/initialize.ts +102 -102
- package/src/orchestrate/internal/cancelFunctionFromContext.ts +33 -33
- package/src/orchestrate/internal/selectFunctionFromContext.ts +34 -34
- package/src/orchestrate/select.ts +320 -320
- package/src/structures/IAgenticaConfig.ts +83 -83
- package/src/structures/IAgenticaConfigBase.ts +87 -87
- package/src/structures/IAgenticaController.ts +143 -143
- package/src/structures/IAgenticaExecutor.ts +167 -167
- package/src/structures/IAgenticaProps.ts +78 -78
- package/src/structures/IAgenticaSystemPrompt.ts +236 -236
- package/src/structures/IAgenticaVendor.ts +54 -54
- package/src/structures/IMcpTool.ts +60 -60
- package/src/structures/IMicroAgenticaConfig.ts +56 -56
- package/src/structures/IMicroAgenticaExecutor.ts +67 -67
- package/src/structures/IMicroAgenticaProps.ts +77 -77
- package/src/structures/IMicroAgenticaSystemPrompt.ts +169 -169
- package/src/structures/index.ts +10 -10
- package/src/transformers/transformHistory.ts +172 -172
- package/src/utils/AssistantMessageEmptyError.ts +20 -20
- package/src/utils/AsyncQueue.spec.ts +355 -355
- package/src/utils/AsyncQueue.ts +95 -95
- package/src/utils/ByteArrayUtil.ts +5 -5
- package/src/utils/ChatGptCompletionMessageUtil.spec.ts +314 -314
- package/src/utils/ChatGptCompletionMessageUtil.ts +210 -210
- package/src/utils/ChatGptCompletionStreamingUtil.spec.ts +909 -909
- package/src/utils/ChatGptCompletionStreamingUtil.ts +91 -91
- package/src/utils/ChatGptTokenUsageAggregator.spec.ts +226 -226
- package/src/utils/ChatGptTokenUsageAggregator.ts +57 -57
- package/src/utils/MPSC.spec.ts +276 -276
- package/src/utils/MPSC.ts +42 -42
- package/src/utils/Singleton.spec.ts +138 -138
- package/src/utils/Singleton.ts +42 -42
- package/src/utils/StreamUtil.spec.ts +512 -512
- package/src/utils/StreamUtil.ts +87 -87
- package/src/utils/__map_take.spec.ts +140 -140
- package/src/utils/__map_take.ts +13 -13
- package/src/utils/__retry.spec.ts +198 -198
- package/src/utils/__retry.ts +18 -18
- package/src/utils/assertExecuteFailure.ts +16 -16
- package/src/utils/index.ts +4 -4
- package/src/utils/request.ts +140 -140
- package/src/utils/types.ts +50 -50
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Wrtn Technologies
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Wrtn Technologies
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,218 +1,218 @@
|
|
|
1
|
-
# Agentica, AI Function Calling Framework
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
<!-- Github/NPM Badges -->
|
|
6
|
-
<p align="center">
|
|
7
|
-
<a href="https://github.com/wrtnlabs/agentica/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License"/></a>
|
|
8
|
-
<a href="https://www.npmjs.com/package/@agentica/core"><img src="https://img.shields.io/npm/v/@agentica/core.svg" alt="NPM Version"/></a>
|
|
9
|
-
<a href="https://www.npmjs.com/package/@agentica/core"><img src="https://img.shields.io/npm/dm/@agentica/core.svg" alt="NPM Downloads"/></a>
|
|
10
|
-
<a href="https://dormoshe.io/newsletters/373"><img src="https://img.shields.io/badge/DorMoshe%20Newsletter-Top%20%236%20of%201K-orange?style=flat&logo=rss" alt="Newsletter Top #6"/></a>
|
|
11
|
-
<a href="https://github.com/wrtnlabs/agentica/actions?query=workflow%3Abuild"><img src="https://github.com/wrtnlabs/agentica/workflows/build/badge.svg" alt="Build Status"/></a>
|
|
12
|
-
</p>
|
|
13
|
-
|
|
14
|
-
<!-- Youtube + Discord -->
|
|
15
|
-
<p align="center">
|
|
16
|
-
<a href="https://www.youtube.com/@wrtnlabs">
|
|
17
|
-
<img src="https://img.shields.io/badge/YouTube%20Tutorial-0d1117?style=social&logo=youtube" alt="YouTube"/>
|
|
18
|
-
</a>
|
|
19
|
-
|
|
20
|
-
<a href="https://discord.gg/aMhRmzkqCx">
|
|
21
|
-
<img src="https://img.shields.io/badge/Discord-0d1117?style=social&logo=discord" alt="Discord"/>
|
|
22
|
-
</a>
|
|
23
|
-
</p>
|
|
24
|
-
|
|
25
|
-
<p align="center">
|
|
26
|
-
<a href="https://www.bloomberg.com/news/videos/2025-03-31/wtrn-on-series-b-funding-growth-strategy-video">
|
|
27
|
-
<img src="https://wrtnlabs.io/agentica/images/badges/fund-raising-news-202503.svg" />
|
|
28
|
-
</a>
|
|
29
|
-
|
|
30
|
-
<a href="https://github.com/wrtnlabs">
|
|
31
|
-
<img src="https://wrtnlabs.io/agentica/images/badges/open-source-mission.svg" />
|
|
32
|
-
</a>
|
|
33
|
-
</p>
|
|
34
|
-
|
|
35
|
-
Agentic AI framework specialized in AI Function Calling.
|
|
36
|
-
|
|
37
|
-
Don't be afraid of AI agent development. Just list functions from three protocols below. This is everything you should do for AI agent development.
|
|
38
|
-
|
|
39
|
-
- TypeScript Class
|
|
40
|
-
- Swagger/OpenAPI Document
|
|
41
|
-
- MCP (Model Context Protocol) Server
|
|
42
|
-
|
|
43
|
-
Wanna make an e-commerce agent? Bring in e-commerce functions. Need a newspaper agent? Get API functions from the newspaper company. Just prepare any functions that you need, then it becomes an AI agent.
|
|
44
|
-
|
|
45
|
-
Are you a TypeScript developer? Then you're already an AI developer. Familiar with backend development? You're already well-versed in AI development. Anyone who can make functions can make AI agents.
|
|
46
|
-
|
|
47
|
-
<!-- eslint-skip -->
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
|
|
51
|
-
import { Agentica, assertHttpController } from "@agentica/core";
|
|
52
|
-
import OpenAI from "openai";
|
|
53
|
-
import typia from "typia";
|
|
54
|
-
|
|
55
|
-
import { MobileFileSystem } from "./services/MobileFileSystem";
|
|
56
|
-
|
|
57
|
-
const agent = new Agentica({
|
|
58
|
-
vendor: {
|
|
59
|
-
api: new OpenAI({ apiKey: "********" }),
|
|
60
|
-
model: "gpt-4o-mini",
|
|
61
|
-
},
|
|
62
|
-
controllers: [
|
|
63
|
-
// functions from TypeScript class
|
|
64
|
-
typia.llm.controller<MobileFileSystem>(
|
|
65
|
-
"filesystem",
|
|
66
|
-
new MobileFileSystem(),
|
|
67
|
-
),
|
|
68
|
-
// functions from Swagger/OpenAPI
|
|
69
|
-
assertHttpController({
|
|
70
|
-
name: "shopping",
|
|
71
|
-
model: "chatgpt",
|
|
72
|
-
document: await fetch(
|
|
73
|
-
"https://shopping-be.wrtn.ai/editor/swagger.json",
|
|
74
|
-
).then(r => r.json()),
|
|
75
|
-
connection: {
|
|
76
|
-
host: "https://shopping-be.wrtn.ai",
|
|
77
|
-
headers: { Authorization: "Bearer ********" },
|
|
78
|
-
},
|
|
79
|
-
}),
|
|
80
|
-
],
|
|
81
|
-
});
|
|
82
|
-
await agent.conversate("I wanna buy MacBook Pro");
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## 📦 Setup
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
$ npx agentica start <directory>
|
|
90
|
-
|
|
91
|
-
----------------------------------------
|
|
92
|
-
Agentica Setup Wizard
|
|
93
|
-
----------------------------------------
|
|
94
|
-
? Package Manager (use arrow keys)
|
|
95
|
-
> npm
|
|
96
|
-
pnpm
|
|
97
|
-
yarn (berry is not supported)
|
|
98
|
-
? Project Type
|
|
99
|
-
NodeJS Agent Server
|
|
100
|
-
> NestJS Agent Server
|
|
101
|
-
React Client Application
|
|
102
|
-
Standalone Application
|
|
103
|
-
? Embedded Controllers (multi-selectable)
|
|
104
|
-
(none)
|
|
105
|
-
Google Calendar
|
|
106
|
-
Google News
|
|
107
|
-
> Github
|
|
108
|
-
Reddit
|
|
109
|
-
Slack
|
|
110
|
-
...
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
The setup wizard helps you create a new project tailored to your needs.
|
|
114
|
-
|
|
115
|
-
For reference, when selecting a project type, any option other than "Standalone Application" will implement the [WebSocket Protocol](https://wrtnlabs.io/agentica/docs/websocket/) for client-server communication.
|
|
116
|
-
|
|
117
|
-
For comprehensive setup instructions, visit our [Getting Started](https://wrtnlabs.io/agentica/docs/) guide.
|
|
118
|
-
|
|
119
|
-
## 💻 Playground
|
|
120
|
-
|
|
121
|
-
Experience Agentica firsthand through our [interactive playground](https://wrtnlabs.io/agentica/playground) before installing.
|
|
122
|
-
|
|
123
|
-
Our demonstrations showcase the power and simplicity of Agentica's function calling capabilities across different integration methods.
|
|
124
|
-
|
|
125
|
-
- [TypeScript Class](https://wrtnlabs.io/agentica/playground/bbs)
|
|
126
|
-
- [Swagger/OpenAPI Document](https://wrtnlabs.io/agentica/playground/uploader)
|
|
127
|
-
- [Enterprise E-commerce Agent](https://wrtnlabs.io/agentica/playground/shopping)
|
|
128
|
-
|
|
129
|
-

|
|
130
|
-
|
|
131
|
-
<!--
|
|
132
|
-
@todo this section would be changed after making tutorial playground
|
|
133
|
-
-->
|
|
134
|
-
|
|
135
|
-
## 📚 Documentation Resources
|
|
136
|
-
|
|
137
|
-
Find comprehensive resources at our [official website](https://wrtnlabs.io/agentica).
|
|
138
|
-
|
|
139
|
-
- [Home](https://wrtnlabs.io/agentica)
|
|
140
|
-
- [Guide Documents](https://wrtnlabs.io/agentica/docs)
|
|
141
|
-
- [Setup](https://wrtnlabs.io/agentica/docs/setup/cli/)
|
|
142
|
-
- [Concepts](https://wrtnlabs.io/agentica/docs/concepts/function-calling/)
|
|
143
|
-
- [Core Library](https://wrtnlabs.io/agentica/docs/core/)
|
|
144
|
-
- [WebSocket Protocol](https://wrtnlabs.io/agentica/docs/websocket/)
|
|
145
|
-
- [Plugin Modules](https://wrtnlabs.io/agentica/docs/plugins/benchmark/)
|
|
146
|
-
- [Tutorial](https://wrtnlabs.io/agentica/tutorial)
|
|
147
|
-
- [Productivity](https://wrtnlabs.io/agentica/tutorial/productivity/arxiv/)
|
|
148
|
-
- [Coding](https://wrtnlabs.io/agentica/tutorial/coding/file-system/)
|
|
149
|
-
- [React Native](https://wrtnlabs.io/agentica/tutorial/react-native/sms/)
|
|
150
|
-
- [Enterprise](https://wrtnlabs.io/agentica/tutorial/enterprise/shopping/)
|
|
151
|
-
- [API Documents](https://wrtnlabs.io/agentica/api)
|
|
152
|
-
- [Youtube](https://www.youtube.com/@wrtnlabs)
|
|
153
|
-
- [Paper](https://wrtnlabs.io/agentica/paper)
|
|
154
|
-
|
|
155
|
-
https://github.com/user-attachments/assets/2f2a4cdc-6cf1-4304-b82d-04a8ed0be0dd
|
|
156
|
-
|
|
157
|
-
> Tutorial Videos: https://www.youtube.com/@wrtnlabs
|
|
158
|
-
|
|
159
|
-
## 🌟 Why Agentica?
|
|
160
|
-
|
|
161
|
-
```mermaid
|
|
162
|
-
flowchart
|
|
163
|
-
subgraph "JSON Schema Specification"
|
|
164
|
-
schemav4("JSON Schema v4 ~ v7") --upgrades--> emended[["OpenAPI v3.1 (emended)"]]
|
|
165
|
-
schema2910("JSON Schema 2019-03") --upgrades--> emended
|
|
166
|
-
schema2020("JSON Schema 2020-12") --emends--> emended
|
|
167
|
-
end
|
|
168
|
-
subgraph "Agentica"
|
|
169
|
-
emended --"Artificial Intelligence"--> fc{{"AI Function Calling"}}
|
|
170
|
-
fc --"OpenAI"--> chatgpt("ChatGPT")
|
|
171
|
-
fc --"Google"--> gemini("Gemini")
|
|
172
|
-
fc --"Anthropic"--> claude("Claude")
|
|
173
|
-
fc --"High-Flyer"--> deepseek("DeepSeek")
|
|
174
|
-
fc --"Meta"--> llama("Llama")
|
|
175
|
-
chatgpt --"3.1"--> custom(["Custom JSON Schema"])
|
|
176
|
-
gemini --"3.0"--> custom(["Custom JSON Schema"])
|
|
177
|
-
claude --"3.1"--> standard(["Standard JSON Schema"])
|
|
178
|
-
deepseek --"3.1"--> standard
|
|
179
|
-
llama --"3.1"--> standard
|
|
180
|
-
end
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Agentica enhances AI function calling by the following strategies:
|
|
184
|
-
|
|
185
|
-
- [**Compiler Driven Development**](https://wrtnlabs.io/agentica/docs/concepts/compiler-driven-development): constructs function calling schema automatically by compiler skills without hand-writing.
|
|
186
|
-
- [**JSON Schema Conversion**](https://wrtnlabs.io/agentica/docs/core/vendor/#schema-specification): automatically handles specification differences between LLM vendors, ensuring seamless integration regardless of your chosen AI model.
|
|
187
|
-
- [**Validation Feedback**](https://wrtnlabs.io/agentica/docs/concepts/function-calling#validation-feedback): detects and corrects AI mistakes in argument composition, dramatically reducing errors and improving reliability.
|
|
188
|
-
- [**Selector Agent**](https://wrtnlabs.io/agentica/docs/concepts/function-calling#orchestration-strategy): filtering candidate functions to minimize context usage, optimize performance, and reduce token consumption.
|
|
189
|
-
|
|
190
|
-
Thanks to these innovations, Agentica makes AI function calling easier, safer, and more accurate than before. Development becomes more intuitive since you only need to prepare functions relevant to your specific use case, and scaling your agent's capabilities is as simple as adding or removing functions.
|
|
191
|
-
|
|
192
|
-
In 2023, when OpenAI announced function calling, many predicted that function calling-driven AI development would become the mainstream. However, in reality, due to the difficulty and instability of function calling, the trend in AI development became agent workflow. Agent workflow, which is inflexible and must be created for specific purposes, has conquered the AI agent ecosystem.
|
|
193
|
-
|
|
194
|
-
By the way, as Agentica has resolved the difficulty and instability problems of function calling, the time has come to embrace function-driven AI development once again.
|
|
195
|
-
|
|
196
|
-
| Type | Workflow | Vanilla Function Calling | Agentica Function Calling |
|
|
197
|
-
| ----------- | ------------- | ------------------------ | ------------------------- |
|
|
198
|
-
| Purpose | ❌ Specific | 🟢 General | 🟢 General |
|
|
199
|
-
| Difficulty | ❌ Difficult | ❌ Difficult | 🟢 Easy |
|
|
200
|
-
| Stability | 🟢 Stable | ❌ Unstable | 🟢 Stable |
|
|
201
|
-
| Flexibility | ❌ Inflexible | 🟢 Flexible | 🟢 Flexible |
|
|
202
|
-
|
|
203
|
-
## 💬 Community & Support
|
|
204
|
-
|
|
205
|
-
For support, questions, or to provide feedback, join our Discord community:
|
|
206
|
-
|
|
207
|
-
[](https://discord.gg/aMhRmzkqCx)
|
|
208
|
-
|
|
209
|
-
## ⚖️ License
|
|
210
|
-
|
|
211
|
-
Agentica is open-source and available under the [MIT License](https://github.com/wrtnlabs/agentica/blob/master/LICENSE).
|
|
212
|
-
|
|
213
|
-
<p align="center">
|
|
214
|
-
<img src="https://github.com/user-attachments/assets/ecd0b82e-bfb7-4eb5-ae97-75be0cb22f10" alt="Wrtn Labs Logo" />
|
|
215
|
-
</p>
|
|
216
|
-
<div align="center">
|
|
217
|
-
Agentica is maintained by <a href="https://wrtnlabs.io">Wrtn Technologies</a> — Empowering developers to transform TypeScript functions and OpenAPI specs into powerful AI agents.
|
|
218
|
-
</div>
|
|
1
|
+
# Agentica, AI Function Calling Framework
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
<!-- Github/NPM Badges -->
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://github.com/wrtnlabs/agentica/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License"/></a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/@agentica/core"><img src="https://img.shields.io/npm/v/@agentica/core.svg" alt="NPM Version"/></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@agentica/core"><img src="https://img.shields.io/npm/dm/@agentica/core.svg" alt="NPM Downloads"/></a>
|
|
10
|
+
<a href="https://dormoshe.io/newsletters/373"><img src="https://img.shields.io/badge/DorMoshe%20Newsletter-Top%20%236%20of%201K-orange?style=flat&logo=rss" alt="Newsletter Top #6"/></a>
|
|
11
|
+
<a href="https://github.com/wrtnlabs/agentica/actions?query=workflow%3Abuild"><img src="https://github.com/wrtnlabs/agentica/workflows/build/badge.svg" alt="Build Status"/></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<!-- Youtube + Discord -->
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://www.youtube.com/@wrtnlabs">
|
|
17
|
+
<img src="https://img.shields.io/badge/YouTube%20Tutorial-0d1117?style=social&logo=youtube" alt="YouTube"/>
|
|
18
|
+
</a>
|
|
19
|
+
|
|
20
|
+
<a href="https://discord.gg/aMhRmzkqCx">
|
|
21
|
+
<img src="https://img.shields.io/badge/Discord-0d1117?style=social&logo=discord" alt="Discord"/>
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="https://www.bloomberg.com/news/videos/2025-03-31/wtrn-on-series-b-funding-growth-strategy-video">
|
|
27
|
+
<img src="https://wrtnlabs.io/agentica/images/badges/fund-raising-news-202503.svg" />
|
|
28
|
+
</a>
|
|
29
|
+
|
|
30
|
+
<a href="https://github.com/wrtnlabs">
|
|
31
|
+
<img src="https://wrtnlabs.io/agentica/images/badges/open-source-mission.svg" />
|
|
32
|
+
</a>
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
Agentic AI framework specialized in AI Function Calling.
|
|
36
|
+
|
|
37
|
+
Don't be afraid of AI agent development. Just list functions from three protocols below. This is everything you should do for AI agent development.
|
|
38
|
+
|
|
39
|
+
- TypeScript Class
|
|
40
|
+
- Swagger/OpenAPI Document
|
|
41
|
+
- MCP (Model Context Protocol) Server
|
|
42
|
+
|
|
43
|
+
Wanna make an e-commerce agent? Bring in e-commerce functions. Need a newspaper agent? Get API functions from the newspaper company. Just prepare any functions that you need, then it becomes an AI agent.
|
|
44
|
+
|
|
45
|
+
Are you a TypeScript developer? Then you're already an AI developer. Familiar with backend development? You're already well-versed in AI development. Anyone who can make functions can make AI agents.
|
|
46
|
+
|
|
47
|
+
<!-- eslint-skip -->
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
|
|
51
|
+
import { Agentica, assertHttpController } from "@agentica/core";
|
|
52
|
+
import OpenAI from "openai";
|
|
53
|
+
import typia from "typia";
|
|
54
|
+
|
|
55
|
+
import { MobileFileSystem } from "./services/MobileFileSystem";
|
|
56
|
+
|
|
57
|
+
const agent = new Agentica({
|
|
58
|
+
vendor: {
|
|
59
|
+
api: new OpenAI({ apiKey: "********" }),
|
|
60
|
+
model: "gpt-4o-mini",
|
|
61
|
+
},
|
|
62
|
+
controllers: [
|
|
63
|
+
// functions from TypeScript class
|
|
64
|
+
typia.llm.controller<MobileFileSystem>(
|
|
65
|
+
"filesystem",
|
|
66
|
+
new MobileFileSystem(),
|
|
67
|
+
),
|
|
68
|
+
// functions from Swagger/OpenAPI
|
|
69
|
+
assertHttpController({
|
|
70
|
+
name: "shopping",
|
|
71
|
+
model: "chatgpt",
|
|
72
|
+
document: await fetch(
|
|
73
|
+
"https://shopping-be.wrtn.ai/editor/swagger.json",
|
|
74
|
+
).then(r => r.json()),
|
|
75
|
+
connection: {
|
|
76
|
+
host: "https://shopping-be.wrtn.ai",
|
|
77
|
+
headers: { Authorization: "Bearer ********" },
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
],
|
|
81
|
+
});
|
|
82
|
+
await agent.conversate("I wanna buy MacBook Pro");
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 📦 Setup
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
$ npx agentica start <directory>
|
|
90
|
+
|
|
91
|
+
----------------------------------------
|
|
92
|
+
Agentica Setup Wizard
|
|
93
|
+
----------------------------------------
|
|
94
|
+
? Package Manager (use arrow keys)
|
|
95
|
+
> npm
|
|
96
|
+
pnpm
|
|
97
|
+
yarn (berry is not supported)
|
|
98
|
+
? Project Type
|
|
99
|
+
NodeJS Agent Server
|
|
100
|
+
> NestJS Agent Server
|
|
101
|
+
React Client Application
|
|
102
|
+
Standalone Application
|
|
103
|
+
? Embedded Controllers (multi-selectable)
|
|
104
|
+
(none)
|
|
105
|
+
Google Calendar
|
|
106
|
+
Google News
|
|
107
|
+
> Github
|
|
108
|
+
Reddit
|
|
109
|
+
Slack
|
|
110
|
+
...
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The setup wizard helps you create a new project tailored to your needs.
|
|
114
|
+
|
|
115
|
+
For reference, when selecting a project type, any option other than "Standalone Application" will implement the [WebSocket Protocol](https://wrtnlabs.io/agentica/docs/websocket/) for client-server communication.
|
|
116
|
+
|
|
117
|
+
For comprehensive setup instructions, visit our [Getting Started](https://wrtnlabs.io/agentica/docs/) guide.
|
|
118
|
+
|
|
119
|
+
## 💻 Playground
|
|
120
|
+
|
|
121
|
+
Experience Agentica firsthand through our [interactive playground](https://wrtnlabs.io/agentica/playground) before installing.
|
|
122
|
+
|
|
123
|
+
Our demonstrations showcase the power and simplicity of Agentica's function calling capabilities across different integration methods.
|
|
124
|
+
|
|
125
|
+
- [TypeScript Class](https://wrtnlabs.io/agentica/playground/bbs)
|
|
126
|
+
- [Swagger/OpenAPI Document](https://wrtnlabs.io/agentica/playground/uploader)
|
|
127
|
+
- [Enterprise E-commerce Agent](https://wrtnlabs.io/agentica/playground/shopping)
|
|
128
|
+
|
|
129
|
+

|
|
130
|
+
|
|
131
|
+
<!--
|
|
132
|
+
@todo this section would be changed after making tutorial playground
|
|
133
|
+
-->
|
|
134
|
+
|
|
135
|
+
## 📚 Documentation Resources
|
|
136
|
+
|
|
137
|
+
Find comprehensive resources at our [official website](https://wrtnlabs.io/agentica).
|
|
138
|
+
|
|
139
|
+
- [Home](https://wrtnlabs.io/agentica)
|
|
140
|
+
- [Guide Documents](https://wrtnlabs.io/agentica/docs)
|
|
141
|
+
- [Setup](https://wrtnlabs.io/agentica/docs/setup/cli/)
|
|
142
|
+
- [Concepts](https://wrtnlabs.io/agentica/docs/concepts/function-calling/)
|
|
143
|
+
- [Core Library](https://wrtnlabs.io/agentica/docs/core/)
|
|
144
|
+
- [WebSocket Protocol](https://wrtnlabs.io/agentica/docs/websocket/)
|
|
145
|
+
- [Plugin Modules](https://wrtnlabs.io/agentica/docs/plugins/benchmark/)
|
|
146
|
+
- [Tutorial](https://wrtnlabs.io/agentica/tutorial)
|
|
147
|
+
- [Productivity](https://wrtnlabs.io/agentica/tutorial/productivity/arxiv/)
|
|
148
|
+
- [Coding](https://wrtnlabs.io/agentica/tutorial/coding/file-system/)
|
|
149
|
+
- [React Native](https://wrtnlabs.io/agentica/tutorial/react-native/sms/)
|
|
150
|
+
- [Enterprise](https://wrtnlabs.io/agentica/tutorial/enterprise/shopping/)
|
|
151
|
+
- [API Documents](https://wrtnlabs.io/agentica/api)
|
|
152
|
+
- [Youtube](https://www.youtube.com/@wrtnlabs)
|
|
153
|
+
- [Paper](https://wrtnlabs.io/agentica/paper)
|
|
154
|
+
|
|
155
|
+
https://github.com/user-attachments/assets/2f2a4cdc-6cf1-4304-b82d-04a8ed0be0dd
|
|
156
|
+
|
|
157
|
+
> Tutorial Videos: https://www.youtube.com/@wrtnlabs
|
|
158
|
+
|
|
159
|
+
## 🌟 Why Agentica?
|
|
160
|
+
|
|
161
|
+
```mermaid
|
|
162
|
+
flowchart
|
|
163
|
+
subgraph "JSON Schema Specification"
|
|
164
|
+
schemav4("JSON Schema v4 ~ v7") --upgrades--> emended[["OpenAPI v3.1 (emended)"]]
|
|
165
|
+
schema2910("JSON Schema 2019-03") --upgrades--> emended
|
|
166
|
+
schema2020("JSON Schema 2020-12") --emends--> emended
|
|
167
|
+
end
|
|
168
|
+
subgraph "Agentica"
|
|
169
|
+
emended --"Artificial Intelligence"--> fc{{"AI Function Calling"}}
|
|
170
|
+
fc --"OpenAI"--> chatgpt("ChatGPT")
|
|
171
|
+
fc --"Google"--> gemini("Gemini")
|
|
172
|
+
fc --"Anthropic"--> claude("Claude")
|
|
173
|
+
fc --"High-Flyer"--> deepseek("DeepSeek")
|
|
174
|
+
fc --"Meta"--> llama("Llama")
|
|
175
|
+
chatgpt --"3.1"--> custom(["Custom JSON Schema"])
|
|
176
|
+
gemini --"3.0"--> custom(["Custom JSON Schema"])
|
|
177
|
+
claude --"3.1"--> standard(["Standard JSON Schema"])
|
|
178
|
+
deepseek --"3.1"--> standard
|
|
179
|
+
llama --"3.1"--> standard
|
|
180
|
+
end
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Agentica enhances AI function calling by the following strategies:
|
|
184
|
+
|
|
185
|
+
- [**Compiler Driven Development**](https://wrtnlabs.io/agentica/docs/concepts/compiler-driven-development): constructs function calling schema automatically by compiler skills without hand-writing.
|
|
186
|
+
- [**JSON Schema Conversion**](https://wrtnlabs.io/agentica/docs/core/vendor/#schema-specification): automatically handles specification differences between LLM vendors, ensuring seamless integration regardless of your chosen AI model.
|
|
187
|
+
- [**Validation Feedback**](https://wrtnlabs.io/agentica/docs/concepts/function-calling#validation-feedback): detects and corrects AI mistakes in argument composition, dramatically reducing errors and improving reliability.
|
|
188
|
+
- [**Selector Agent**](https://wrtnlabs.io/agentica/docs/concepts/function-calling#orchestration-strategy): filtering candidate functions to minimize context usage, optimize performance, and reduce token consumption.
|
|
189
|
+
|
|
190
|
+
Thanks to these innovations, Agentica makes AI function calling easier, safer, and more accurate than before. Development becomes more intuitive since you only need to prepare functions relevant to your specific use case, and scaling your agent's capabilities is as simple as adding or removing functions.
|
|
191
|
+
|
|
192
|
+
In 2023, when OpenAI announced function calling, many predicted that function calling-driven AI development would become the mainstream. However, in reality, due to the difficulty and instability of function calling, the trend in AI development became agent workflow. Agent workflow, which is inflexible and must be created for specific purposes, has conquered the AI agent ecosystem.
|
|
193
|
+
|
|
194
|
+
By the way, as Agentica has resolved the difficulty and instability problems of function calling, the time has come to embrace function-driven AI development once again.
|
|
195
|
+
|
|
196
|
+
| Type | Workflow | Vanilla Function Calling | Agentica Function Calling |
|
|
197
|
+
| ----------- | ------------- | ------------------------ | ------------------------- |
|
|
198
|
+
| Purpose | ❌ Specific | 🟢 General | 🟢 General |
|
|
199
|
+
| Difficulty | ❌ Difficult | ❌ Difficult | 🟢 Easy |
|
|
200
|
+
| Stability | 🟢 Stable | ❌ Unstable | 🟢 Stable |
|
|
201
|
+
| Flexibility | ❌ Inflexible | 🟢 Flexible | 🟢 Flexible |
|
|
202
|
+
|
|
203
|
+
## 💬 Community & Support
|
|
204
|
+
|
|
205
|
+
For support, questions, or to provide feedback, join our Discord community:
|
|
206
|
+
|
|
207
|
+
[](https://discord.gg/aMhRmzkqCx)
|
|
208
|
+
|
|
209
|
+
## ⚖️ License
|
|
210
|
+
|
|
211
|
+
Agentica is open-source and available under the [MIT License](https://github.com/wrtnlabs/agentica/blob/master/LICENSE).
|
|
212
|
+
|
|
213
|
+
<p align="center">
|
|
214
|
+
<img src="https://github.com/user-attachments/assets/ecd0b82e-bfb7-4eb5-ae97-75be0cb22f10" alt="Wrtn Labs Logo" />
|
|
215
|
+
</p>
|
|
216
|
+
<div align="center">
|
|
217
|
+
Agentica is maintained by <a href="https://wrtnlabs.io">Wrtn Technologies</a> — Empowering developers to transform TypeScript functions and OpenAPI specs into powerful AI agents.
|
|
218
|
+
</div>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { IHttpLlmFunction } from "@typia/interface";
|
|
2
1
|
export interface __IChatInitialApplication {
|
|
3
2
|
/**
|
|
4
3
|
* Get list of API functions.
|
|
@@ -10,5 +9,5 @@ export interface __IChatInitialApplication {
|
|
|
10
9
|
* Also, user just wants to list up every remote API functions that can be
|
|
11
10
|
* called from the backend server, utilize this function too.
|
|
12
11
|
*/
|
|
13
|
-
getApiFunctions: (props: object) => Promise<
|
|
12
|
+
getApiFunctions: (props: object) => Promise<void>;
|
|
14
13
|
}
|
|
@@ -5,12 +5,12 @@ const utils_1 = require("@typia/utils");
|
|
|
5
5
|
const AgenticaConstant_1 = require("../constants/AgenticaConstant");
|
|
6
6
|
class AgenticaJsonParseError extends Error {
|
|
7
7
|
constructor(failure) {
|
|
8
|
-
super((0, utils_1.dedent) `
|
|
9
|
-
Invalid JSON format. The parsing failed after ${AgenticaConstant_1.AgenticaConstant.RETRY} retries.
|
|
10
|
-
|
|
11
|
-
\`\`\`json
|
|
12
|
-
${JSON.stringify(failure, null, 2)}
|
|
13
|
-
\`\`\`
|
|
8
|
+
super((0, utils_1.dedent) `
|
|
9
|
+
Invalid JSON format. The parsing failed after ${AgenticaConstant_1.AgenticaConstant.RETRY} retries.
|
|
10
|
+
|
|
11
|
+
\`\`\`json
|
|
12
|
+
${JSON.stringify(failure, null, 2)}
|
|
13
|
+
\`\`\`
|
|
14
14
|
`);
|
|
15
15
|
const proto = new.target.prototype;
|
|
16
16
|
// eslint-disable-next-line
|
package/lib/index.mjs
CHANGED
|
@@ -1839,8 +1839,6 @@ const FUNCTION$2 = __typia_transform__llmApplicationFinalize._llmApplicationFina
|
|
|
1839
1839
|
};
|
|
1840
1840
|
})()
|
|
1841
1841
|
} ]
|
|
1842
|
-
}, {
|
|
1843
|
-
equals: false
|
|
1844
1842
|
}).functions[0];
|
|
1845
1843
|
|
|
1846
1844
|
async function cancel(ctx) {
|
|
@@ -2026,9 +2024,53 @@ const ChatGptDescribeFunctionAgent = {
|
|
|
2026
2024
|
};
|
|
2027
2025
|
|
|
2028
2026
|
const FUNCTION$1 = __typia_transform__llmApplicationFinalize._llmApplicationFinalize({
|
|
2029
|
-
functions: [
|
|
2030
|
-
|
|
2031
|
-
|
|
2027
|
+
functions: [ {
|
|
2028
|
+
name: "getApiFunctions",
|
|
2029
|
+
parameters: {
|
|
2030
|
+
description: "Current Type: {@link object}",
|
|
2031
|
+
type: "object",
|
|
2032
|
+
properties: {},
|
|
2033
|
+
required: [],
|
|
2034
|
+
additionalProperties: false,
|
|
2035
|
+
$defs: {}
|
|
2036
|
+
},
|
|
2037
|
+
description: "Get list of API functions.\n\nIf user seems like to request some function calling except this one,\ncall this `getApiFunctions()` to get the list of candidate API functions\nprovided from this application.\n\nAlso, user just wants to list up every remote API functions that can be\ncalled from the backend server, utilize this function too.",
|
|
2038
|
+
validate: (() => {
|
|
2039
|
+
const _io0 = input => true;
|
|
2040
|
+
const _vo0 = (input, _path, _exceptionable = true) => true;
|
|
2041
|
+
const __is = input => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0();
|
|
2042
|
+
let errors;
|
|
2043
|
+
let _report;
|
|
2044
|
+
return input => {
|
|
2045
|
+
if (false === __is(input)) {
|
|
2046
|
+
errors = [];
|
|
2047
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
2048
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input && false === Array.isArray(input) || _report(true, {
|
|
2049
|
+
path: _path + "",
|
|
2050
|
+
expected: "object",
|
|
2051
|
+
value: input
|
|
2052
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
2053
|
+
path: _path + "",
|
|
2054
|
+
expected: "object",
|
|
2055
|
+
value: input
|
|
2056
|
+
}))(input, "$input", true);
|
|
2057
|
+
const success = 0 === errors.length;
|
|
2058
|
+
return success ? {
|
|
2059
|
+
success,
|
|
2060
|
+
data: input
|
|
2061
|
+
} : {
|
|
2062
|
+
success,
|
|
2063
|
+
errors,
|
|
2064
|
+
data: input
|
|
2065
|
+
};
|
|
2066
|
+
}
|
|
2067
|
+
return {
|
|
2068
|
+
success: true,
|
|
2069
|
+
data: input
|
|
2070
|
+
};
|
|
2071
|
+
};
|
|
2072
|
+
})()
|
|
2073
|
+
} ]
|
|
2032
2074
|
}).functions[0];
|
|
2033
2075
|
|
|
2034
2076
|
async function initialize(ctx) {
|
|
@@ -2189,8 +2231,6 @@ const FUNCTION = __typia_transform__llmApplicationFinalize._llmApplicationFinali
|
|
|
2189
2231
|
};
|
|
2190
2232
|
})()
|
|
2191
2233
|
} ]
|
|
2192
|
-
}, {
|
|
2193
|
-
equals: false
|
|
2194
2234
|
}).functions[0];
|
|
2195
2235
|
|
|
2196
2236
|
async function select(ctx) {
|