@artinet/fleet 0.1.1 → 0.1.7

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 (38) hide show
  1. package/README.md +109 -230
  2. package/dist/default.d.ts +1 -0
  3. package/dist/default.js +1 -0
  4. package/dist/routes/create/index.d.ts +51 -50
  5. package/dist/routes/create/index.js +1 -1
  6. package/dist/routes/request/implementation/load.d.ts +1 -1
  7. package/dist/routes/request/implementation/load.js +17 -20
  8. package/dist/routes/request/types/definitions.d.ts +59 -57
  9. package/dist/routes/request/types/definitions.js +5 -7
  10. package/dist/server/express/agent-request.d.ts +6 -15
  11. package/dist/server/express/agent-request.js +33 -27
  12. package/dist/server/express/deploy-request.d.ts +6 -14
  13. package/dist/server/express/deploy-request.js +18 -18
  14. package/dist/server/express/server.d.ts +73 -13
  15. package/dist/server/express/server.js +57 -49
  16. package/dist/server/express/test-request.d.ts +16 -14
  17. package/dist/server/express/test-request.js +25 -25
  18. package/dist/server/express/types.d.ts +10 -0
  19. package/dist/server/express/types.js +5 -0
  20. package/dist/server/hono/agent-request.d.ts +6 -14
  21. package/dist/server/hono/agent-request.js +25 -21
  22. package/dist/server/hono/deploy-request.d.ts +6 -13
  23. package/dist/server/hono/deploy-request.js +14 -13
  24. package/dist/server/hono/rpc.d.ts +9 -11
  25. package/dist/server/hono/rpc.js +19 -20
  26. package/dist/server/hono/server.d.ts +82 -13
  27. package/dist/server/hono/server.js +63 -44
  28. package/dist/server/hono/test-request.d.ts +6 -13
  29. package/dist/server/hono/test-request.js +26 -26
  30. package/dist/server/hono/types.d.ts +9 -0
  31. package/dist/server/hono/types.js +5 -0
  32. package/dist/settings.d.ts +22 -1
  33. package/dist/ship.d.ts +45 -1
  34. package/dist/ship.js +46 -1
  35. package/dist/types.d.ts +37 -0
  36. package/dist/utils.d.ts +11 -0
  37. package/dist/utils.js +13 -0
  38. package/package.json +108 -108
package/README.md CHANGED
@@ -9,7 +9,16 @@
9
9
 
10
10
  Deploy AI agents on any infrastructure.
11
11
 
12
- Fleet is a lightweight server framework for hosting agents with built-in orchestration, tool integration (MCP), and Agent2Agent communication.
12
+ Fleet is a lightweight server framework for hosting agents with built-in orchestration, tool integration (MCP), and Agent2Agent (A2A) communication.
13
+
14
+ ## Features
15
+
16
+ - **Multi-Framework Support** — Express and Hono adapters (with edge runtime compatibility on the way).
17
+ - **A2A Protocol Compliant** — Full JSON-RPC 2.0 implementation for agent interactions
18
+ - **MCP Integration** — Connect to Model Context Protocol servers for tool access
19
+ - **Pluggable Storage** — In-memory, SQLite, or custom storage backends
20
+ - **Custom Middleware** — Intercept and transform requests/responses
21
+ - **Multi-Tenant Ready** — Built-in user isolation for SaaS deployments
13
22
 
14
23
  ## Installation
15
24
 
@@ -17,40 +26,38 @@ Fleet is a lightweight server framework for hosting agents with built-in orchest
17
26
  npm install @artinet/fleet openai @modelcontextprotocol/sdk @a2a-js/sdk
18
27
  ```
19
28
 
20
- **Requirements:** Node.js 18.9.1
29
+ **Requirements:** Node.js >= 18.9.1
21
30
 
22
31
  ## Quick Start
23
32
 
24
33
  ### 1. Launch a Fleet
25
34
 
26
- Set an `OPENAI_API_KEY` in you environment variables, then start your Server.
35
+ Set an `OPENAI_API_KEY` in your environment variables, then start your server.
27
36
 
28
- **Express**:
37
+ **Express:**
29
38
 
30
39
  ```bash
31
40
  npm install express
32
41
  ```
33
42
 
34
43
  ```typescript
35
- import { fleet } from "@artinet/fleet/express";
44
+ import { fleet } from '@artinet/fleet/express';
36
45
 
37
46
  fleet().launch(3000);
38
47
  ```
39
48
 
40
- **Hono**:
49
+ **Hono:**
41
50
 
42
51
  ```bash
43
52
  npm install hono
44
53
  ```
45
54
 
46
55
  ```typescript
47
- import { fleet } from "@artinet/fleet/hono";
56
+ import { fleet } from '@artinet/fleet/hono';
48
57
 
49
58
  fleet().launch(3000);
50
59
  ```
51
60
 
52
- > 🚧 **More servers coming soon** — Bun adapters and edge support are on the roadmap.
53
-
54
61
  That's it. You now have:
55
62
 
56
63
  - `POST /deploy` — Deploy agents
@@ -60,79 +67,96 @@ That's it. You now have:
60
67
 
61
68
  ### 2. Deploy an Agent
62
69
 
63
- **Prelaunch**:
70
+ **Prelaunch (ship before launch):**
64
71
 
65
72
  ```typescript
66
- import { fleet } from "@artinet/fleet/express";
73
+ import { fleet } from '@artinet/fleet/express';
67
74
 
68
75
  const myFleet = await fleet().ship([
69
- {
70
- config: {
71
- uri: "my-agent",
72
- ...
76
+ {
77
+ config: {
78
+ uri: 'my-agent',
79
+ name: 'My Agent',
80
+ description: 'A helpful assistant',
81
+ modelId: 'gpt-4o',
82
+ instructions: 'You are a helpful assistant.',
83
+ version: '1.0.0',
84
+ skills: [],
85
+ capabilities: {},
86
+ defaultInputModes: ['text'],
87
+ defaultOutputModes: ['text'],
88
+ services: [],
89
+ },
73
90
  },
74
- },
75
91
  ]);
76
92
 
77
93
  myFleet.launch(3000);
78
94
  ```
79
95
 
80
- **Post Launch, Ship**:
96
+ **Post Launch (ship to a running server):**
97
+
98
+ Use the ship command, it uses zod to verify agent configurations before sending them to fleet.
81
99
 
82
100
  ```typescript
83
- import { ship } from "@artinet/fleet";
101
+ import { ship } from '@artinet/fleet';
84
102
 
85
- await ship("http://localhost:3000", {
103
+ await ship('http://localhost:3000', {
86
104
  config: {
87
- uri: "my-agent",
88
- ...
105
+ uri: 'my-agent',
106
+ name: 'My Agent',
107
+ description: 'A helpful assistant',
108
+ modelId: 'gpt-4o',
109
+ instructions: 'You are a helpful assistant.',
110
+ version: '1.0.0',
111
+ skills: [],
112
+ capabilities: {},
113
+ defaultInputModes: ['text'],
114
+ defaultOutputModes: ['text'],
115
+ services: [],
89
116
  },
90
117
  });
91
118
  ```
92
119
 
93
- **Curl**:
120
+ **With MCP Tools:**
94
121
 
95
- ```bash
96
- curl -X POST http://localhost:3000/deploy \
97
- -H "Content-Type: application/json" \
98
- -d '{
99
- "config": {
100
- "name": "My Agent",
101
- "uri": "my-agent",
102
- "description": "A helpful assistant",
103
- "modelId": "gpt-4",
104
- "instructions": "You are a helpful assistant.",
105
- "version": "1.0.0",
106
- "skills": [],
107
- "capabilities" : {},
108
- "defaultInputModes": ["text"],
109
- "defaultOutputModes": ["text"],
110
- "services": [{
111
- "type": "mcp",
112
- "uri": "everything-server-1",
113
- "info": {
114
- "implementation": {
115
- "version": "0.0.1",
116
- "name": "everything"
117
- }
118
- },
119
- "arguments": {
120
- "command": "npx",
121
- "args": [
122
- "-y",
123
- "@modelcontextprotocol/server-everything@2025.11.25"
124
- ]
125
- }
126
- }]
127
- }
128
- }'
129
- ```
122
+ ```typescript
123
+ import { ship } from '@artinet/fleet';
130
124
 
131
- > 🚧 Coming Soon: Support for Remote MCP Servers.
125
+ await ship('http://localhost:3000', {
126
+ config: {
127
+ uri: 'tool-agent',
128
+ name: 'Tool Agent',
129
+ description: 'An agent with access to tools',
130
+ modelId: 'gpt-4o',
131
+ instructions: 'You are a helpful assistant with tool access.',
132
+ version: '1.0.0',
133
+ skills: [],
134
+ capabilities: {},
135
+ defaultInputModes: ['text'],
136
+ defaultOutputModes: ['text'],
137
+ services: [
138
+ {
139
+ type: 'mcp',
140
+ uri: 'everything-server',
141
+ info: {
142
+ implementation: {
143
+ version: '0.0.1',
144
+ name: 'everything',
145
+ },
146
+ },
147
+ arguments: {
148
+ command: 'npx',
149
+ args: ['-y', '@modelcontextprotocol/server-everything@2025.11.25'],
150
+ },
151
+ },
152
+ ],
153
+ },
154
+ });
155
+ ```
132
156
 
133
157
  ### 3. Talk to Your Agent
134
158
 
135
- via curl:
159
+ **Via curl:**
136
160
 
137
161
  ```bash
138
162
  curl -X POST http://localhost:3000/agentId/my-agent \
@@ -152,177 +176,34 @@ curl -X POST http://localhost:3000/agentId/my-agent \
152
176
  }'
153
177
  ```
154
178
 
155
- or via the [sdk](https://github.com/the-artinet-project/artinet-sdk):
179
+ **Via the SDK:**
156
180
 
157
181
  ```typescript
158
- import { createMessenger } from "@artinet/sdk";
182
+ import { createMessenger } from '@artinet/sdk';
159
183
 
160
184
  const messenger = createMessenger({
161
- baseUrl: "http://localhost:3000/agentId/my-agent",
185
+ baseUrl: 'http://localhost:3000/agentId/my-agent',
162
186
  });
163
187
 
164
188
  // Send a message
165
- const response = await messenger.sendMessage("Hello!");
166
-
189
+ const response = await messenger.sendMessage('Hello!');
167
190
  console.log(response);
168
191
 
169
192
  // Or stream the response
170
- for await (const update of messenger.sendMessageStream("Tell me a story")) {
171
- console.log(update);
193
+ for await (const update of messenger.sendMessageStream('Tell me a story')) {
194
+ console.log(update);
172
195
  }
173
196
  ```
174
197
 
175
- ### SQLite Storage
176
-
177
- Set up a SQLite Database with [drizzle](https://www.npmjs.com/package/drizzle-orm):
178
-
179
- ```bash
180
- npm install drizzle-orm better-sqlite3
181
- ```
182
-
183
- ```typescript
184
- import { SQLiteStore, AgentsTable } from "@artinet/fleet/sqlite";
185
- import { fleet } from "@artinet/fleet/hono";
186
- /*Use any drizzle compatible Database*/
187
- import Database from "better-sqlite3";
188
- import { drizzle } from "drizzle-orm/better-sqlite3";
189
-
190
- const sqlite = new Database("fleet.db");
191
- const db = drizzle<AgentsTable>(sqlite);
192
-
193
- fleet({
194
- storage: new SQLiteStore(db),
195
- }).launch(3000);
196
- ```
197
-
198
- ### Logging
199
-
200
- Setup a custom logger via the [@artinet/sdk](https://www.npmjs.com/package/@artinet/sdk):
201
-
202
- ```bash
203
- npm install @artinet/sdk pino pino-pretty
204
- ```
205
-
206
- ```typescript
207
- import { configure } from "@artinet/sdk";
208
- import { configurePino } from "@artinet/sdk/pino";
209
- import pino from "pino";
210
-
211
- configure({
212
- logger: configurePino(
213
- pino({
214
- level: "info",
215
- transport: {
216
- target: "pino-pretty",
217
- options: { colorize: true },
218
- },
219
- })
220
- ),
221
- });
222
- ```
223
-
224
- ### Middleware
225
-
226
- Intercept and transform agent requests and responses by adding `Middleware`:
227
-
228
- ```typescript
229
- import { fleet } from "@artinet/fleet/express";
230
- import { Middleware } from "@artinet/fleet";
231
-
232
- fleet({
233
- middleware: new Middleware()
234
- .request(async ({ request, context }) => {
235
- // Inspect or transform incoming requests
236
- console.log("Incoming request:", request);
237
- return request;
238
- })
239
- .response(
240
- async ({ response, context }) => {
241
- // Inspect or transform outgoing responses
242
- console.log("Outgoing response:", response);
243
- return response;
244
- },
245
- // Use a trigger function to determine if the middleware should fire (defaults to `true` for every request/response)
246
- ({ response, context }) => {
247
- return true;
248
- }
249
- ),
250
- }).launch(3000);
251
- ```
252
-
253
- The middleware chain is composable & sequential; add multiple `request` or `response` handlers as needed. Each handler receives the current request/response and context, and must return the (optionally modified) value.
254
-
255
- ## [Docker Configuration](https://github.com/the-artinet-project/artinet/blob/main/fleet/dockerfile)
256
-
257
- Build the docker image:
258
-
259
- ```bash
260
- docker build -t artinet-fleet .
261
- ```
262
-
263
- Copy the example and fill in your values:
198
+ ## Documentation
264
199
 
265
- ```bash
266
- cp .env.example .env
267
- # Edit .env with your API keys
268
- ```
269
-
270
- Run:
271
-
272
- ```bash
273
- docker run --env-file .env -v fleet-data:/data -p 3000:3000 -e PORT=3000 artinet-fleet
274
- ```
275
-
276
- <!-- ## Custom Handlers
277
-
278
- ```typescript
279
- import { fleet, InMemoryStore } from "@artinet/fleet/express";
280
-
281
- const storage = new InMemoryStore();
282
-
283
- const app = fleet(
284
- {
285
- storage,
286
-
287
- // Custom agent retrieval
288
- get: async (request, context) => {
289
- const agent = await storage.get(context.agentId);
290
- // ... return response
291
- },
292
-
293
- // Custom deployment logic
294
- set: async (request, context) => {
295
- await storage.set(request.config.uri, request.config);
296
- return { agentId: request.config.uri, success: true };
297
- },
298
- },
299
- {
300
- // Optional auth middleware
301
- auth: async (req, res, next) => {
302
- if (validateToken(req.headers.authorization)) {
303
- next();
304
- } else {
305
- res.status(401).json({ error: "Unauthorized" });
306
- }
307
- },
308
- }
309
- );
310
-
311
- app.listen(3000);
312
- ``` -->
313
-
314
- ## Settings
315
-
316
- | Option | Type | Default | Description |
317
- | ---------------------- | ------------ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
318
- | `storage` | `IDataStore` | `InMemoryStore`, `SQLiteStore` | Agent storage backend (storage adapters coming soon) |
319
- | `basePath` | `string` | `"/"` | Base path for all routes |
320
- | `agentPath` | `string` | `"/agentId"` | Agent interaction path |
321
- | `deploymentPath` | `string` | `"/deploy"` | Deployment endpoint |
322
- | `testPath` | `string` | `"/test"` | Test endpoint |
323
- | `inferenceProviderUrl` | `string` | `undefined` | An OpenAI API compatible endpoint |
324
- | `load` | `function` | `loadAgent` | Returns an A2A Protocol compliant agent wrapped in the [`@artinet/sdk`](<(https://github.com/the-artinet-project/artinet-sdk)>) |
325
- | `middleware` | `Middleware` | `undefined` | Request/response interceptors for the agent route |
200
+ | Document | Description |
201
+ | ---------------------------------- | ---------------------------------- |
202
+ | [Settings](./docs/settings.md) | Complete settings reference |
203
+ | [Storage](./docs/storage.md) | Storage backends and configuration |
204
+ | [Middleware](./docs/middleware.md) | Request/response interception |
205
+ | [API Reference](./docs/api.md) | Endpoints and JSON-RPC methods |
206
+ | [Deployment](./docs/deployment.md) | Docker and production deployment |
326
207
 
327
208
  ## API Reference
328
209
 
@@ -331,7 +212,7 @@ app.listen(3000);
331
212
  | Method | Path | Description |
332
213
  | ------ | ------------------------------------------ | -------------------- |
333
214
  | POST | `/deploy` | Deploy a new agent |
334
- | POST | `/test` | Test a new agent |
215
+ | POST | `/test` | Test an agent |
335
216
  | GET | `/agentId/:id/.well-known/agent-card.json` | Get agent card |
336
217
  | POST | `/agentId/:id` | JSON-RPC interaction |
337
218
 
@@ -343,25 +224,23 @@ app.listen(3000);
343
224
  | `message/stream` | Send a message, stream events |
344
225
  | `task/get` | Get task status |
345
226
  | `task/cancel` | Cancel a running task |
346
- | `resubscribe` | stream events |
227
+ | `resubscribe` | Stream events |
347
228
 
348
229
  ## Architecture
349
230
 
350
231
  ```
351
-
352
232
  @artinet/fleet
353
- ├── /express # Express adapter
354
- ├── /hono # Hono adapter
355
- └── /bun # Coming soon
233
+ ├── /express # Express adapter
234
+ ├── /hono # Hono adapter
235
+ └── /sqlite # SQLite storage adapter
356
236
 
357
237
  Depends on:
358
- ├── @artinet/armada # Core business logic
359
- ├── @artinet/sdk # A2A protocol client/server
360
- ├── orc8 # Agent/Tool orchestration
361
- ├── agent-def # Standardized Agent Definitions
362
- ├── openai # OpenAI API Client
363
- └── @mcp # @modelcontextprotocol/sdk
364
-
238
+ ├── @artinet/armada # Core business logic
239
+ ├── @artinet/sdk # A2A protocol client/server
240
+ ├── orc8 # Agent/Tool orchestration
241
+ ├── agent-def # Standardized Agent Definitions
242
+ ├── openai # OpenAI API Client
243
+ └── @mcp # @modelcontextprotocol/sdk
365
244
  ```
366
245
 
367
246
  ## Testing
@@ -376,4 +255,4 @@ Apache-2.0
376
255
 
377
256
  ## Contributing
378
257
 
379
- Contributions welcome! Please open an issue or PR on [GitHub](https://github.com/the-artinet-project/fleet).
258
+ Contributions welcome! Please open an issue or PR on [GitHub](https://github.com/the-artinet-project/artinet).
package/dist/default.d.ts CHANGED
@@ -692,3 +692,4 @@ export declare const DEFAULTS: {
692
692
  storage: InMemoryStore;
693
693
  baseUrl: string;
694
694
  };
695
+ export declare const AGENT_FIELD_NAME = "agentId";
package/dist/default.js CHANGED
@@ -15,3 +15,4 @@ export const DEFAULTS = {
15
15
  storage: new InMemoryStore(),
16
16
  baseUrl: "http://localhost:3000",
17
17
  };
18
+ export const AGENT_FIELD_NAME = 'agentId';