marona 0.15.0 → 1.1.0
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/CHANGELOG.md +16 -464
- package/README.md +62 -787
- package/dist/index.d.ts +113 -88
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +276 -1005
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,837 +1,112 @@
|
|
|
1
1
|
# Marona TypeScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Universal Model Gateway and MCP/Skill SDK for Node.js 18+.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
5
6
|
|
|
6
7
|
```bash
|
|
7
|
-
npm install marona
|
|
8
|
-
export MARONA_API_KEY=mr_live_xxxxx
|
|
8
|
+
npm install marona@1.1.0
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
BYOK, registered, private, self-hosted, and local models. Explicit `apiKey`
|
|
13
|
-
configuration overrides `MARONA_API_KEY`; provider credentials remain separate.
|
|
14
|
-
|
|
15
|
-
## 1. Marona Hub
|
|
11
|
+
## Authentication
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
A project-scoped Marona Developer Key is mandatory for every client and runtime
|
|
14
|
+
mode. Pass `apiKey` explicitly or set `MARONA_API_KEY`.
|
|
18
15
|
|
|
19
16
|
```ts
|
|
20
17
|
import { Marona } from "marona";
|
|
21
18
|
|
|
22
|
-
const marona = new Marona({
|
|
23
|
-
apiKey: process.env.MARONA_API_KEY,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// Connect every App and Skill available to this developer key.
|
|
27
|
-
const connection = await marona.hub.connect();
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
An unscoped connection exposes two stable provider-neutral tools:
|
|
31
|
-
`marona__discover_capabilities` and `marona__call_capability`. The agent first
|
|
32
|
-
discovers the compact App/Skill catalog, then Marona reveals only the exact
|
|
33
|
-
schemas it selects. This keeps external agents reliable as the Hub grows.
|
|
34
|
-
|
|
35
|
-
Select a smaller capability set when needed:
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
const connection = await marona.hub.connect({
|
|
39
|
-
apps: ["group-fund"],
|
|
40
|
-
skills: ["create-group-fund"],
|
|
41
|
-
});
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Use a selected connection directly:
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
const tools = connection.listTools();
|
|
48
|
-
const result = await connection.callTool("skill__create_group_fund", {
|
|
49
|
-
request: "Create a family savings group fund",
|
|
50
|
-
});
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
`MCPConnection` is not tied to OpenAI, LangGraph, CrewAI, or another model
|
|
54
|
-
vendor. It exposes:
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
connection.listTools();
|
|
58
|
-
connection.listCapabilities();
|
|
59
|
-
await connection.callTool(name, argumentsValue);
|
|
60
|
-
connection.serverUrl;
|
|
61
|
-
connection.serverUrls;
|
|
62
|
-
connection.warnings;
|
|
63
|
-
connection.session;
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
An unresolved App or Skill name does not discard valid tools. Check
|
|
67
|
-
`connection.warnings` for its `code`, `selector_type`, `slug`, and corrective
|
|
68
|
-
message. Authentication, permission, and configured-server failures
|
|
69
|
-
remain blocking errors.
|
|
70
|
-
|
|
71
|
-
Marona Hub owns discovery, identity, permissions, App and Skill resolution,
|
|
72
|
-
approvals, governed execution, and online, offline, or hybrid availability.
|
|
73
|
-
With no selectors, the gateway discovers every capability available to the
|
|
74
|
-
developer key; offline discovery covers every capability installed on the
|
|
75
|
-
device. `listCapabilities()` is available to framework adapters that explicitly
|
|
76
|
-
need the underlying exact catalog.
|
|
77
|
-
|
|
78
|
-
Connected Apps execute through Marona governance. When an App such as Google
|
|
79
|
-
Contacts or Calendar needs sign-in, the tool result includes
|
|
80
|
-
`structuredContent.authorization_url` and a `link` artifact. Pass `userId`
|
|
81
|
-
when calling a tool directly so the resulting service connection belongs to
|
|
82
|
-
the correct end user:
|
|
83
|
-
|
|
84
|
-
```ts
|
|
85
|
-
const result = await connection.callTool(
|
|
86
|
-
"contacts__search_contacts",
|
|
87
|
-
{ query: "John" },
|
|
88
|
-
{ userId: "customer_482", conversationId: "chat_91a7" },
|
|
89
|
-
);
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## 2. Marona Agent
|
|
93
|
-
|
|
94
|
-
Use Marona's `Agent` and `Runner` when you want one simple managed agent API.
|
|
95
|
-
|
|
96
|
-
```ts
|
|
97
|
-
import { Agent, Marona, Runner } from "marona";
|
|
98
|
-
|
|
99
|
-
const marona = new Marona({
|
|
100
|
-
apiKey: process.env.MARONA_API_KEY,
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const tools = await marona.hub.connect({
|
|
104
|
-
apps: ["sda-books"],
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
const agent = new Agent({
|
|
108
|
-
name: "Customer Assistant",
|
|
109
|
-
model: "marona/gpt-5.6",
|
|
110
|
-
instructions: "Help the customer.",
|
|
111
|
-
tools,
|
|
112
|
-
toolChoice: "auto",
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
const result = await Runner.run(agent, "Download Steps to Christ", {
|
|
116
|
-
userId: "customer_482",
|
|
117
|
-
sessionId: "chat_91a7",
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
console.log(result.output);
|
|
19
|
+
const marona = new Marona({ apiKey: maronaDeveloperKey });
|
|
121
20
|
```
|
|
122
21
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
`toolChoice` defaults to `"auto"`. Use `"required"` when the first model turn
|
|
128
|
-
must select a connected capability, or `"none"` to disable tools for the
|
|
129
|
-
Agent. After discovery Marona requires one exact capability call, then returns
|
|
130
|
-
to automatic selection so multi-step requests can continue.
|
|
131
|
-
|
|
132
|
-
### Automatic Model And Provider Routing
|
|
22
|
+
Missing, invalid, revoked, and expired keys throw typed
|
|
23
|
+
`MaronaAuthenticationError` subclasses. Create and rotate keys in the Marona
|
|
24
|
+
Developer Portal.
|
|
133
25
|
|
|
134
|
-
|
|
135
|
-
each request:
|
|
26
|
+
## Universal Model Gateway
|
|
136
27
|
|
|
137
28
|
```ts
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const marona = new Marona({
|
|
141
|
-
apiKey: process.env.MARONA_API_KEY,
|
|
142
|
-
});
|
|
143
|
-
const tools = await marona.hub.connect();
|
|
144
|
-
|
|
145
|
-
const agent = new Agent({
|
|
146
|
-
name: "Customer Assistant",
|
|
29
|
+
const response = await marona.responses.create({
|
|
147
30
|
model: "marona/auto",
|
|
148
|
-
|
|
149
|
-
tools,
|
|
150
|
-
voice: {
|
|
151
|
-
output_voice: "ash",
|
|
152
|
-
language: "en",
|
|
153
|
-
turn_detection: "semantic_vad",
|
|
154
|
-
interruptible: true,
|
|
155
|
-
input_format: "pcm16",
|
|
156
|
-
output_format: "pcm16",
|
|
157
|
-
},
|
|
158
|
-
modalities: ["text", "image", "audio"],
|
|
159
|
-
outputModalities: ["text", "audio"],
|
|
31
|
+
input: "Review this architecture.",
|
|
160
32
|
routing: {
|
|
161
33
|
strategy: "balanced",
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
allowedModels: ["marona/gpt-5-mini", "marona/gemini-2.5-pro"],
|
|
166
|
-
allowedProviders: ["openai", "google", "openrouter"],
|
|
167
|
-
fallback: true,
|
|
168
|
-
},
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
const result = await Runner.run(agent, [
|
|
172
|
-
{
|
|
173
|
-
role: "user",
|
|
174
|
-
content: [
|
|
175
|
-
{ type: "input_text", text: "Describe the problem shown in this image." },
|
|
176
|
-
{ type: "input_image", image_url: "https://example.com/damaged-package.jpg" },
|
|
34
|
+
allowedModels: [
|
|
35
|
+
"marona/auto",
|
|
36
|
+
"marona/company-assistant",
|
|
177
37
|
],
|
|
178
38
|
},
|
|
179
|
-
], {
|
|
180
|
-
userId: "customer_482",
|
|
181
|
-
sessionId: "chat_91a7",
|
|
182
39
|
});
|
|
183
40
|
|
|
184
|
-
console.log(
|
|
41
|
+
console.log(response.output);
|
|
185
42
|
```
|
|
186
43
|
|
|
187
|
-
|
|
188
|
-
|
|
44
|
+
Every model name must use the `marona/*` namespace. `marona/auto` delegates
|
|
45
|
+
selection to the project-scoped Model Registry; named aliases such as
|
|
46
|
+
`marona/company-assistant` resolve there. Provider credentials and custom
|
|
47
|
+
endpoints are configured once through the Marona Developer Portal or Model
|
|
48
|
+
Registry API. They are write-only and never exposed through this package.
|
|
189
49
|
|
|
190
|
-
|
|
50
|
+
All calls—including registered Edge models—go through authenticated Marona
|
|
51
|
+
Runtime. There is no direct-provider, local-executor, credential-cache, or public
|
|
52
|
+
model-registration bypass.
|
|
191
53
|
|
|
192
|
-
|
|
193
|
-
for await (const event of Runner.stream(agent, "Explain this document.", {
|
|
194
|
-
userId: "customer_482",
|
|
195
|
-
sessionId: "chat_91a7",
|
|
196
|
-
})) {
|
|
197
|
-
if (event.type === "output_text.delta") process.stdout.write(event.delta ?? "");
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
`Runner.stream(...)` forwards provider output incrementally. It also emits
|
|
202
|
-
provider-neutral `tool.started`, `tool.completed`, agent transition, and final
|
|
203
|
-
`run.completed` events. Structured output is validated only when complete.
|
|
204
|
-
|
|
205
|
-
### Realtime
|
|
54
|
+
## Agents and Hub tools
|
|
206
55
|
|
|
207
56
|
```ts
|
|
208
|
-
import {
|
|
209
|
-
|
|
210
|
-
const session = await RealtimeRunner.connect(agent, {
|
|
211
|
-
userId: "customer_482",
|
|
212
|
-
sessionId: "voice_91a7",
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
try {
|
|
216
|
-
await session.sendMessage("List my notes");
|
|
217
|
-
for await (const event of session) {
|
|
218
|
-
if (event.type === "transcript.delta") process.stdout.write(event.delta ?? "");
|
|
219
|
-
if (event.type === "response.completed") break;
|
|
220
|
-
}
|
|
221
|
-
} finally {
|
|
222
|
-
await session.close();
|
|
223
|
-
}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
The persistent session also supports `sendAudio(...)`. Provider events, tool
|
|
227
|
-
discovery, MCP/Skill execution, and function results stay internal.
|
|
228
|
-
|
|
229
|
-
### Typed Input And Output
|
|
57
|
+
import { Agent, Runner } from "marona";
|
|
230
58
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
```ts
|
|
59
|
+
const tools = await marona.hub.connect({ apps: ["sda-books"] });
|
|
234
60
|
const agent = new Agent({
|
|
235
61
|
name: "Customer Assistant",
|
|
236
|
-
model: "marona/
|
|
237
|
-
instructions: "
|
|
238
|
-
inputSchema: {
|
|
239
|
-
type: "object",
|
|
240
|
-
required: ["question"],
|
|
241
|
-
properties: { question: { type: "string" } },
|
|
242
|
-
},
|
|
243
|
-
outputSchema: {
|
|
244
|
-
type: "object",
|
|
245
|
-
required: ["answer", "needs_follow_up"],
|
|
246
|
-
properties: {
|
|
247
|
-
answer: { type: "string" },
|
|
248
|
-
needs_follow_up: { type: "boolean" },
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
const result = await Runner.run(agent, {
|
|
254
|
-
question: "When will my order arrive?",
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
console.log(result.output);
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### Multi-Agent
|
|
261
|
-
|
|
262
|
-
Use `agent.asTool()` for bounded delegation. The parent remains active and
|
|
263
|
-
combines the specialist result. Use `handoff(...)` when the destination should
|
|
264
|
-
own the conversation:
|
|
265
|
-
|
|
266
|
-
```ts
|
|
267
|
-
import { Agent, Marona, Runner, handoff } from "marona";
|
|
268
|
-
|
|
269
|
-
const marona = new Marona({ apiKey: process.env.MARONA_API_KEY });
|
|
270
|
-
const tools = await marona.hub.connect();
|
|
271
|
-
|
|
272
|
-
const researcher = new Agent({
|
|
273
|
-
name: "Research Specialist",
|
|
274
|
-
description: "Researches bounded customer questions.",
|
|
275
|
-
model: "marona/gpt-5-mini",
|
|
276
|
-
tools,
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
const billing = new Agent({
|
|
280
|
-
name: "Billing Specialist",
|
|
281
|
-
description: "Owns billing and payment conversations.",
|
|
282
|
-
model: "marona/gpt-5-mini",
|
|
62
|
+
model: "marona/auto",
|
|
63
|
+
instructions: "Help clearly.",
|
|
283
64
|
tools,
|
|
284
65
|
});
|
|
285
66
|
|
|
286
|
-
const manager = new Agent({
|
|
287
|
-
name: "Customer Assistant",
|
|
288
|
-
model: "marona/gpt-5.6",
|
|
289
|
-
tools: [researcher.asTool({ name: "research" })],
|
|
290
|
-
handoffs: [handoff(billing, { name: "transfer_to_billing" })],
|
|
291
|
-
});
|
|
292
|
-
|
|
293
67
|
const result = await Runner.run(
|
|
294
|
-
|
|
295
|
-
"
|
|
296
|
-
{ userId: "customer_482", sessionId: "
|
|
68
|
+
agent,
|
|
69
|
+
"Download Steps to Christ",
|
|
70
|
+
{ userId: "customer_482", sessionId: "chat_91a7" },
|
|
297
71
|
);
|
|
298
|
-
|
|
299
72
|
console.log(result.output);
|
|
300
|
-
console.log(result.activeAgent.name);
|
|
301
|
-
console.log(result.agentRuns);
|
|
302
73
|
```
|
|
303
74
|
|
|
304
|
-
The
|
|
305
|
-
|
|
306
|
-
|
|
75
|
+
The SDK also supports streaming, realtime, handoffs, delegation, A2A peers,
|
|
76
|
+
validated function tools, lifecycle hooks, and published Marona Skills while
|
|
77
|
+
keeping every model invocation behind the Universal Model Gateway.
|
|
307
78
|
|
|
308
|
-
|
|
79
|
+
## Errors
|
|
309
80
|
|
|
310
|
-
|
|
311
|
-
|
|
81
|
+
`MaronaError` exposes `code`, `requestId`, `retryable`,
|
|
82
|
+
`requiredAction`, `retryAfterMs`, and safe `details`. Typed subclasses
|
|
83
|
+
cover authentication, namespace/model, credits, upstream service, custom model,
|
|
84
|
+
billing, and Marona availability failures. Responses expose only safe routing
|
|
85
|
+
fields, never upstream endpoints or raw provider payloads.
|
|
312
86
|
|
|
313
|
-
|
|
314
|
-
name: "check_refund",
|
|
315
|
-
description: "Check whether a duplicate charge qualifies for a refund.",
|
|
316
|
-
inputSchema: {
|
|
317
|
-
type: "object",
|
|
318
|
-
properties: {
|
|
319
|
-
amount: { type: "number" },
|
|
320
|
-
duplicate_charge: { type: "boolean" },
|
|
321
|
-
},
|
|
322
|
-
required: ["amount", "duplicate_charge"],
|
|
323
|
-
additionalProperties: false,
|
|
324
|
-
},
|
|
325
|
-
permissions: ["billing.refund"],
|
|
326
|
-
execute: async ({ amount, duplicate_charge }, context) => ({
|
|
327
|
-
eligible: duplicate_charge && amount > 0,
|
|
328
|
-
refund_amount: duplicate_charge ? amount : 0,
|
|
329
|
-
customer_id: context.userId,
|
|
330
|
-
}),
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
const billing = new Agent({
|
|
334
|
-
name: "Billing Specialist",
|
|
335
|
-
model: "marona/gpt-5-mini",
|
|
336
|
-
tools: [checkRefund],
|
|
337
|
-
metadata: { permissions: ["billing.refund"] },
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
const result = await Runner.run(
|
|
341
|
-
billing,
|
|
342
|
-
"I was charged twice for USD 24. Check whether I qualify for a refund.",
|
|
343
|
-
{ userId: "customer_482", sessionId: "support_91a7" },
|
|
344
|
-
);
|
|
345
|
-
|
|
346
|
-
console.log(result.output);
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
The executor stays in the SDK process. Marona sends only its neutral JSON
|
|
350
|
-
schema to the selected model and applies input, output, permission, approval,
|
|
351
|
-
and timeout checks before and after execution.
|
|
352
|
-
|
|
353
|
-
#### Realtime Multi-Agent
|
|
354
|
-
|
|
355
|
-
Define the complete Agent graph, then pass its manager to
|
|
356
|
-
`RealtimeRunner.connect(...)`. Delegation tools and handoffs remain available
|
|
357
|
-
throughout the persistent realtime session:
|
|
358
|
-
|
|
359
|
-
```ts
|
|
360
|
-
import { Agent, Marona, RealtimeRunner, handoff } from "marona";
|
|
361
|
-
|
|
362
|
-
const marona = new Marona({ apiKey: process.env.MARONA_API_KEY });
|
|
363
|
-
const tools = await marona.hub.connect();
|
|
364
|
-
|
|
365
|
-
const researcher = new Agent({
|
|
366
|
-
name: "Research Specialist",
|
|
367
|
-
description: "Researches bounded customer questions.",
|
|
368
|
-
model: "marona/gpt-5-mini",
|
|
369
|
-
tools,
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
const billing = new Agent({
|
|
373
|
-
name: "Billing Specialist",
|
|
374
|
-
description: "Owns billing and payment conversations.",
|
|
375
|
-
model: "marona/gpt-5-mini",
|
|
376
|
-
tools,
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
const manager = new Agent({
|
|
380
|
-
name: "Customer Assistant",
|
|
381
|
-
model: "marona/gpt-5.6",
|
|
382
|
-
tools: [
|
|
383
|
-
researcher.asTool({
|
|
384
|
-
name: "research",
|
|
385
|
-
description: "Research one bounded question and return the result.",
|
|
386
|
-
}),
|
|
387
|
-
],
|
|
388
|
-
handoffs: [
|
|
389
|
-
handoff(billing, {
|
|
390
|
-
name: "transfer_to_billing",
|
|
391
|
-
description: "Transfer billing and payment requests.",
|
|
392
|
-
}),
|
|
393
|
-
],
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
const session = await RealtimeRunner.connect(manager, {
|
|
397
|
-
userId: "customer_482",
|
|
398
|
-
sessionId: "support_voice_91a7",
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
try {
|
|
402
|
-
await session.sendMessage("I was charged twice and need help.");
|
|
403
|
-
|
|
404
|
-
for await (const event of session) {
|
|
405
|
-
if (event.type === "agent.handoff.completed") {
|
|
406
|
-
console.log(event.data.target_agent);
|
|
407
|
-
} else if (event.type === "response.completed") {
|
|
408
|
-
console.log(event.output);
|
|
409
|
-
break;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
} finally {
|
|
413
|
-
await session.close();
|
|
414
|
-
}
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
Marona keeps provider events internal and emits one provider-neutral event
|
|
418
|
-
stream. After a handoff, the destination Agent owns the following turns.
|
|
419
|
-
|
|
420
|
-
## 3. Marona Runtime
|
|
421
|
-
|
|
422
|
-
Use `responses.create(...)` when Marona should manage model reasoning, tool
|
|
423
|
-
selection, permission and approval checks, execution, and the final response.
|
|
424
|
-
|
|
425
|
-
```ts
|
|
426
|
-
import { Marona } from "marona";
|
|
427
|
-
|
|
428
|
-
const marona = new Marona({
|
|
429
|
-
apiKey: process.env.MARONA_API_KEY,
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
const tools = await marona.hub.connect({
|
|
433
|
-
apps: ["group-fund"],
|
|
434
|
-
skills: ["create-group-fund"],
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
const lifecycleHooks = {
|
|
438
|
-
onStart: async (context) => console.log(context.agentName),
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
const response = await marona.responses.create({
|
|
442
|
-
model: "marona/gpt-5.6",
|
|
443
|
-
tools,
|
|
444
|
-
input: "Create a family savings group fund",
|
|
445
|
-
toolChoice: "auto",
|
|
446
|
-
hooks: lifecycleHooks, // optional provider-neutral lifecycle hooks
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
console.log(response.output);
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
The same lifecycle hook object works with `Runner.run(...)`,
|
|
453
|
-
`Runner.stream(...)`, `RealtimeRunner.connect(...)`, and
|
|
454
|
-
`marona.responses.create(...)`. The runtime supplies the active model, provider,
|
|
455
|
-
user, and session; do not repeat them in hook configuration.
|
|
456
|
-
|
|
457
|
-
```ts
|
|
458
|
-
model: "marona/auto"
|
|
459
|
-
model: "marona/gpt-5.6"
|
|
460
|
-
model: "marona/gpt-5-mini"
|
|
461
|
-
model: "marona/gpt-5-nano"
|
|
462
|
-
model: "marona/claude-sonnet"
|
|
463
|
-
model: "marona/gemini-2.5-pro"
|
|
464
|
-
model: "marona/deepseek-chat"
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
Use `marona/auto` when Marona should select both model and provider:
|
|
468
|
-
|
|
469
|
-
```ts
|
|
470
|
-
import { Marona } from "marona";
|
|
471
|
-
|
|
472
|
-
const marona = new Marona({
|
|
473
|
-
apiKey: process.env.MARONA_API_KEY,
|
|
474
|
-
});
|
|
475
|
-
|
|
476
|
-
const lifecycleHooks = {
|
|
477
|
-
onComplete: async (_context, result) => {
|
|
478
|
-
console.log(result.model, result.routing);
|
|
479
|
-
},
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
const response = await marona.responses.create({
|
|
483
|
-
model: "marona/auto",
|
|
484
|
-
routing: {
|
|
485
|
-
strategy: "balanced", // balanced | quality | cost | latency
|
|
486
|
-
maxCostUsd: 0.02,
|
|
487
|
-
targetLatencyMs: 3000,
|
|
488
|
-
timeoutMs: 30000,
|
|
489
|
-
allowedModels: ["marona/gpt-5-mini", "marona/claude-sonnet"],
|
|
490
|
-
allowedProviders: ["openai", "anthropic", "openrouter"],
|
|
491
|
-
fallback: true,
|
|
492
|
-
},
|
|
493
|
-
input: "Review this distributed system design.",
|
|
494
|
-
hooks: lifecycleHooks,
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
console.log(response.output);
|
|
498
|
-
console.log(response.model);
|
|
499
|
-
console.log(response.routing);
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
The completion hook receives this same normalized response, including the
|
|
503
|
-
requested `model` contract and complete `routing` decision. An observer can
|
|
504
|
-
record the selected model from `routing`, provider, fallback, latency, cost,
|
|
505
|
-
and failure information without duplicate model configuration in the hook.
|
|
506
|
-
|
|
507
|
-
With a specific `marona/...` model, Marona keeps that exact model and may only
|
|
508
|
-
change provider. Direct-provider routes are never rerouted.
|
|
509
|
-
|
|
510
|
-
The same request also supports direct-provider, private, and local models:
|
|
511
|
-
|
|
512
|
-
```ts
|
|
513
|
-
model: "openai/gpt-5.6" // Marona key + OpenAI key
|
|
514
|
-
model: "openrouter/anthropic/claude-sonnet" // OpenRouter
|
|
515
|
-
model: "anthropic/claude-sonnet" // Anthropic directly
|
|
516
|
-
model: "google/gemini" // Google directly
|
|
517
|
-
model: "ollama/qwen3" // Ollama
|
|
518
|
-
model: "litellm/local-qwen" // LiteLLM gateway
|
|
519
|
-
model: "local/qwen" // Downloaded/in-process model
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
Direct provider routes resolve credentials from their standard environment
|
|
523
|
-
variables. For OpenRouter, set `OPENROUTER_API_KEY`; Marona automatically uses
|
|
524
|
-
`https://openrouter.ai/api/v1` and preserves the remaining OpenRouter model
|
|
525
|
-
slug:
|
|
526
|
-
|
|
527
|
-
```ts
|
|
528
|
-
const response = await marona.responses.create({
|
|
529
|
-
model: "openrouter/anthropic/claude-sonnet",
|
|
530
|
-
input: "Help me with this request",
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
console.log(response.output);
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
Register only custom providers or downloaded in-process models:
|
|
537
|
-
|
|
538
|
-
```ts
|
|
539
|
-
import { Marona } from "marona";
|
|
540
|
-
|
|
541
|
-
// Resolves MARONA_API_KEY. The key remains mandatory for registered/local models.
|
|
542
|
-
const marona = new Marona();
|
|
543
|
-
|
|
544
|
-
await marona.models.register({
|
|
545
|
-
name: "office/company-assistant",
|
|
546
|
-
provider: "custom",
|
|
547
|
-
endpoint: "https://models.office.example/v1",
|
|
548
|
-
model: "company-assistant-v2",
|
|
549
|
-
apiKey: process.env.OFFICE_MODEL_API_KEY,
|
|
550
|
-
adapter: officeNativeAdapter,
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
await marona.models.register({
|
|
554
|
-
name: "local/qwen",
|
|
555
|
-
executor: qwenExecutor,
|
|
556
|
-
contextWindow: 8192,
|
|
557
|
-
maxOutputTokens: 512,
|
|
558
|
-
});
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
All managed, BYOK, registered, private, self-hosted, and local model routes
|
|
562
|
-
require `MARONA_API_KEY`. A provider or model endpoint key does not replace it.
|
|
563
|
-
|
|
564
|
-
### Images
|
|
565
|
-
|
|
566
|
-
```ts
|
|
567
|
-
import { Marona } from "marona";
|
|
568
|
-
|
|
569
|
-
const marona = new Marona({
|
|
570
|
-
apiKey: process.env.MARONA_API_KEY,
|
|
571
|
-
});
|
|
572
|
-
|
|
573
|
-
const response = await marona.responses.create({
|
|
574
|
-
model: "openai/gpt-5.6",
|
|
575
|
-
input: [
|
|
576
|
-
{
|
|
577
|
-
role: "user",
|
|
578
|
-
content: [
|
|
579
|
-
{ type: "input_text", text: "Summarize this image." },
|
|
580
|
-
{ type: "input_image", image_url: "https://example.com/image.jpg" },
|
|
581
|
-
],
|
|
582
|
-
},
|
|
583
|
-
],
|
|
584
|
-
});
|
|
585
|
-
|
|
586
|
-
console.log(response.output);
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
### Files
|
|
590
|
-
|
|
591
|
-
```ts
|
|
592
|
-
import { Marona } from "marona";
|
|
593
|
-
|
|
594
|
-
const marona = new Marona({
|
|
595
|
-
apiKey: process.env.MARONA_API_KEY,
|
|
596
|
-
});
|
|
597
|
-
|
|
598
|
-
const response = await marona.responses.create({
|
|
599
|
-
model: "openai/gpt-5.6",
|
|
600
|
-
input: [
|
|
601
|
-
{
|
|
602
|
-
role: "user",
|
|
603
|
-
content: [
|
|
604
|
-
{ type: "input_text", text: "Summarize this file." },
|
|
605
|
-
{
|
|
606
|
-
type: "input_file",
|
|
607
|
-
filename: "report.pdf",
|
|
608
|
-
file_data: "data:application/pdf;base64,...",
|
|
609
|
-
detail: "high",
|
|
610
|
-
},
|
|
611
|
-
],
|
|
612
|
-
},
|
|
613
|
-
],
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
console.log(response.output);
|
|
617
|
-
```
|
|
618
|
-
|
|
619
|
-
## 4. Bring Your Own Agent
|
|
620
|
-
|
|
621
|
-
The external framework owns its Agent, reasoning, and orchestration. Marona
|
|
622
|
-
supplies neutral MCP tools and retains authorization, approvals, and execution.
|
|
623
|
-
|
|
624
|
-
```ts
|
|
625
|
-
const connection = await marona.hub.connect({
|
|
626
|
-
apps: ["group-fund"],
|
|
627
|
-
skills: ["create-group-fund"],
|
|
628
|
-
});
|
|
629
|
-
|
|
630
|
-
const frameworkTools = yourFrameworkMcpAdapter(connection);
|
|
631
|
-
|
|
632
|
-
const agent = new YourAgent({
|
|
633
|
-
name: "Group Fund Assistant",
|
|
634
|
-
model: "marona/gpt-5.6",
|
|
635
|
-
instructions: "Help users create and manage group funds.",
|
|
636
|
-
tools: frameworkTools,
|
|
637
|
-
});
|
|
638
|
-
|
|
639
|
-
const result = await agent.run("Create a family savings group fund");
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
An MCP-compatible framework can map its standard list-tools and call-tool hooks
|
|
643
|
-
directly to `connection.listTools()` and `connection.callTool(...)`. One
|
|
644
|
-
JavaScript object cannot automatically satisfy every framework's proprietary
|
|
645
|
-
tool interface, so any framework-specific conversion belongs at that boundary.
|
|
646
|
-
|
|
647
|
-
### OpenAI Agents SDK Example
|
|
648
|
-
|
|
649
|
-
The OpenAI Agents SDK example uses the Python Marona package and keeps the
|
|
650
|
-
OpenAI-specific adapter at the framework boundary:
|
|
651
|
-
|
|
652
|
-
```python
|
|
653
|
-
from agents import Agent, Runner
|
|
654
|
-
from marona import Marona
|
|
655
|
-
|
|
656
|
-
marona = Marona(api_key="YOUR_MARONA_API_KEY")
|
|
657
|
-
connection = marona.hub.connect(
|
|
658
|
-
apps=["group-fund"],
|
|
659
|
-
skills=["create-group-fund"],
|
|
660
|
-
)
|
|
661
|
-
|
|
662
|
-
framework_tools = your_openai_agents_mcp_adapter(connection)
|
|
663
|
-
|
|
664
|
-
agent = Agent(
|
|
665
|
-
name="Group Fund Assistant",
|
|
666
|
-
model="marona/gpt-5.6",
|
|
667
|
-
instructions="Help users create and manage group funds.",
|
|
668
|
-
tools=framework_tools,
|
|
669
|
-
)
|
|
670
|
-
|
|
671
|
-
result = Runner.run_sync(agent, "Create a family savings group fund")
|
|
672
|
-
print(result.final_output)
|
|
673
|
-
```
|
|
674
|
-
|
|
675
|
-
`your_openai_agents_mcp_adapter(...)` represents the OpenAI-specific adapter;
|
|
676
|
-
it is not part of Marona's vendor-neutral core API.
|
|
677
|
-
|
|
678
|
-
## 8. Publish A Skill
|
|
679
|
-
|
|
680
|
-
Every workflow entry uses `step()`; `type` selects reasoning, approval, or App
|
|
681
|
-
execution. New Skills default to private.
|
|
682
|
-
|
|
683
|
-
```ts
|
|
684
|
-
import { Marona, SkillDefinition, step } from "marona";
|
|
685
|
-
|
|
686
|
-
const marona = new Marona({ apiKey: process.env.MARONA_API_KEY });
|
|
687
|
-
const request = step({
|
|
688
|
-
id: "understand-request",
|
|
689
|
-
type: "reasoning",
|
|
690
|
-
instruction: "Extract the group name and currency.",
|
|
691
|
-
inputs: { message: "{{ context.user_message }}" },
|
|
692
|
-
outputs: { name: "string", currency: "string" },
|
|
693
|
-
});
|
|
694
|
-
const permission = step({
|
|
695
|
-
id: "confirm-create",
|
|
696
|
-
type: "approval",
|
|
697
|
-
message: "Create the requested group fund?",
|
|
698
|
-
outputs: { approved: "boolean" },
|
|
699
|
-
});
|
|
700
|
-
const definition = new SkillDefinition({
|
|
701
|
-
name: "create-group-fund",
|
|
702
|
-
description: "Create a group fund after explicit user approval.",
|
|
703
|
-
visibility: "public",
|
|
704
|
-
governs: ["group-fund.create_group"],
|
|
705
|
-
steps: [
|
|
706
|
-
request,
|
|
707
|
-
permission,
|
|
708
|
-
step({
|
|
709
|
-
id: "create-group",
|
|
710
|
-
type: "app",
|
|
711
|
-
app: "group-fund",
|
|
712
|
-
capability: "group-fund.create_group",
|
|
713
|
-
instruction: "Create the approved group.",
|
|
714
|
-
condition: permission.output("approved"),
|
|
715
|
-
inputs: {
|
|
716
|
-
name: request.output("name"),
|
|
717
|
-
currency: request.output("currency"),
|
|
718
|
-
},
|
|
719
|
-
outputs: { group_id: "string", name: "string" },
|
|
720
|
-
}),
|
|
721
|
-
],
|
|
722
|
-
});
|
|
723
|
-
|
|
724
|
-
await marona.skills.publish(definition, { version: "1.0.0" });
|
|
725
|
-
```
|
|
726
|
-
|
|
727
|
-
## Agent-to-Agent (A2A)
|
|
728
|
-
|
|
729
|
-
Use `peers` for independently deployed agents that implement the open A2A
|
|
730
|
-
protocol. Agent Card discovery, credentials, task execution, and artifacts stay
|
|
731
|
-
provider-neutral.
|
|
732
|
-
|
|
733
|
-
```typescript
|
|
734
|
-
import {
|
|
735
|
-
A2APeer,
|
|
736
|
-
Agent,
|
|
737
|
-
Marona,
|
|
738
|
-
RealtimeRunner,
|
|
739
|
-
Runner,
|
|
740
|
-
} from "marona";
|
|
741
|
-
|
|
742
|
-
const marona = new Marona({
|
|
743
|
-
apiKey: process.env.MARONA_API_KEY,
|
|
744
|
-
});
|
|
745
|
-
|
|
746
|
-
const flightAgent = new A2APeer({
|
|
747
|
-
name: "flight_agent",
|
|
748
|
-
url: "https://flight-agent.example.com",
|
|
749
|
-
authentication: {
|
|
750
|
-
type: "bearer",
|
|
751
|
-
token: process.env.FLIGHT_AGENT_TOKEN,
|
|
752
|
-
},
|
|
753
|
-
permissions: ["travel.route.read", "travel.dates.read"],
|
|
754
|
-
policy: {
|
|
755
|
-
deniedFields: ["payment_credentials", "identity_document"],
|
|
756
|
-
},
|
|
757
|
-
});
|
|
758
|
-
|
|
759
|
-
const tripReviewTeam = new A2APeer({
|
|
760
|
-
name: "trip_review_team",
|
|
761
|
-
url: "https://trip-review.example.com",
|
|
762
|
-
description:
|
|
763
|
-
"An independent multi-agent team that validates itineraries and budgets.",
|
|
764
|
-
authentication: {
|
|
765
|
-
type: "bearer",
|
|
766
|
-
token: process.env.TRIP_REVIEW_AGENT_TOKEN,
|
|
767
|
-
},
|
|
768
|
-
permissions: ["travel.itinerary.read", "travel.budget.read"],
|
|
769
|
-
});
|
|
770
|
-
|
|
771
|
-
const travelAgent = new Agent({
|
|
772
|
-
name: "Travel Manager",
|
|
773
|
-
model: "marona/auto",
|
|
774
|
-
instructions:
|
|
775
|
-
"Find travel options and ask the review team to validate the itinerary and budget.",
|
|
776
|
-
peers: [flightAgent, tripReviewTeam],
|
|
777
|
-
metadata: {
|
|
778
|
-
permissions: [
|
|
779
|
-
"travel.route.read",
|
|
780
|
-
"travel.dates.read",
|
|
781
|
-
"travel.itinerary.read",
|
|
782
|
-
"travel.budget.read",
|
|
783
|
-
],
|
|
784
|
-
},
|
|
785
|
-
});
|
|
786
|
-
|
|
787
|
-
const result = await Runner.run(
|
|
788
|
-
travelAgent,
|
|
789
|
-
"Find a return flight from Harare to Cape Town and validate it against USD 1,500.",
|
|
790
|
-
{ userId: "customer_482", sessionId: "travel_91a7" },
|
|
791
|
-
);
|
|
792
|
-
|
|
793
|
-
console.log(result.output);
|
|
794
|
-
```
|
|
795
|
-
|
|
796
|
-
Use the same peers in a persistent realtime session:
|
|
87
|
+
## External MCP federation
|
|
797
88
|
|
|
798
89
|
```typescript
|
|
799
|
-
const
|
|
800
|
-
|
|
801
|
-
|
|
90
|
+
const registered = await marona.hub.registerMcpServer({
|
|
91
|
+
name: "Microsoft 365 Release Communications",
|
|
92
|
+
slug: "microsoft-365-release-communications",
|
|
93
|
+
serverUrl: "https://www.microsoft.com/releasecommunications/mcp",
|
|
94
|
+
authMode: "none",
|
|
95
|
+
});
|
|
96
|
+
const serverId = registered.server.id;
|
|
97
|
+
await marona.hub.verifyMcpServer(serverId);
|
|
98
|
+
await marona.hub.activateMcpServer(serverId);
|
|
99
|
+
const tools = await marona.hub.connect({
|
|
100
|
+
apps: ["microsoft-365-release-communications"],
|
|
802
101
|
});
|
|
803
|
-
|
|
804
|
-
try {
|
|
805
|
-
await session.sendMessage(
|
|
806
|
-
"Find a direct flight to Cape Town and have the review team validate it.",
|
|
807
|
-
);
|
|
808
|
-
|
|
809
|
-
for await (const event of session) {
|
|
810
|
-
if (event.type === "response.completed") {
|
|
811
|
-
console.log(event.output);
|
|
812
|
-
break;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
} finally {
|
|
816
|
-
await session.close();
|
|
817
|
-
}
|
|
818
102
|
```
|
|
819
103
|
|
|
820
|
-
An
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
## Execution Modes
|
|
825
|
-
|
|
826
|
-
```ts
|
|
827
|
-
const marona = new Marona({
|
|
828
|
-
apiKey: process.env.MARONA_API_KEY,
|
|
829
|
-
mode: "hybrid",
|
|
830
|
-
});
|
|
831
|
-
```
|
|
104
|
+
An unscoped `connect()` returns every capability available to the developer
|
|
105
|
+
key. External calls always pass through Marona's governed gateway; upstream
|
|
106
|
+
credentials and direct external endpoints are never returned to the SDK.
|
|
832
107
|
|
|
833
|
-
|
|
834
|
-
- `hybrid`: local/private execution may fall back to online execution.
|
|
835
|
-
- `offline`: only installed local Apps, Skills, data, and local models run.
|
|
108
|
+
## Release
|
|
836
109
|
|
|
837
|
-
|
|
110
|
+
Version `1.1.0` is published to npm from tag `typescript-v1.1.0` only after
|
|
111
|
+
build, tests, package validation, and coordinated release checks succeed on
|
|
112
|
+
`main`.
|