@aiagenta2z/agtm 1.0.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/README.md ADDED
@@ -0,0 +1,305 @@
1
+ # # AI Agent Marketplace Index| AI Agent Directory | AI Agent Store to Host All Available AI Agents | OneKey AI Agent Router | Agent Moneytization
2
+
3
+ [Github](https://github.com/aiagenta2z/ai-agent-marketplace)|[Huggingface](https://huggingface.co/datasets/DeepNLP/AI-Agent-Marketplace-Index)|[Pypi](https://pypi.org/project/ai-agent-marketplace/) | [Open Source AI Agent Marketplace DeepNLP](https://www.deepnlp.org/store/ai-agent)|[Agent RL Dataset](https://www.deepnlp.org/store/dataset)
4
+
5
+ This is the official github repo for pypi package ai_agent_marketplace [https://pypi.org/project/ai-agent-marketplace](https://pypi.org/project/ai-agent-marketplace).
6
+ The repo Open Source AI Agent Marketplace and deepnlp.org website [AI Agent Marketplace Store & Search Engine](http://www.deepnlp.org/store/ai-agent) aims to provides a public repo and index of more than 10K+ AI Agent information from 30+ categories in the communities, such as autonomous agent, chatbots, Computer and Mobile phone use agents, robotic agents, and various industries such as business, finance, law, medical or healthcare, etc. The directory are updated to websites from both public repo (github/huggingface) as well as AI Agent services in cloud service provider (Microsoft Azure AWS, Copilot, OpenAI Agent app Store GPT Store, Google Cloud, etc).
7
+
8
+
9
+ **AI Agent Marketplace Distribution By Category**<br>
10
+
11
+ <img src="https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/ai_agent_marketplace_distribution.png" style="height:600px;" alt="AI Agent Marketplace Category">
12
+
13
+ We would like to help developers and end users within the lifecycle of AI agent development. From the registration, deployment, Agent router, API calling, metric/traffic tracking, and finally to the stage of moneyterization from your AI Agent. Anyone can submit their AI agents card information, code, APIs, pricing plans to the public registry, just like your submit a paper to arxiv.org and submit models to huggingface.co.
14
+
15
+ ```mermaid
16
+
17
+ graph LR
18
+
19
+ Dev[Developers]--> A[AI Agent/MCP Development] --> B[Deloyment] --> C[AI Agent Registry to Marketplace] --> D[Agent Search and Exploration]
20
+
21
+ U[Users] --> R[Agent Router & Data Tracking] --> F[API Billing System​] --> G[Feedback Comments & Discussion] --> H[Moneytization]
22
+
23
+ ```
24
+
25
+ # Main Features
26
+ 1. **AI Agent Registry**: You can submit your AI Agent's meta to the [Official AI Agent Marketplace Registry](https://www.deepnlp.org/workspace/my_ai_services) directly on website or using various methods (python,nodejs, curl, etc). After submitting your AI Agent meta and approval, community will find your AI Agent in each categories. We also host available submission from various agent store or build in any infrastractures, such as OpenAI Apps SDK, Claude MCPs, etc.
27
+ 2. **AI Agent Search Engine and Search API**: Users are able to search and explore your AI Agent through [AI Agent Search Engine](https://www.deepnlp.org/search/agent) and you can also access the AI Agent Meta Index through [Search API](https://www.deepnlp.org/doc/ai_agent_marketplace) and [MCP servers](https://github.com/aiagenta2z/ai-agent-marketplace-index-mcp) also.
28
+ 3. **OneKey Agent Router**: [OneKey Agent Router](https://www.deepnlp.org/agent/onekey-ai-agent-router) aims to router users' request to your AI Agent or MCPs' registered http APIs using only one access key authentication, which can help users simplify their registration process. We initialize a OneKey revenue sharing credit plans to help you gain from the free-tier users.
29
+ 4. **Traffic Tracking**: Traffic tracking service to your AI Agents, ranging from API calls from the OneKey Router,GitHub Stars,Google/Bing search engine rankings,
30
+ 5. **Users Genunie Reviews & Discussion**: Users can sort the AI Agent meta by reviews, ratings and find good AI Agent of different categories.
31
+ 6. **AI Agent Moneyterization**: Getting payment account for your AI Agent is not easy, we provides Stripe, Alipay, Credit card payment methods based on a unified credit charging system and and you can gain credits in your billing account from users' request. You can purchase datasets, call LLM and commercial MCPs (Google Maps, Google Search, etc) and withdraw.
32
+ 7. **Dataset for Research**: We provide full snapshot of AI Agent Marketplace dataset periodically back to the community on [Huggingface](https://huggingface.co/datasets/DeepNLP/AI-Agent-Marketplace-Index), so researchers can track the growth.
33
+
34
+
35
+ **AI Agent Marketplace and Search Engine**<br>
36
+ <img src="https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/AI%20Agent%20Marketplace%20Search.jpg" style="height:300px;" alt="AI Agent Marketplace Index and Search">
37
+
38
+ **AI Agent Registration**<br>
39
+ <img src="https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/ai_agent_registry.jpg" style="height:300px;" alt="AI Agent Registry">
40
+
41
+ **AI Agent Calls Credit Usage**<br>
42
+ <img src="https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/ai_agent_credit.jpg" style="height:300px;" alt="AI Agent Registry">
43
+
44
+ **Traffic Tracking**<br>
45
+ <img src="https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/ai_search_ranking_chart.jpg" style="height:300px;">
46
+
47
+ **OneKey Router**<br>
48
+ <img src="https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/onekey_api_router.jpg" style="height:300px;" alt="AI Agent OneKey Router">
49
+
50
+ **Users Genunie Reviews**<br>
51
+ <img src="https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/ai_agent_user_reviews.jpg" style="height:300px;">
52
+
53
+
54
+ ## Short Cut to AI Agent Marketplace Markdown
55
+ - [AI AGENT Marketplace Collection](./AGENT.md)
56
+ - [Email Writing AI Agent](./AGENT.md#email-writing-ai-agent)
57
+ - [BENCHMARK AI Agent](./AGENT.md#benchmark-ai-agent)
58
+
59
+
60
+ ## Usage
61
+ 1. **AI Agent Registry**
62
+
63
+ List of Methods that you can register your AI agent
64
+
65
+ | method | usage |
66
+ |-------------|----------------------------------------------------------------------------------------------------------------------|
67
+ | Website | Visit the [official AI Agent registry](https://www.deepnlp.org/workspace/my_ai_services) |
68
+ | curl | Support to Submit your Github Repo contents to the marketplace |
69
+ | Command CLI | You can use command line `agtm --upload` to register your AI agent, and `agtm --search` to explore various AI agents |
70
+ | python | Install packages `pip install ai_agent_marketplace` |
71
+ | nodejs | Install packages `npm install -g @aiagenta2z/agtm` |
72
+
73
+
74
+ ### Curl
75
+
76
+ Best suitable when you already put your AI Agent introduction on github and you can just curl to the registry.
77
+
78
+ Let's say you want to submit an MCP github repo, we use the markitdown repo for example: https://github.com/microsoft/markitdown.
79
+
80
+ Firstly, get the keys from [Keys Generation](https://www.deepnlp.org/workspace/keys) generate `AI_AGENT_MARKETPLACE_ACCESS_KEY` as developer.
81
+
82
+ ```
83
+ curl -X POST https://www.deepnlp.org/api/ai_agent_marketplace/registry -H "Content-Type: application/json" -d '{"github":"https://github.com/microsoft/markitdown", "access_key":"{AI_AGENT_MARKETPLACE_ACCESS_KEY}"}'
84
+ ```
85
+
86
+
87
+ ### Command Line CLI
88
+
89
+ The command line `agtm --upload` , 'agtm' means 'ai agent marketplace' or 'ai agent manager'
90
+ To use the command line, you need to first install the package either using python or node environment
91
+
92
+ #### Install and Use `agtm` CLI
93
+ ``` Python
94
+ pip install ai_agent_marketplace
95
+ ```
96
+ or
97
+ ``` NodeJS
98
+ npm install -g @aiagenta2z/agtm
99
+ ```
100
+
101
+ Command line to register your AI agent from GitHub, Local config(agent.json, agent.yaml) or search the AI agent marketplace.
102
+ To see detailed usage, visit the GitHub of `agtm` at (https://github.com/aiagenta2z/ai-agent-marketplace)
103
+
104
+ First you need to setup an access_key in the environment to authenticate.
105
+ Register your AI Agent Marketplace Access Key here (https://deepnlp.org/workspace/keys)
106
+ ```
107
+ export AI_AGENT_MARKETPLACE_ACCESS_KEY="${your_access_key}"
108
+ agtm upload --github https://github.com/aiagenta2z/ai-agent-marketplace
109
+
110
+ ## Or register from local config of AI Agent meta
111
+ agtm upload --config ./agent.json
112
+ agtm upload --config ./agent.yaml
113
+
114
+ ## Search Open Source AI Agent marketplace of deepnlp
115
+ agtm search --q 'coding agent'
116
+ agtm search --id 'google-maps/google-maps'
117
+
118
+ ```
119
+
120
+ ### Python
121
+
122
+ #### Install
123
+ ```
124
+ pip install ai_agent_marketplace
125
+
126
+ ```
127
+
128
+ Get [Keys](https://deepnlp.org/workspace/keys) and Register your AI Agent
129
+ ```
130
+ export AI_AGENT_MARKETPLACE_API_KEY={Your API Key}
131
+ ```
132
+
133
+ submit your AI Agent
134
+ ```
135
+ import ai_agent_marketplace as aa
136
+ import json
137
+
138
+ def publish_your_agent():
139
+ """
140
+ access_key can be obtained from your personal page:
141
+ www.deepnlp.orgworkspace/my_ai_services
142
+ once you submit, it's pending approval and you can track the data then
143
+ get your access_key from http://www.deepnlp.org/workspace/my_ai_services
144
+ """
145
+ access_key = "${your_access_key}"
146
+ name = "My First AI Agent"
147
+
148
+ item_info = {}
149
+ item_info["content"] = "This AI Agent can do complicated programming work for humans"
150
+ item_info["website"] = "https://www.my_first_agent.com"
151
+ item_info["field"] = "AI AGENT"
152
+ item_info["subfield"] = "Coding Agent"
153
+ item_info["content_tag_list"] = "coding,python"
154
+ result = aa.add(access_key=access_key, name="My First Agent", item_info=item_info)
155
+ url = result["url"] if "url" in result else ""
156
+ msg = result["msg"] if "msg" in result else ""
157
+ print ("## DEBUG: AI Agent Marketplace Post msg is|%s" % str(msg))
158
+ print ("## DEBUG: AI Agent Marketplace Post url is|%s" % str(url))
159
+
160
+
161
+ publish_your_agent()
162
+ ```
163
+
164
+ ### NodeJs(NPX/NPM)
165
+ Install the package of 'ai_agent_marketplace' or 'agtm' for short.
166
+ ``` NodeJS
167
+ npm install -g @aiagenta2z/agtm
168
+ ```
169
+
170
+ AI Agent Registry using `agtm`
171
+
172
+ ```
173
+ export AI_AGENT_MARKETPLACE_ACCESS_KEY="${your_access_key}"
174
+ agtm upload --github https://github.com/aiagenta2z/ai-agent-marketplace
175
+
176
+ ## Or register from local config of AI Agent meta
177
+ agtm upload --config ./agent.json
178
+ agtm upload --config ./agent.yaml
179
+ ```
180
+
181
+ AI Agent Marketplace Search using `agtm` and nodejs
182
+ ```
183
+ agtm search --q 'coding agent'
184
+ agtm search --id 'google-maps/google-maps'
185
+ ```
186
+
187
+ 2. **AI Agent Search Engine and Search API**:
188
+
189
+
190
+ We provides both API and python package wrapper
191
+
192
+ ```
193
+
194
+ import ai_agent_marketplace as aa
195
+ import json
196
+
197
+ def search_ai_agent_traffic_data():
198
+
199
+ result = aa.search(q="Coding Agent Jetbrains")
200
+ print ("## DEBUG: search result is|%s" % str(result))
201
+
202
+ result2 = aa.search(q="Coding Agent", limit=20, timeout=5)
203
+ print ("## DEBUG: search result is|%s" % str(result2))
204
+
205
+ result3 = aa.search(q="", limit=20, timeout=5)
206
+ print ("## DEBUG: search result is|%s" % str(result3))
207
+
208
+ search_ai_agent_traffic_data()
209
+
210
+ ```
211
+
212
+ For example, we use the AI Agent MCP server [Google Maps MCP Servers](https://www.deepnlp.org/store/mcp-server/map/pub-google-maps/google-maps) as example.
213
+
214
+ The unique_id should follow the same /{owerid}/{item-id} format
215
+
216
+ ```
217
+ {
218
+ "unique_id": "google-maps/google-maps",
219
+ "content_name": "Google Maps MCPs",
220
+ "content": "Google Maps MCPs provides Location Service to support various APIs..."
221
+ "category": "Map",
222
+ "field": "MCP SERVER",
223
+ "subfield": "Map",
224
+ "content_tag_list": "official",
225
+ "website": "maps.google.com",
226
+ "content_tag_list": "maps,location"
227
+ "github": "https://github.com/modelcontextprotocol/servers/tree/main/src/google-maps"
228
+ }
229
+ ```
230
+
231
+ ### NodeJs
232
+ TBD
233
+
234
+
235
+ 3. OneKey Agent Router
236
+
237
+ Try Web App of Onekey [API Router Agent](https://agent.deepnlp.org/agent/mcp_tool_use)
238
+
239
+
240
+
241
+
242
+ 4. **Traffic and API Usage Tracking**
243
+
244
+ ### Key Metrics
245
+ Some of the key metric that DeepNLP AI Agent Marketplace monitors include:
246
+
247
+ - Bing/Google search result ranking
248
+ - IOS Android App Store Ranking
249
+ - Github Repo Ranking
250
+ - etc
251
+
252
+ ![AI Agent Navigation](https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/ai_agents_navigation.jpg)
253
+
254
+ You can visit [DeepNLP AI Agent Marketplace and Directory](http://www.deepnlp.org/store/ai-agent) to find more.
255
+
256
+ #### Search Ranking Performance
257
+
258
+ Suppose you want to find out some suitable AI Employees which can help you write reports or emails, schedule meeting, write codes, etc. You may use Google or Bing to search keywords like "AI Agent Employees", "Report Writing Agents", "Coding Agents", etc. And DeepNLP AI Agents Marketplace helps you monitor the AI Agents search results ranking. You can navigate to the "Email writing" tab of the AI Agent Directory and see the top reviewed AI Agents and its latested Bing Search Ranking.
259
+
260
+ And you can navigate the [Email Writing AI Agents Directory](http://www.deepnlp.org/store/ai-agent?tag=Email%20Writing) and find out some top rated AI Agents in Email Writing such as
261
+
262
+ ![Email Writing AI Agents](https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/image_email_writing_agents.jpg)
263
+
264
+
265
+ - [mailmeteor.com](http://www.deepnlp.org/store/ai-agent/email-writing/pub-mailmeteor-com/mailmeteor-com)
266
+ Bing Search Rank 2.0
267
+
268
+ - [galaxy.ai](http://www.deepnlp.org/store/ai-agent/email-writing/pub-galaxy-ai/galaxy-ai)
269
+ Bing Search Rank 3.0
270
+
271
+
272
+ The metric of Bing search results of AI agents are calculated on various related keywords and updated daily. And you can monitor the daily trends of fast growing AI agents.
273
+
274
+ ![Bing Search Ranking Trakcing Email Writing AI Agents](https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/image_email_meteor.jpg)
275
+
276
+
277
+ #### Github Performance
278
+
279
+ Some of the AI Agents are public available and you can use github to help you track the performance and help you find the best open source AI agents. You can visit the [AI Agent Directory of Coding Agents](http://www.deepnlp.org/store/ai-agent?tag=Coding%20Agent) and help you monitor the performance such as github repo stars.
280
+ [List of AI Coding Agent](https://www.deepnlp.org/store/ai-agent/coding-agent)
281
+
282
+ ![Coding AI Agents](https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/image_coding_agents.jpg)
283
+
284
+
285
+ Can you can find the popular stared Github projects such as:
286
+
287
+ - [Vanna AI](http://www.deepnlp.org/store/ai-agent/ai-agent/pub-vanna-ai/vanna-ai)
288
+ - [Cody](http://www.deepnlp.org/store/ai-agent/ai-agent/pub-cody-by-sourcegraph/cody-by-sourcegraph)
289
+ - [Taskweaver from microsoft](http://www.deepnlp.org/store/ai-agent/coding-agent/pub-taskweaver-microsoft/taskweaver-microsoft)
290
+
291
+ ![Taskweaver Agent Marketplace Tracking Github Star](https://github.com/aiagenta2z/ai-agent-marketplace/blob/main/docs/image_task_weaver_microsoft.jpg)
292
+
293
+
294
+ #### Dataset and API to Access the AI Agent
295
+
296
+ ![AI Agent Index for tracking Daily Search Metric](https://raw.githubusercontent.com/aiagenta2z/ai-agent-marketplace/refs/heads/main/docs/ai_search_ranking_chart.jpg)
297
+
298
+ |Snapshot| Dataset |
299
+ | 2025-10 | https://huggingface.co/datasets/DeepNLP/AI-Agent-Marketplace-Index |
300
+
301
+ ## Contributing
302
+
303
+ Please contribute to the AGENT.md to include links and introduction to your repo.
304
+
305
+
package/agent.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "My First AI Coding Agent",
3
+ "content": "This AI Agent can do complicated programming work for humans",
4
+ "website": "https://www.my_first_agent.com",
5
+ "field": "AI AGENT",
6
+ "subfield": "Coding Agent",
7
+ "content_tag_list": "coding,python",
8
+ "github": "",
9
+ "thumbnail_picture": "https://avatars.githubusercontent.com/u/242328252?s=200&v=4",
10
+ "upload_image_files": "",
11
+ "api": "https://www.my_first_agent.com/agent",
12
+ "price_type": "API Call",
13
+ "price_per_call_credit": 0.0,
14
+ "price_fixed_credit" : 0.0,
15
+ "price_subscription": "Basic: your basic plan introduction, Advanced: Your Advanced Plan introduction, etc."
16
+ }
package/agent.yaml ADDED
@@ -0,0 +1,14 @@
1
+ name: "My First AI Coding Agent"
2
+ content: "This AI Agent can do complicated programming work for humans"
3
+ website: "https://www.my_first_agent.com"
4
+ field: "AI AGENT"
5
+ subfield: "Coding Agent"
6
+ content_tag_list: "coding,python"
7
+ github: ""
8
+ thumbnail_picture: "https://avatars.githubusercontent.com/u/242328252?s=200&v=4"
9
+ upload_image_files: ""
10
+ api: "https://www.my_first_agent.com/agent"
11
+ price_type: "API Call"
12
+ price_per_call_credit: 0.0
13
+ price_fixed_credit: 0.0
14
+ price_subscription: "Basic: your basic plan introduction, Advanced: Your Advanced Plan introduction, etc."
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const commander_1 = require("commander");
40
+ const axios_1 = __importDefault(require("axios"));
41
+ const fs = __importStar(require("fs"));
42
+ const yaml = __importStar(require("js-yaml"));
43
+ // --- Configuration ---
44
+ const BASE_URL = 'https://www.deepnlp.org/api/ai_agent_marketplace';
45
+ const REGISTRY_ENDPOINT = `https://www.deepnlp.org/api/ai_agent_marketplace/registry`;
46
+ const SEARCH_ENDPOINT = `${BASE_URL}/api/ai_agent_marketplace/v2`; // Assuming a search endpoint exists
47
+ const ACCESS_KEY_ENV_VAR = 'AI_AGENT_MARKETPLACE_ACCESS_KEY';
48
+ // --- Utility Functions ---
49
+ /**
50
+ * Retrieves the access key from environment variables.
51
+ */
52
+ function getAccessKey() {
53
+ const key = process.env[ACCESS_KEY_ENV_VAR];
54
+ if (!key || key === '{AI_AGENT_MARKETPLACE_ACCESS_KEY}') {
55
+ console.error(`\n❌ Error: Access key not found.`);
56
+ console.error(`Please set the environment variable '${ACCESS_KEY_ENV_VAR}'.`);
57
+ console.error('You can get your access key from: https://deepnlp.org/workspace/keys');
58
+ process.exit(1);
59
+ }
60
+ return key;
61
+ }
62
+ /**
63
+ * Loads a configuration file (.json or .yaml) and returns the data.
64
+ */
65
+ function loadConfigFile(filePath) {
66
+ try {
67
+ const content = fs.readFileSync(filePath, 'utf8');
68
+ if (filePath.endsWith('.json')) {
69
+ return JSON.parse(content);
70
+ }
71
+ else if (filePath.endsWith('.yaml') || filePath.endsWith('.yml')) {
72
+ return yaml.load(content);
73
+ }
74
+ else {
75
+ throw new Error("Unsupported configuration file format. Must be .json or .yaml.");
76
+ }
77
+ }
78
+ catch (e) {
79
+ console.error(`\n❌ Error loading configuration file '${filePath}': ${e.message}`);
80
+ process.exit(1);
81
+ }
82
+ }
83
+ // --- Command Handlers ---
84
+ /**
85
+ * Handles the 'agtm upload' command.
86
+ */
87
+ async function handleUpload(options) {
88
+ const access_key = getAccessKey();
89
+ let item_info = {};
90
+ const url = options.endpoint || REGISTRY_ENDPOINT;
91
+ if (options.github) {
92
+ console.log(`\nAttempting to register agent from GitHub: ${options.github}`);
93
+ item_info.github = options.github;
94
+ }
95
+ else if (options.config) {
96
+ console.log(`\nAttempting to register agent from config file: ${options.config}`);
97
+ const file_content = loadConfigFile(options.config);
98
+ // Basic validation for config upload
99
+ if (!file_content.name || !file_content.content) {
100
+ console.error("❌ Error: Config file must contain 'name' and 'content' fields.");
101
+ process.exit(1);
102
+ }
103
+ item_info = file_content;
104
+ }
105
+ else {
106
+ // Should be handled by commander's required option check, but kept as safeguard.
107
+ console.error("❌ Error: 'upload' command requires either --github or --config.");
108
+ process.exit(1);
109
+ }
110
+ // Prepare payload (combining item info and access key)
111
+ const payload = { ...item_info, access_key };
112
+ console.log(`Submitting agent information to endpoint: ${url}`);
113
+ try {
114
+ const response = await axios_1.default.post(url, payload, {
115
+ headers: { 'Content-Type': 'application/json' },
116
+ // Set a reasonable timeout
117
+ timeout: 10000
118
+ });
119
+ const result = response.data;
120
+ const result_url = result.url || 'N/A';
121
+ const result_msg = result.msg || 'No message provided.';
122
+ if (response.status >= 200 && response.status < 300) {
123
+ console.log("\n✅ Registration Successful!");
124
+ console.log(` URL: ${result_url}`);
125
+ console.log(` Message: ${result_msg}`);
126
+ console.log(` Track its status at: ${result_url} or submit your AI Agent registry through online website https://www.deepnlp.org/workspace/my_ai_services`);
127
+ }
128
+ else {
129
+ console.log("\n❌ Registration Failed.");
130
+ console.log(` Status: ${response.status}`);
131
+ console.log(` Response Message: ${result_msg}`);
132
+ process.exit(1);
133
+ }
134
+ }
135
+ catch (e) {
136
+ const status = e.response ? e.response.status : 'N/A';
137
+ const msg = e.response?.data?.msg || e.message;
138
+ console.error(`\n❌ An unexpected error occurred during submission (Status: ${status}): ${msg}`);
139
+ process.exit(1);
140
+ }
141
+ }
142
+ /**
143
+ * Handles the 'agtm search' command.
144
+ */
145
+ async function handleSearch(options) {
146
+ const { q, id, countPerPage } = options;
147
+ if (!q && !id) {
148
+ console.error("❌ Error: 'search' command requires either -q (query) or --id (Agent ID).");
149
+ process.exit(1);
150
+ }
151
+ const searchParams = new URLSearchParams();
152
+ if (q)
153
+ searchParams.append('q', q);
154
+ if (id)
155
+ searchParams.append('id', id.toString());
156
+ searchParams.append('count_per_page', (countPerPage || 10).toString());
157
+ const url = `${SEARCH_ENDPOINT}?${searchParams.toString()}`;
158
+ console.log(`\nSearching marketplace at: ${url}`);
159
+ try {
160
+ const response = await axios_1.default.get(url, { timeout: 10000 });
161
+ const results = response.data;
162
+ console.log(`\n✅ Search Complete. Found ${results.length || 0} agents.`);
163
+ if (results.length) {
164
+ // Simplified output for CLI
165
+ results.slice(0, countPerPage || 10).forEach((agent) => {
166
+ console.log(`- ID: ${agent.id || 'N/A'}, Name: ${agent.name || 'N/A'}, Field: ${agent.field || 'N/A'}`);
167
+ });
168
+ if (results.length > (countPerPage || 10)) {
169
+ console.log(`...showing first ${countPerPage || 10} results.`);
170
+ }
171
+ }
172
+ }
173
+ catch (e) {
174
+ const msg = e.response?.data?.msg || e.message;
175
+ console.error(`\n❌ Error during search: ${msg}`);
176
+ process.exit(1);
177
+ }
178
+ }
179
+ // --- CLI Setup (Commander) ---
180
+ const program = new commander_1.Command();
181
+ program
182
+ .name('agtm')
183
+ .description('An Open Source Command-line Tool for AI Agents meta registry, AI Agents Marketplace Management, AI Agents Search and AI Agents Index Services. Help users to explore interesting AI Agents. Documentation: https://www.deepnlp.org/doc/ai_agent_marketplace, Marketplace: https://www.deepnlp.org/store/ai-agent')
184
+ .version('1.0.0');
185
+ // 1. UPLOAD Command
186
+ const uploadCommand = program.command('upload')
187
+ .description('Register or update AI Agent meta information in the marketplace.')
188
+ .action(handleUpload);
189
+ // Mutually Exclusive Group (managed with custom logic and checks)
190
+ uploadCommand.option('--github <url>', 'The GitHub repository URL for the open-sourced agent.');
191
+ uploadCommand.option('--config <path>', 'Path to a .json or .yaml file containing the agent\'s meta information.');
192
+ // Custom check for the required mutual exclusion
193
+ uploadCommand.option('--endpoint <url>', 'The endpoint URL to post data to (overrides default).', REGISTRY_ENDPOINT);
194
+ uploadCommand.hook('preAction', (thisCommand) => {
195
+ const options = thisCommand.opts();
196
+ if (!options.github && !options.config) {
197
+ console.error("\n❌ Error: 'upload' command requires either --github or --config.");
198
+ thisCommand.outputHelp();
199
+ process.exit(1);
200
+ }
201
+ if (options.github && options.config) {
202
+ console.error("\n❌ Error: Cannot use both --github and --config simultaneously.");
203
+ thisCommand.outputHelp();
204
+ process.exit(1);
205
+ }
206
+ });
207
+ // 2. SEARCH Command
208
+ program.command('search')
209
+ .description('Search for registered AI Agents by query or specific ID.')
210
+ .option('-q <query>', 'A free-text query string to search for agents.')
211
+ .option('--id <id>', 'The specific unique ID of the AI Agent to retrieve.', (value) => parseInt(value, 10))
212
+ .option('--count-per-page <count>', 'Count per page of search results returned.', (value) => parseInt(value, 10), 10) // default=10
213
+ .action(handleSearch);
214
+ program.parse(process.argv);
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@aiagenta2z/agtm",
3
+ "version": "1.0.1",
4
+ "description": "Open Source CLI for AI Agent Marketplace Registration, AI Agents Management, AI Agents Index and Search",
5
+ "main": "dist/agtm-cli.js",
6
+ "bin": {
7
+ "agtm": "dist/agtm-cli.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc"
11
+ },
12
+ "files": [
13
+ "dist",
14
+ "README.md",
15
+ "agent.json",
16
+ "agent.yaml"
17
+ ],
18
+ "author": "deepnlp",
19
+ "license": "ISC",
20
+ "devDependencies": {
21
+ "@types/js-yaml": "^4.0.9",
22
+ "@types/node": "^24.10.0",
23
+ "ts-node": "^10.9.2",
24
+ "typescript": "^5.9.3"
25
+ },
26
+ "dependencies": {
27
+ "axios": "^1.13.2",
28
+ "commander": "^14.0.2",
29
+ "js-yaml": "^4.1.0"
30
+ }
31
+ }